1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/d3d10/ImageLayerD3D10.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,74 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_IMAGELAYERD3D10_H 1.10 +#define GFX_IMAGELAYERD3D10_H 1.11 + 1.12 +#include "LayerManagerD3D10.h" 1.13 +#include "ImageLayers.h" 1.14 +#include "ImageContainer.h" 1.15 +#include "yuv_convert.h" 1.16 + 1.17 +namespace mozilla { 1.18 +namespace layers { 1.19 + 1.20 +class ImageLayerD3D10 : public ImageLayer, 1.21 + public LayerD3D10 1.22 +{ 1.23 +public: 1.24 + ImageLayerD3D10(LayerManagerD3D10 *aManager) 1.25 + : ImageLayer(aManager, nullptr) 1.26 + , LayerD3D10(aManager) 1.27 + { 1.28 + mImplData = static_cast<LayerD3D10*>(this); 1.29 + } 1.30 + 1.31 + // LayerD3D10 Implementation 1.32 + virtual Layer* GetLayer(); 1.33 + 1.34 + virtual void RenderLayer(); 1.35 + 1.36 + void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage); 1.37 + 1.38 + virtual already_AddRefed<ID3D10ShaderResourceView> GetAsTexture(gfx::IntSize* aSize); 1.39 + 1.40 +private: 1.41 + ID3D10ShaderResourceView* GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex **aMutex = nullptr); 1.42 +}; 1.43 + 1.44 +struct PlanarYCbCrD3D10BackendData : public ImageBackendData 1.45 +{ 1.46 + nsRefPtr<ID3D10Texture2D> mYTexture; 1.47 + nsRefPtr<ID3D10Texture2D> mCrTexture; 1.48 + nsRefPtr<ID3D10Texture2D> mCbTexture; 1.49 + nsRefPtr<ID3D10ShaderResourceView> mYView; 1.50 + nsRefPtr<ID3D10ShaderResourceView> mCbView; 1.51 + nsRefPtr<ID3D10ShaderResourceView> mCrView; 1.52 +}; 1.53 + 1.54 +struct TextureD3D10BackendData : public ImageBackendData 1.55 +{ 1.56 + nsRefPtr<ID3D10Texture2D> mTexture; 1.57 + nsRefPtr<ID3D10ShaderResourceView> mSRView; 1.58 +}; 1.59 + 1.60 +class RemoteDXGITextureImage : public Image { 1.61 +public: 1.62 + RemoteDXGITextureImage() : Image(nullptr, ImageFormat::REMOTE_IMAGE_DXGI_TEXTURE) {} 1.63 + 1.64 + virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE; 1.65 + 1.66 + mozilla::gfx::IntSize GetSize() { return mSize; } 1.67 + 1.68 + TextureD3D10BackendData *GetD3D10TextureBackendData(ID3D10Device *aDevice); 1.69 + 1.70 + mozilla::gfx::IntSize mSize; 1.71 + RemoteImageData::Format mFormat; 1.72 + HANDLE mHandle; 1.73 +}; 1.74 + 1.75 +} /* layers */ 1.76 +} /* mozilla */ 1.77 +#endif /* GFX_IMAGELAYERD3D10_H */