Index: Source/core/platform/image-decoders/ImageDecoder.h |
diff --git a/Source/core/platform/image-decoders/ImageDecoder.h b/Source/core/platform/image-decoders/ImageDecoder.h |
index 19587f5c2ea485f879fcd25f23fc8c861c752af5..8952e42da5c6d050787f3a763d822677217ee0bf 100644 |
--- a/Source/core/platform/image-decoders/ImageDecoder.h |
+++ b/Source/core/platform/image-decoders/ImageDecoder.h |
@@ -174,6 +174,23 @@ namespace WebCore { |
*dest = SkPackARGB32NoCheck(a, r, g, b); |
} |
+ inline void setRGBAPremultiply(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a) |
Peter Kasting
2013/07/10 18:24:47
I think we ought to be able to define setRGBA() in
Noel Gordon
2013/07/11 08:23:40
Seems perfectly reasonable ...
|
+ { |
+ if (a < 255) { |
+ if (!a) { |
+ *dest = 0; |
+ return; |
+ } |
+ |
+ unsigned alpha = a * div255; |
+ r = (r * alpha) >> 24; |
+ g = (g * alpha) >> 24; |
+ b = (b * alpha) >> 24; |
+ } |
+ |
+ *dest = SkPackARGB32NoCheck(a, r, g, b); |
+ } |
+ |
inline void setRGBARaw(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a) |
{ |
*dest = SkPackARGB32NoCheck(a, r, g, b); |