2010-09-30 15:53:49 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-09-30 15:53:49 -07:00
|
|
|
|
|
|
|
#ifndef GFX_IMAGELAYERD3D10_H
|
|
|
|
#define GFX_IMAGELAYERD3D10_H
|
|
|
|
|
|
|
|
#include "LayerManagerD3D10.h"
|
|
|
|
#include "ImageLayers.h"
|
2012-08-19 12:33:25 -07:00
|
|
|
#include "ImageContainer.h"
|
2010-09-30 15:53:49 -07:00
|
|
|
#include "yuv_convert.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-05-29 14:59:24 -07:00
|
|
|
class ImageLayerD3D10 : public ImageLayer,
|
|
|
|
public LayerD3D10
|
2010-09-30 15:53:49 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImageLayerD3D10(LayerManagerD3D10 *aManager)
|
2013-07-20 01:48:55 -07:00
|
|
|
: ImageLayer(aManager, nullptr)
|
2010-09-30 15:53:49 -07:00
|
|
|
, LayerD3D10(aManager)
|
|
|
|
{
|
|
|
|
mImplData = static_cast<LayerD3D10*>(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// LayerD3D10 Implementation
|
|
|
|
virtual Layer* GetLayer();
|
|
|
|
|
2010-11-08 01:06:15 -08:00
|
|
|
virtual void RenderLayer();
|
2010-09-30 15:53:49 -07:00
|
|
|
|
2012-01-31 18:18:30 -08:00
|
|
|
void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage);
|
2012-02-15 15:34:23 -08:00
|
|
|
|
2013-12-20 08:46:29 -08:00
|
|
|
virtual already_AddRefed<ID3D10ShaderResourceView> GetAsTexture(gfx::IntSize* aSize);
|
2012-02-15 15:34:23 -08:00
|
|
|
|
|
|
|
private:
|
2012-07-30 07:20:58 -07:00
|
|
|
ID3D10ShaderResourceView* GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex **aMutex = nullptr);
|
2010-09-30 15:53:49 -07:00
|
|
|
};
|
|
|
|
|
2012-01-31 18:18:30 -08:00
|
|
|
struct PlanarYCbCrD3D10BackendData : public ImageBackendData
|
2010-09-30 15:53:49 -07:00
|
|
|
{
|
|
|
|
nsRefPtr<ID3D10Texture2D> mYTexture;
|
|
|
|
nsRefPtr<ID3D10Texture2D> mCrTexture;
|
|
|
|
nsRefPtr<ID3D10Texture2D> mCbTexture;
|
|
|
|
nsRefPtr<ID3D10ShaderResourceView> mYView;
|
|
|
|
nsRefPtr<ID3D10ShaderResourceView> mCbView;
|
|
|
|
nsRefPtr<ID3D10ShaderResourceView> mCrView;
|
|
|
|
};
|
|
|
|
|
2012-02-15 19:26:19 -08:00
|
|
|
struct TextureD3D10BackendData : public ImageBackendData
|
2010-09-30 15:53:49 -07:00
|
|
|
{
|
|
|
|
nsRefPtr<ID3D10Texture2D> mTexture;
|
|
|
|
nsRefPtr<ID3D10ShaderResourceView> mSRView;
|
|
|
|
};
|
|
|
|
|
2012-05-29 22:14:30 -07:00
|
|
|
class RemoteDXGITextureImage : public Image {
|
|
|
|
public:
|
2014-01-30 14:58:49 -08:00
|
|
|
RemoteDXGITextureImage() : Image(nullptr, ImageFormat::REMOTE_IMAGE_DXGI_TEXTURE) {}
|
2012-05-29 22:14:30 -07:00
|
|
|
|
2014-01-28 06:00:10 -08:00
|
|
|
virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
|
2012-05-29 22:14:30 -07:00
|
|
|
|
2014-04-01 05:29:25 -07:00
|
|
|
mozilla::gfx::IntSize GetSize() { return mSize; }
|
2012-05-29 22:14:30 -07:00
|
|
|
|
|
|
|
TextureD3D10BackendData *GetD3D10TextureBackendData(ID3D10Device *aDevice);
|
|
|
|
|
2014-04-01 05:29:25 -07:00
|
|
|
mozilla::gfx::IntSize mSize;
|
2012-05-29 22:14:30 -07:00
|
|
|
RemoteImageData::Format mFormat;
|
|
|
|
HANDLE mHandle;
|
|
|
|
};
|
|
|
|
|
2010-09-30 15:53:49 -07:00
|
|
|
} /* layers */
|
|
|
|
} /* mozilla */
|
|
|
|
#endif /* GFX_IMAGELAYERD3D10_H */
|