mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1305312 - write putImageData pixels as opaque for opaque canvas. r=jrmuizel
MozReview-Commit-ID: 5mVzeNwY28u
This commit is contained in:
parent
7052015439
commit
632d270fe0
@ -5768,6 +5768,8 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
|
||||
//uint8_t *src = aArray->Data();
|
||||
uint8_t *dst = imgsurf->Data();
|
||||
uint8_t* srcLine = aArray->Data() + copyY * (aW * 4) + copyX * 4;
|
||||
// For opaque canvases, we must still premultiply the RGB components, but write the alpha as opaque.
|
||||
uint8_t alphaMask = mOpaque ? 255 : 0;
|
||||
#if 0
|
||||
printf("PutImageData_explicit: dirty x=%d y=%d w=%d h=%d copy x=%d y=%d w=%d h=%d ext x=%d y=%d w=%d h=%d\n",
|
||||
dirtyRect.x, dirtyRect.y, copyWidth, copyHeight,
|
||||
@ -5787,9 +5789,9 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t aX, int32_t aY, uint32_t
|
||||
*dst++ = gfxUtils::sPremultiplyTable[a * 256 + b];
|
||||
*dst++ = gfxUtils::sPremultiplyTable[a * 256 + g];
|
||||
*dst++ = gfxUtils::sPremultiplyTable[a * 256 + r];
|
||||
*dst++ = a;
|
||||
*dst++ = a | alphaMask;
|
||||
#else
|
||||
*dst++ = a;
|
||||
*dst++ = a | alphaMask;
|
||||
*dst++ = gfxUtils::sPremultiplyTable[a * 256 + r];
|
||||
*dst++ = gfxUtils::sPremultiplyTable[a * 256 + g];
|
||||
*dst++ = gfxUtils::sPremultiplyTable[a * 256 + b];
|
||||
|
5
dom/canvas/crashtests/1305312-1.html
Normal file
5
dom/canvas/crashtests/1305312-1.html
Normal file
@ -0,0 +1,5 @@
|
||||
<canvas id='cid'></canvas>
|
||||
<script>
|
||||
var x=document.getElementById('cid').getContext('2d',{alpha: false});
|
||||
x.putImageData(x.createImageData(250,27434.63),Number.MAX_SAFE_INTEGER,23);
|
||||
</script>
|
@ -37,4 +37,5 @@ load 1290628-1.html
|
||||
load 1283113-1.html
|
||||
load 1286458-1.html
|
||||
load 1299062-1.html
|
||||
load 1305312-1.html
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user