зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset da04776fc1bd (bug 1288618)
This commit is contained in:
Родитель
bfe2209cd3
Коммит
b3103bcc88
|
@ -119,21 +119,6 @@ Compositor::AssertOnCompositorThread()
|
|||
"Can only call this from the compositor thread!");
|
||||
}
|
||||
|
||||
already_AddRefed<TextureSource>
|
||||
Compositor::CreateTextureSourceForImage(Image* aImage)
|
||||
{
|
||||
RefPtr<gfx::SourceSurface> src = aImage->GetAsSourceSurface();
|
||||
if (!src) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<gfx::DataSourceSurface> data = src->GetDataSurface();
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<DataTextureSource> result = CreateDataTextureSourceAround(data);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
Compositor::ShouldDrawDiagnostics(DiagnosticFlags aFlags)
|
||||
{
|
||||
|
|
|
@ -203,13 +203,6 @@ public:
|
|||
virtual already_AddRefed<DataTextureSource>
|
||||
CreateDataTextureSourceAroundYCbCr(TextureHost* aTexture) { return nullptr; }
|
||||
|
||||
/**
|
||||
* Used for OOP video decoding. This should go away when we switch to
|
||||
* using PTexture (bug 1302918). DO NOT USE THIS FOR ANYTHING ELSE.
|
||||
*/
|
||||
virtual already_AddRefed<TextureSource>
|
||||
CreateTextureSourceForImage(Image* aImage);
|
||||
|
||||
virtual bool Initialize(nsCString* const out_failureReason) = 0;
|
||||
virtual void Destroy();
|
||||
bool IsDestroyed() const { return mIsDestroyed; }
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
#include "mozilla/Telemetry.h"
|
||||
#include "BlendShaderConstants.h"
|
||||
|
||||
#include "D3D11ShareHandleImage.h"
|
||||
#include "D3D9SurfaceImage.h"
|
||||
|
||||
#include <dxgi1_2.h>
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -450,63 +447,6 @@ CompositorD3D11::CreateDataTextureSource(TextureFlags aFlags)
|
|||
return result.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<TextureSource>
|
||||
CompositorD3D11::CreateTextureSourceForImage(Image* aImage)
|
||||
{
|
||||
if (aImage->GetFormat() == ImageFormat::D3D11_SHARE_HANDLE_TEXTURE) {
|
||||
D3D11ShareHandleImage* image = static_cast<D3D11ShareHandleImage*>(aImage);
|
||||
|
||||
RefPtr<ID3D11Texture2D> tex = image->GetTexture();
|
||||
RefPtr<ID3D11Device> device;
|
||||
tex->GetDevice(getter_AddRefs(device));
|
||||
|
||||
HRESULT hr;
|
||||
if (device != GetDevice()) {
|
||||
RefPtr<IDXGIResource> resource;
|
||||
tex->QueryInterface((IDXGIResource**)getter_AddRefs(resource));
|
||||
if (!resource) {
|
||||
return nullptr;
|
||||
}
|
||||
HANDLE sharedHandle;
|
||||
hr = resource->GetSharedHandle(&sharedHandle);
|
||||
if (FAILED(hr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
tex = nullptr;
|
||||
hr = GetDevice()->OpenSharedResource(sharedHandle,
|
||||
__uuidof(ID3D11Texture2D),
|
||||
(void**)(ID3D11Texture2D**)getter_AddRefs(tex));
|
||||
if (FAILED(hr)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
RefPtr<TextureSource> source = new DataTextureSourceD3D11(SurfaceFormat::B8G8R8X8,
|
||||
this,
|
||||
tex);
|
||||
return source.forget();
|
||||
} else if (aImage->GetFormat() == ImageFormat::D3D9_RGB32_TEXTURE) {
|
||||
D3D9SurfaceImage* image = static_cast<D3D9SurfaceImage*>(aImage);
|
||||
|
||||
HANDLE handle = image->GetShareHandle();
|
||||
|
||||
RefPtr<ID3D11Texture2D> texture;
|
||||
HRESULT hr = GetDevice()->OpenSharedResource(handle,
|
||||
__uuidof(ID3D11Texture2D),
|
||||
(void**)(ID3D11Texture2D**)getter_AddRefs(texture));
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed to open shared texture");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<TextureSource> source = new DataTextureSourceD3D11(SurfaceFormat::B8G8R8X8,
|
||||
this,
|
||||
texture);
|
||||
return source.forget();
|
||||
}
|
||||
return Compositor::CreateTextureSourceForImage(aImage);
|
||||
}
|
||||
|
||||
TextureFactoryIdentifier
|
||||
CompositorD3D11::GetTextureFactoryIdentifier()
|
||||
{
|
||||
|
|
|
@ -55,9 +55,6 @@ public:
|
|||
virtual already_AddRefed<DataTextureSource>
|
||||
CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) override;
|
||||
|
||||
virtual already_AddRefed<TextureSource>
|
||||
CreateTextureSourceForImage(Image* aImage) override;
|
||||
|
||||
virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) override;
|
||||
virtual int32_t GetMaxTextureSize() const final;
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "gfxCrashReporterUtils.h"
|
||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
#include "mozilla/widget/WinCompositorWidget.h"
|
||||
#include "D3D9SurfaceImage.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -203,33 +202,6 @@ CompositorD3D9::CreateRenderTargetFromSource(const gfx::IntRect &aRect,
|
|||
aRect);
|
||||
}
|
||||
|
||||
already_AddRefed<TextureSource>
|
||||
CompositorD3D9::CreateTextureSourceForImage(Image* aImage)
|
||||
{
|
||||
if (aImage->GetFormat() == ImageFormat::D3D9_RGB32_TEXTURE) {
|
||||
D3D9SurfaceImage* image = static_cast<D3D9SurfaceImage*>(aImage);
|
||||
|
||||
HANDLE handle = image->GetShareHandle();
|
||||
|
||||
RefPtr<IDirect3DTexture9> texture;
|
||||
HRESULT hr = device()->CreateTexture(aImage->GetSize().width, aImage->GetSize().height, 1,
|
||||
D3DUSAGE_RENDERTARGET,
|
||||
D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT,
|
||||
getter_AddRefs(texture),
|
||||
(HANDLE*)&handle);
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed to open shared texture");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<TextureSource> source =
|
||||
new DataTextureSourceD3D9(SurfaceFormat::B8G8R8A8, aImage->GetSize(), this, texture);
|
||||
return source.forget();
|
||||
}
|
||||
return Compositor::CreateTextureSourceForImage(aImage);
|
||||
}
|
||||
|
||||
void
|
||||
CompositorD3D9::SetRenderTarget(CompositingRenderTarget *aRenderTarget)
|
||||
{
|
||||
|
|
|
@ -45,9 +45,6 @@ public:
|
|||
const CompositingRenderTarget *aSource,
|
||||
const gfx::IntPoint &aSourcePoint) override;
|
||||
|
||||
virtual already_AddRefed<TextureSource>
|
||||
CreateTextureSourceForImage(Image* aImage) override;
|
||||
|
||||
virtual void SetRenderTarget(CompositingRenderTarget *aSurface) override;
|
||||
virtual CompositingRenderTarget* GetCurrentRenderTarget() const override
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче