mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 957560 - Fix some issues with CairoTextureClientD3D9 and DataTextureSourceD3D. r=Bas
This commit is contained in:
parent
ce139cc580
commit
320150da1a
@ -342,7 +342,7 @@ TemporaryRef<DataTextureSource>
|
||||
CompositorD3D11::CreateDataTextureSource(TextureFlags aFlags)
|
||||
{
|
||||
RefPtr<DataTextureSource> result = new DataTextureSourceD3D11(gfx::SurfaceFormat::UNKNOWN,
|
||||
this);
|
||||
this, aFlags);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
|
@ -62,10 +62,11 @@ GetTileRectD3D11(uint32_t aID, IntSize aSize, uint32_t aMaxSize)
|
||||
}
|
||||
|
||||
DataTextureSourceD3D11::DataTextureSourceD3D11(SurfaceFormat aFormat,
|
||||
CompositorD3D11* aCompositor)
|
||||
CompositorD3D11* aCompositor,
|
||||
TextureFlags aFlags)
|
||||
: mCompositor(aCompositor)
|
||||
, mFormat(aFormat)
|
||||
, mFlags(0)
|
||||
, mFlags(aFlags)
|
||||
, mCurrentTile(0)
|
||||
, mIsTiled(false)
|
||||
, mIterating(false)
|
||||
@ -421,7 +422,7 @@ void
|
||||
DataTextureSourceD3D11::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorD3D11* d3dCompositor = static_cast<CompositorD3D11*>(aCompositor);
|
||||
if (mCompositor != d3dCompositor) {
|
||||
if (mCompositor && mCompositor != d3dCompositor) {
|
||||
Reset();
|
||||
}
|
||||
mCompositor = d3dCompositor;
|
||||
@ -905,9 +906,9 @@ DeprecatedTextureHostYCbCrD3D11::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
RefPtr<DataTextureSource> srcCb;
|
||||
RefPtr<DataTextureSource> srcCr;
|
||||
if (!mFirstSource) {
|
||||
srcY = new DataTextureSourceD3D11(SurfaceFormat::A8, mCompositor);
|
||||
srcCb = new DataTextureSourceD3D11(SurfaceFormat::A8, mCompositor);
|
||||
srcCr = new DataTextureSourceD3D11(SurfaceFormat::A8, mCompositor);
|
||||
srcY = new DataTextureSourceD3D11(SurfaceFormat::A8, mCompositor, TEXTURE_DISALLOW_BIGIMAGE);
|
||||
srcCb = new DataTextureSourceD3D11(SurfaceFormat::A8, mCompositor, TEXTURE_DISALLOW_BIGIMAGE);
|
||||
srcCr = new DataTextureSourceD3D11(SurfaceFormat::A8, mCompositor, TEXTURE_DISALLOW_BIGIMAGE);
|
||||
mFirstSource = srcY;
|
||||
srcY->SetNextSibling(srcCb);
|
||||
srcCb->SetNextSibling(srcCr);
|
||||
|
@ -100,7 +100,8 @@ class DataTextureSourceD3D11 : public DataTextureSource
|
||||
, public TileIterator
|
||||
{
|
||||
public:
|
||||
DataTextureSourceD3D11(gfx::SurfaceFormat aFormat, CompositorD3D11* aCompositor);
|
||||
DataTextureSourceD3D11(gfx::SurfaceFormat aFormat, CompositorD3D11* aCompositor,
|
||||
TextureFlags aFlags);
|
||||
|
||||
DataTextureSourceD3D11(gfx::SurfaceFormat aFormat, CompositorD3D11* aCompositor,
|
||||
ID3D11Texture2D* aTexture);
|
||||
|
@ -89,8 +89,7 @@ CompositorD3D9::GetMaxTextureSize() const
|
||||
TemporaryRef<DataTextureSource>
|
||||
CompositorD3D9::CreateDataTextureSource(TextureFlags aFlags)
|
||||
{
|
||||
return new DataTextureSourceD3D9(SurfaceFormat::UNKNOWN, this,
|
||||
!(aFlags & TEXTURE_DISALLOW_BIGIMAGE));
|
||||
return new DataTextureSourceD3D9(SurfaceFormat::UNKNOWN, this, aFlags);
|
||||
}
|
||||
|
||||
TemporaryRef<CompositingRenderTarget>
|
||||
|
@ -1214,11 +1214,10 @@ void
|
||||
DataTextureSourceD3D9::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
CompositorD3D9* d3dCompositor = static_cast<CompositorD3D9*>(aCompositor);
|
||||
|
||||
if (d3dCompositor != mCompositor) {
|
||||
if (mCompositor && mCompositor != d3dCompositor) {
|
||||
Reset();
|
||||
mCompositor = d3dCompositor;
|
||||
}
|
||||
mCompositor = d3dCompositor;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1278,6 +1277,7 @@ CairoTextureClientD3D9::Lock(OpenMode)
|
||||
if (mNeedsClear) {
|
||||
mDrawTarget = GetAsDrawTarget();
|
||||
mDrawTarget->ClearRect(Rect(0, 0, GetSize().width, GetSize().height));
|
||||
mNeedsClear = false;
|
||||
}
|
||||
mIsLocked = true;
|
||||
return true;
|
||||
@ -1339,19 +1339,22 @@ CairoTextureClientD3D9::GetAsDrawTarget()
|
||||
}
|
||||
}
|
||||
|
||||
if (ContentForFormat(mFormat) == gfxContentType::COLOR_ALPHA) {
|
||||
D3DLOCKED_RECT rect;
|
||||
mD3D9Surface->LockRect(&rect, nullptr, 0);
|
||||
mSurface = new gfxImageSurface((uint8_t*)rect.pBits, ThebesIntSize(mSize),
|
||||
rect.Pitch, gfxImageFormat::ARGB32);
|
||||
mLockRect = true;
|
||||
} else {
|
||||
if (ContentForFormat(mFormat) == gfxContentType::COLOR) {
|
||||
mSurface = new gfxWindowsSurface(mD3D9Surface);
|
||||
if (!mSurface || mSurface->CairoStatus()) {
|
||||
NS_WARNING("Could not create surface for d3d9 surface");
|
||||
mSurface = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
// gfxWindowsSurface don't support transparency so we can't use the d3d9
|
||||
// windows surface optimization.
|
||||
// Instead we have to use a gfxImageSurface and fallback for font drawing.
|
||||
D3DLOCKED_RECT rect;
|
||||
mD3D9Surface->LockRect(&rect, nullptr, 0);
|
||||
mSurface = new gfxImageSurface((uint8_t*)rect.pBits, ThebesIntSize(mSize),
|
||||
rect.Pitch, SurfaceFormatToImageFormat(mFormat));
|
||||
mLockRect = true;
|
||||
}
|
||||
|
||||
mDrawTarget =
|
||||
@ -1557,10 +1560,15 @@ DataTextureSourceD3D9::UpdateFromTexture(IDirect3DTexture9* aTexture,
|
||||
|
||||
D3DSURFACE_DESC desc;
|
||||
HRESULT hr = aTexture->GetLevelDesc(0, &desc);
|
||||
if (!FAILED(hr)) {
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
} else {
|
||||
// If we changed the compositor, the size might have been reset to zero
|
||||
// Otherwise the texture size must not change.
|
||||
MOZ_ASSERT(mFormat == D3D9FormatToSurfaceFormat(desc.Format));
|
||||
MOZ_ASSERT(mSize.width == desc.Width);
|
||||
MOZ_ASSERT(mSize.height == desc.Height);
|
||||
MOZ_ASSERT(!mSize.width || mSize.width == desc.Width);
|
||||
MOZ_ASSERT(!mSize.height || mSize.height == desc.Height);
|
||||
mSize = IntSize(desc.Width, desc.Height);
|
||||
}
|
||||
|
||||
DeviceManagerD3D9* dm = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
|
||||
@ -1598,10 +1606,18 @@ DataTextureSourceD3D9::UpdateFromTexture(IDirect3DTexture9* aTexture,
|
||||
POINT point;
|
||||
point.x = iterRect->x;
|
||||
point.y = iterRect->y;
|
||||
dm->device()->UpdateSurface(srcSurface, &rect, dstSurface, &point);
|
||||
hr = dm->device()->UpdateSurface(srcSurface, &rect, dstSurface, &point);
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed Update the surface");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dm->device()->UpdateSurface(srcSurface, nullptr, dstSurface, nullptr);
|
||||
hr = dm->device()->UpdateSurface(srcSurface, nullptr, dstSurface, nullptr);
|
||||
if (FAILED(hr)) {
|
||||
NS_WARNING("Failed Update the surface");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
mIsTiled = false;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user