MacIOSurfaceTextureClientOGL.h (1913B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef MOZILLA_GFX_MACIOSURFACETEXTURECLIENTOGL_H 8 #define MOZILLA_GFX_MACIOSURFACETEXTURECLIENTOGL_H 9 10 #include "mozilla/layers/TextureClientOGL.h" 11 12 class MacIOSurface; 13 14 namespace mozilla { 15 namespace layers { 16 17 class MacIOSurfaceTextureData : public TextureData { 18 public: 19 static MacIOSurfaceTextureData* Create(MacIOSurface* aSurface, 20 gfx::BackendType aBackend); 21 22 static MacIOSurfaceTextureData* Create(const gfx::IntSize& aSize, 23 gfx::SurfaceFormat aFormat, 24 gfx::BackendType aBackend); 25 26 ~MacIOSurfaceTextureData(); 27 28 TextureType GetTextureType() const override { 29 return TextureType::MacIOSurface; 30 } 31 32 void FillInfo(TextureData::Info& aInfo) const override; 33 34 bool Lock(OpenMode) override; 35 36 void Unlock() override; 37 38 already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() override; 39 40 bool Serialize(SurfaceDescriptor& aOutDescriptor) override; 41 42 void GetSubDescriptor( 43 RemoteDecoderVideoSubDescriptor* const aOutDesc) override; 44 45 void Deallocate(LayersIPCChannel*) override; 46 47 void Forget(LayersIPCChannel*) override; 48 49 bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; 50 51 // For debugging purposes only. 52 already_AddRefed<gfx::DataSourceSurface> GetAsSurface(); 53 54 protected: 55 MacIOSurfaceTextureData(MacIOSurface* aSurface, gfx::BackendType aBackend); 56 57 RefPtr<MacIOSurface> mSurface; 58 gfx::BackendType mBackend; 59 }; 60 61 } // namespace layers 62 } // namespace mozilla 63 64 #endif // MOZILLA_GFX_MACIOSURFACETEXTURECLIENTOGL_H