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

Unified Diff: Source/platform/image-decoders/ImageFrame.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: Refresh trys. Created 6 years, 6 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/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/platform/image-decoders/ImageFrame.h
diff --git a/Source/platform/image-decoders/ImageFrame.h b/Source/platform/image-decoders/ImageFrame.h
index bb665a9140c1f5e3d180b55379e4106f36f9acbb..9ae4c8fa4e0db369f74b5efc0072ce42f5137175 100644
--- a/Source/platform/image-decoders/ImageFrame.h
+++ b/Source/platform/image-decoders/ImageFrame.h
@@ -162,11 +162,19 @@ public:
setRGBA(getAddr(x, y), r, g, b, a);
}
+ inline void setRGBA(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
+ {
+ if (m_premultiplyAlpha)
+ setRGBAPremultiply(dest, r, g, b, a);
+ else
+ *dest = SkPackARGB32NoCheck(a, r, g, b);
+ }
+
static const unsigned div255 = static_cast<unsigned>(1.0 / 255 * (1 << 24)) + 1;
- inline void setRGBA(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
+ static inline void setRGBAPremultiply(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
{
- if (m_premultiplyAlpha && a < 255) {
+ if (a < 255) {
if (!a) {
*dest = 0;
return;
@@ -183,7 +191,7 @@ public:
*dest = SkPackARGB32NoCheck(a, r, g, b);
}
- inline void setRGBARaw(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
+ static 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/platform/image-decoders/png/PNGImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698