am 18cd1078: am 3b9d33b3: Fix RawImage.getARGB to force alpha to 0xFF for buffers with no alpha.

Merge commit '18cd10783b01156169c44f76778590cdf25beaa2'

* commit '18cd10783b01156169c44f76778590cdf25beaa2':
  Fix RawImage.getARGB to force alpha to 0xFF for buffers with no alpha.
This commit is contained in:
Xavier Ducrohet
2009-10-13 21:05:12 -07:00
committed by Android Git Automerger

View File

@@ -186,7 +186,12 @@ public final class RawImage {
int r = ((value >>> red_offset) & getMask(red_length)) << (8 - red_length); int r = ((value >>> red_offset) & getMask(red_length)) << (8 - red_length);
int g = ((value >>> green_offset) & getMask(green_length)) << (8 - green_length); int g = ((value >>> green_offset) & getMask(green_length)) << (8 - green_length);
int b = ((value >>> blue_offset) & getMask(blue_length)) << (8 - blue_length); int b = ((value >>> blue_offset) & getMask(blue_length)) << (8 - blue_length);
int a = ((value >>> alpha_offset) & getMask(alpha_length)) << (8 - alpha_length); int a;
if (alpha_length == 0) {
a = 0xFF; // force alpha to opaque if there's no alpha value in the framebuffer.
} else {
a = ((value >>> alpha_offset) & getMask(alpha_length)) << (8 - alpha_length);
}
return a << 24 | r << 16 | g << 8 | b; return a << 24 | r << 16 | g << 8 | b;
} }