michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GFX_IMAGELAYERD3D10_H michael@0: #define GFX_IMAGELAYERD3D10_H michael@0: michael@0: #include "LayerManagerD3D10.h" michael@0: #include "ImageLayers.h" michael@0: #include "ImageContainer.h" michael@0: #include "yuv_convert.h" michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: class ImageLayerD3D10 : public ImageLayer, michael@0: public LayerD3D10 michael@0: { michael@0: public: michael@0: ImageLayerD3D10(LayerManagerD3D10 *aManager) michael@0: : ImageLayer(aManager, nullptr) michael@0: , LayerD3D10(aManager) michael@0: { michael@0: mImplData = static_cast(this); michael@0: } michael@0: michael@0: // LayerD3D10 Implementation michael@0: virtual Layer* GetLayer(); michael@0: michael@0: virtual void RenderLayer(); michael@0: michael@0: void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage); michael@0: michael@0: virtual already_AddRefed GetAsTexture(gfx::IntSize* aSize); michael@0: michael@0: private: michael@0: ID3D10ShaderResourceView* GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex **aMutex = nullptr); michael@0: }; michael@0: michael@0: struct PlanarYCbCrD3D10BackendData : public ImageBackendData michael@0: { michael@0: nsRefPtr mYTexture; michael@0: nsRefPtr mCrTexture; michael@0: nsRefPtr mCbTexture; michael@0: nsRefPtr mYView; michael@0: nsRefPtr mCbView; michael@0: nsRefPtr mCrView; michael@0: }; michael@0: michael@0: struct TextureD3D10BackendData : public ImageBackendData michael@0: { michael@0: nsRefPtr mTexture; michael@0: nsRefPtr mSRView; michael@0: }; michael@0: michael@0: class RemoteDXGITextureImage : public Image { michael@0: public: michael@0: RemoteDXGITextureImage() : Image(nullptr, ImageFormat::REMOTE_IMAGE_DXGI_TEXTURE) {} michael@0: michael@0: virtual TemporaryRef GetAsSourceSurface() MOZ_OVERRIDE; michael@0: michael@0: mozilla::gfx::IntSize GetSize() { return mSize; } michael@0: michael@0: TextureD3D10BackendData *GetD3D10TextureBackendData(ID3D10Device *aDevice); michael@0: michael@0: mozilla::gfx::IntSize mSize; michael@0: RemoteImageData::Format mFormat; michael@0: HANDLE mHandle; michael@0: }; michael@0: michael@0: } /* layers */ michael@0: } /* mozilla */ michael@0: #endif /* GFX_IMAGELAYERD3D10_H */