mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 924573 - Deal with canvas 0 width and height more consistently. r=bas
This commit is contained in:
parent
84e762a2dc
commit
9635910d8f
@ -928,16 +928,18 @@ CanvasRenderingContext2D::SetDimensions(int32_t width, int32_t height)
|
||||
{
|
||||
ClearTarget();
|
||||
|
||||
// Zero sized surfaces cause issues, so just go with 1x1.
|
||||
if (height == 0 || width == 0) {
|
||||
// Zero sized surfaces can cause problems.
|
||||
mZero = false;
|
||||
if (height == 0) {
|
||||
height = 1;
|
||||
mZero = true;
|
||||
mWidth = 1;
|
||||
mHeight = 1;
|
||||
} else {
|
||||
mZero = false;
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
}
|
||||
if (width == 0) {
|
||||
width = 1;
|
||||
mZero = true;
|
||||
}
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -381,8 +381,10 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
|
||||
return NS_OK;
|
||||
|
||||
// Zero-sized surfaces can cause problems.
|
||||
if (width == 0 || height == 0) {
|
||||
if (width == 0) {
|
||||
width = 1;
|
||||
}
|
||||
if (height == 0) {
|
||||
height = 1;
|
||||
}
|
||||
|
||||
|
@ -597,9 +597,14 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mCurrentContext) {
|
||||
// We disallow canvases of width or height zero, and set them to 1, so
|
||||
// we will have a discrepancy with the sizes of the canvas and the context.
|
||||
// That discrepancy is OK, the rest are not.
|
||||
nsIntSize elementSize = GetWidthHeight();
|
||||
MOZ_ASSERT(elementSize.width == mCurrentContext->GetWidth());
|
||||
MOZ_ASSERT(elementSize.height == mCurrentContext->GetHeight());
|
||||
MOZ_ASSERT(elementSize.width == mCurrentContext->GetWidth() ||
|
||||
(elementSize.width == 0 && mCurrentContext->GetWidth() == 1));
|
||||
MOZ_ASSERT(elementSize.height == mCurrentContext->GetHeight() ||
|
||||
(elementSize.height == 0 && mCurrentContext->GetHeight() == 1));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user