зеркало из https://github.com/mozilla/gecko-dev.git
Bug 479022 fast path of nsCanvasRenderingContext2D::PutImage() is wrong on BIG ENDIAN machine r=vladmir
This commit is contained in:
Родитель
b6c2a8283b
Коммит
22b269f2d5
|
@ -3819,18 +3819,20 @@ nsCanvasRenderingContext2D::PutImageData()
|
||||||
PRUint8 ir, ig, ib, ia;
|
PRUint8 ir, ig, ib, ia;
|
||||||
PRUint8 *ptr = imgPtr;
|
PRUint8 *ptr = imgPtr;
|
||||||
for (int32 i = 0; i < w*h; i++) {
|
for (int32 i = 0; i < w*h; i++) {
|
||||||
#ifdef IS_LITTLE_ENDIAN
|
|
||||||
ir = ptr[0];
|
ir = ptr[0];
|
||||||
ig = ptr[1];
|
ig = ptr[1];
|
||||||
ib = ptr[2];
|
ib = ptr[2];
|
||||||
ia = ptr[3];
|
ia = ptr[3];
|
||||||
|
|
||||||
|
#ifdef IS_LITTLE_ENDIAN
|
||||||
ptr[0] = (ib*ia + 254) / 255;
|
ptr[0] = (ib*ia + 254) / 255;
|
||||||
ptr[1] = (ig*ia + 254) / 255;
|
ptr[1] = (ig*ia + 254) / 255;
|
||||||
ptr[2] = (ir*ia + 254) / 255;
|
ptr[2] = (ir*ia + 254) / 255;
|
||||||
#else
|
#else
|
||||||
ptr[0] = (ptr[0]*ptr[3] + 254) / 255;
|
ptr[0] = ia;
|
||||||
ptr[1] = (ptr[1]*ptr[3] + 254) / 255;
|
ptr[1] = (ir*ia + 254) / 255;
|
||||||
ptr[2] = (ptr[2]*ptr[3] + 254) / 255;
|
ptr[2] = (ig*ia + 254) / 255;
|
||||||
|
ptr[3] = (ib*ia + 254) / 255;
|
||||||
#endif
|
#endif
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче