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 void FillInfo(TextureData::Info& aInfo) const override; 29 30 bool Lock(OpenMode) override; 31 32 void Unlock() override; 33 34 already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() override; 35 36 bool Serialize(SurfaceDescriptor& aOutDescriptor) override; 37 38 void GetSubDescriptor( 39 RemoteDecoderVideoSubDescriptor* const aOutDesc) override; 40 41 void Deallocate(LayersIPCChannel*) override; 42 43 void Forget(LayersIPCChannel*) override; 44 45 bool UpdateFromSurface(gfx::SourceSurface* aSurface) override; 46 47 // For debugging purposes only. 48 already_AddRefed<gfx::DataSourceSurface> GetAsSurface(); 49 50 protected: 51 MacIOSurfaceTextureData(MacIOSurface* aSurface, gfx::BackendType aBackend); 52 53 RefPtr<MacIOSurface> mSurface; 54 gfx::BackendType mBackend; 55 }; 56 57 } // namespace layers 58 } // namespace mozilla 59 60 #endif // MOZILLA_GFX_MACIOSURFACETEXTURECLIENTOGL_H 61