mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Fix the UNSIGNED_SHORT_4_4_4_4 case of premultiply_pixels
This commit is contained in:
parent
d8b7394fa3
commit
6d3609dbe8
2 changed files with 9 additions and 16 deletions
|
@ -653,17 +653,17 @@ impl WebGLRenderingContext {
|
||||||
(TexFormat::RGBA, TexDataType::UnsignedShort4444) => {
|
(TexFormat::RGBA, TexDataType::UnsignedShort4444) => {
|
||||||
for rgba in pixels.chunks_mut(2) {
|
for rgba in pixels.chunks_mut(2) {
|
||||||
let pix = NativeEndian::read_u16(rgba);
|
let pix = NativeEndian::read_u16(rgba);
|
||||||
let extend_to_8_bits = |val| { (val | val << 4) as u8 };
|
let extend_to_8_bits = |val| (val | val << 4) as u8;
|
||||||
let r = extend_to_8_bits(pix & 0x000f);
|
let r = extend_to_8_bits(pix >> 12 & 0x0f);
|
||||||
let g = extend_to_8_bits((pix & 0x00f0) >> 4);
|
let g = extend_to_8_bits(pix >> 8 & 0x0f);
|
||||||
let b = extend_to_8_bits((pix & 0x0f00) >> 8);
|
let b = extend_to_8_bits(pix >> 4 & 0x0f);
|
||||||
let a = extend_to_8_bits((pix & 0xf000) >> 12);
|
let a = extend_to_8_bits(pix & 0x0f);
|
||||||
NativeEndian::write_u16(
|
NativeEndian::write_u16(
|
||||||
rgba,
|
rgba,
|
||||||
(multiply_u8_pixel(r, a) & 0xf0) as u16 >> 4 |
|
((multiply_u8_pixel(r, a) & 0xf0) as u16) << 8 |
|
||||||
(multiply_u8_pixel(g, a) & 0xf0) as u16 |
|
((multiply_u8_pixel(g, a) & 0xf0) as u16) << 4 |
|
||||||
((multiply_u8_pixel(b, a) & 0xf0) as u16) << 4 |
|
((multiply_u8_pixel(b, a) & 0xf0) as u16) |
|
||||||
pix & 0xf000,
|
((a & 0x0f) as u16),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
[tex-image-with-format-and-type.html]
|
|
||||||
[WebGL test #65: UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_SHORT_4_4_4_4]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[WebGL test #69: UNPACK_PREMULTIPLY_ALPHA_WEBGL with RGBA/UNSIGNED_SHORT_4_4_4_4]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue