Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(739)

Unified Diff: Source/core/platform/image-decoders/ImageDecoder.h

Issue 18099004: Improve PNG decode performance: avoid branching in the row write loop (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/platform/image-decoders/png/PNGImageDecoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | Source/core/platform/image-decoders/png/PNGImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698