mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 900248. An extra safety check in TextureD3D9 plus some refactoring around it. r=Bas
This commit is contained in:
parent
b2aa6e53cd
commit
39f315cb76
@ -239,6 +239,15 @@ TextureSourceD3D9::DataToTexture(DeviceManagerD3D9* aDeviceManager,
|
||||
return texture.forget();
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedTextureHostD3D9::Reset()
|
||||
{
|
||||
mSize.width = 0;
|
||||
mSize.height = 0;
|
||||
mTextures[0] = nullptr;
|
||||
mIsTiled = false;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedTextureHostShmemD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion *aRegion,
|
||||
@ -288,6 +297,7 @@ DeprecatedTextureHostShmemD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
mSize, format, bpp);
|
||||
if (!mTextures[0]) {
|
||||
NS_WARNING("Could not upload texture");
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
mIsTiled = false;
|
||||
@ -310,8 +320,7 @@ DeprecatedTextureHostShmemD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
bpp);
|
||||
if (!mTileTextures[i]) {
|
||||
NS_WARNING("Could not upload texture");
|
||||
mSize = IntSize();
|
||||
mIsTiled = false;
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -426,15 +435,18 @@ DeprecatedTextureHostSystemMemD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
reinterpret_cast<IDirect3DTexture9*>(aImage.get_SurfaceDescriptorD3D9().texture());
|
||||
|
||||
if (!texture) {
|
||||
mSize.width = 0;
|
||||
mSize.height = 0;
|
||||
mTextures[0] = nullptr;
|
||||
mIsTiled = false;
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
D3DSURFACE_DESC desc;
|
||||
texture->GetLevelDesc(0, &desc);
|
||||
HRESULT hr = texture->GetLevelDesc(0, &desc);
|
||||
if (FAILED(hr)) {
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
mSize.width = desc.Width;
|
||||
mSize.height = desc.Height;
|
||||
|
||||
@ -465,8 +477,7 @@ DeprecatedTextureHostSystemMemD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
texture, mSize, format);
|
||||
if (!mTextures[0]) {
|
||||
NS_WARNING("Could not upload texture");
|
||||
mSize.width = 0;
|
||||
mSize.height = 0;
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -494,9 +505,7 @@ DeprecatedTextureHostSystemMemD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
texture->UnlockRect(0);
|
||||
if (!mTileTextures[i]) {
|
||||
NS_WARNING("Could not upload texture");
|
||||
mSize.width = 0;
|
||||
mSize.height = 0;
|
||||
mIsTiled = false;
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -581,8 +590,7 @@ DeprecatedTextureHostDIB::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
surf, mSize, format);
|
||||
if (!mTextures[0]) {
|
||||
NS_WARNING("Could not upload texture");
|
||||
mSize.width = 0;
|
||||
mSize.height = 0;
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
mIsTiled = false;
|
||||
@ -607,8 +615,7 @@ DeprecatedTextureHostDIB::UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
bpp);
|
||||
if (!mTileTextures[i]) {
|
||||
NS_WARNING("Could not upload texture");
|
||||
mSize = IntSize();
|
||||
mIsTiled = false;
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -199,6 +199,7 @@ public:
|
||||
|
||||
protected:
|
||||
gfx::IntRect GetTileRect(uint32_t aID) const;
|
||||
void Reset();
|
||||
|
||||
RefPtr<CompositorD3D9> mCompositor;
|
||||
bool mIsTiled;
|
||||
|
Loading…
Reference in New Issue
Block a user