Changeset 73890 in webkit
- Timestamp:
- Dec 13, 2010 1:11:59 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r73889 r73890 1 2010-12-13 Noel Gordon <noel.gordon@gmail.com> 2 3 Reviewed by Eric Seidel. 4 5 [chromium] Reduce canvas.toDataURL("image/jpeg") run-time cost by 10% 6 https://bugs.webkit.org/show_bug.cgi?id=50804 7 8 Follow on from r73173, unroll the SkUnPreMultiply::PMColorToColor() call 9 viz., compute the unpremultiplatcion in-place. This reduces the run-time 10 cost of jpeg encoding by 10-15% for my image test set. 11 12 No new tests: canvas.toDataURL() is covered by existing tests. 13 14 * platform/image-encoders/skia/JPEGImageEncoder.cpp: 15 (WebCore::preMultipliedBGRAtoRGB): 16 1 17 2010-12-13 Helder Correia <helder@sencha.com> 2 18 -
trunk/WebCore/platform/image-encoders/skia/JPEGImageEncoder.cpp
r73173 r73890 35 35 #include "SkBitmap.h" 36 36 #include "SkUnPreMultiply.h" 37 #include "SkColorPriv.h" 37 38 extern "C" { 38 39 #include <stdio.h> // jpeglib.h needs stdio.h FILE … … 83 84 void preMultipliedBGRAtoRGB(const SkPMColor* input, unsigned int pixels, unsigned char* output) 84 85 { 85 while (pixels-- > 0) { 86 SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(*input++); 87 *output++ = SkColorGetR(unmultiplied); 88 *output++ = SkColorGetG(unmultiplied); 89 *output++ = SkColorGetB(unmultiplied); 86 static const SkUnPreMultiply::Scale* scale = SkUnPreMultiply::GetScaleTable(); 87 88 for (; pixels-- > 0; ++input) { 89 const unsigned alpha = SkGetPackedA32(*input); 90 if ((alpha != 0) && (alpha != 255)) { 91 *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedR32(*input)); 92 *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedG32(*input)); 93 *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedB32(*input)); 94 } else { 95 *output++ = SkGetPackedR32(*input); 96 *output++ = SkGetPackedG32(*input); 97 *output++ = SkGetPackedB32(*input); 98 } 90 99 } 91 100 }
Note: See TracChangeset
for help on using the changeset viewer.