|
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef GFX_SHAREDTEXTUREIMAGE_H |
|
7 #define GFX_SHAREDTEXTUREIMAGE_H |
|
8 |
|
9 #include "GLContextProvider.h" // for GLContextProvider |
|
10 #include "ImageContainer.h" // for Image |
|
11 #include "ImageTypes.h" // for ImageFormat::SHARED_TEXTURE |
|
12 #include "nsCOMPtr.h" // for already_AddRefed |
|
13 #include "mozilla/gfx/Point.h" // for IntSize |
|
14 |
|
15 // Split into a separate header from ImageLayers.h due to GLContext.h dependence |
|
16 // Implementation remains in ImageLayers.cpp |
|
17 |
|
18 namespace mozilla { |
|
19 |
|
20 namespace layers { |
|
21 |
|
22 class SharedTextureImage : public Image { |
|
23 public: |
|
24 struct Data { |
|
25 gl::SharedTextureHandle mHandle; |
|
26 gl::SharedTextureShareType mShareType; |
|
27 gfx::IntSize mSize; |
|
28 bool mInverted; |
|
29 }; |
|
30 |
|
31 void SetData(const Data& aData) { mData = aData; } |
|
32 const Data* GetData() { return &mData; } |
|
33 |
|
34 gfx::IntSize GetSize() { return mData.mSize; } |
|
35 |
|
36 virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE |
|
37 { |
|
38 return nullptr; |
|
39 } |
|
40 |
|
41 SharedTextureImage() : Image(nullptr, ImageFormat::SHARED_TEXTURE) {} |
|
42 |
|
43 private: |
|
44 Data mData; |
|
45 }; |
|
46 |
|
47 } // layers |
|
48 } // mozilla |
|
49 |
|
50 #endif // GFX_SHAREDTEXTUREIMAGE_H |