mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 670442: Reset mZero flag on the CanvasRenderingContext when new dimensions are set. r=joe
This commit is contained in:
parent
275db5cd96
commit
6806ca5d95
@ -1068,6 +1068,8 @@ nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
|
||||
mZero = PR_TRUE;
|
||||
height = 1;
|
||||
width = 1;
|
||||
} else {
|
||||
mZero = PR_FALSE;
|
||||
}
|
||||
|
||||
gfxASurface::gfxImageFormat format = GetImageFormat();
|
||||
|
@ -1226,6 +1226,8 @@ nsCanvasRenderingContext2DAzure::SetDimensions(PRInt32 width, PRInt32 height)
|
||||
mZero = PR_TRUE;
|
||||
height = 1;
|
||||
width = 1;
|
||||
} else {
|
||||
mZero = PR_FALSE;
|
||||
}
|
||||
|
||||
// Check that the dimensions are sane
|
||||
|
@ -21392,6 +21392,27 @@ function test_zero_dimensions_imagedata() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>Canvas test: getImageData_after_zero_canvas</p>
|
||||
<canvas id="c686" width="100" height="100"></canvas>
|
||||
<script type="text/javascript">
|
||||
function test_getImageData_after_zero_canvas() {
|
||||
var c = document.getElementById("c686");
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = "rgba(0, 0, 0, 1.0)";
|
||||
ctx.fillRect(0, 0, c.width, c.height);
|
||||
var oldimgdata = ctx.getImageData(0, 0, c.width, c.height);
|
||||
c.width = c.height = 0;
|
||||
c.width = c.height = 100;
|
||||
ctx.fillRect(0, 0, c.width, c.height);
|
||||
var imgdata = ctx.getImageData(0, 0, c.width, c.height);
|
||||
var same = false;
|
||||
ok(imgdata.data.length === oldimgdata.data.length, "not the same length");
|
||||
for (var i = 0; i < imgdata.data.length; ++i)
|
||||
same = imgdata.data[i] === oldimgdata.data[i];
|
||||
ok(same, "changing dimensions broke canvas");
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function asyncTestsDone() {
|
||||
@ -24661,6 +24682,12 @@ function runTests() {
|
||||
} catch(e) {
|
||||
ok(false, "unexpected exception thrown in: test_zero_dimensions_imagedata");
|
||||
}
|
||||
try {
|
||||
test_getImageData_after_zero_canvas();
|
||||
} catch(e) {
|
||||
throw e;
|
||||
ok(false, "unexpected exception thrown in: test_getImageData_after_zero_canvas");
|
||||
}
|
||||
try {
|
||||
// run this test last since it replaces the getContext method
|
||||
test_type_replace();
|
||||
|
Loading…
Reference in New Issue
Block a user