SourceSurfaceD3D11.h (1957B)
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_SourceSurfaceD3D11_H_ 8 #define MOZILLA_GFX_SourceSurfaceD3D11_H_ 9 10 #include <d3d11.h> 11 12 #include "mozilla/gfx/2D.h" 13 #include "mozilla/layers/LayersTypes.h" 14 15 namespace mozilla { 16 namespace gfx { 17 18 class SourceSurfaceD3D11 : public SourceSurface { 19 public: 20 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceD3D11, override) 21 22 static RefPtr<SourceSurfaceD3D11> Create( 23 ID3D11Texture2D* aTexture, const uint32_t aArrayIndex, 24 const gfx::ColorSpace2 aColorSpace, const gfx::ColorRange aColorRange, 25 const Maybe<layers::CompositeProcessFencesHolderId> aFencesHolderId); 26 27 SourceSurfaceD3D11( 28 const SurfaceFormat aFormat, const IntSize aSize, 29 ID3D11Texture2D* aTexture, const uint32_t aArrayIndex, 30 const gfx::ColorSpace2 aColorSpace, const gfx::ColorRange aColorRange, 31 const Maybe<layers::CompositeProcessFencesHolderId> aFencesHolderId); 32 ~SourceSurfaceD3D11(); 33 34 SurfaceType GetType() const override { return SurfaceType::D3D11_TEXTURE; } 35 IntSize GetSize() const override { return mSize; } 36 SurfaceFormat GetFormat() const override { return mFormat; } 37 bool IsValid() const override; 38 already_AddRefed<DataSourceSurface> GetDataSurface() override; 39 40 ID3D11Texture2D* GetD3D11Texture() { return mTexture; } 41 42 const SurfaceFormat mFormat; 43 const IntSize mSize; 44 const RefPtr<ID3D11Texture2D> mTexture; 45 const uint32_t mArrayIndex; 46 const ColorSpace2 mColorSpace; 47 const ColorRange mColorRange; 48 const Maybe<layers::CompositeProcessFencesHolderId> mFencesHolderId; 49 }; 50 51 } // namespace gfx 52 } // namespace mozilla 53 54 #endif /* MOZILLA_GFX_SourceSurfaceD3D11_H_ */