diff options
author | Mike Reed <reed@google.com> | 2009-04-29 10:47:10 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2009-04-29 11:30:19 -0400 |
commit | 8535e17115184dbb5e448b6364b88eb52df34482 (patch) | |
tree | e282875c82ad48dd67a46b0d4efbdcfebcc56ce2 /WebCore/platform/graphics/skia | |
parent | 6a813290b2f6bb173cda985d26b231d3c539696d (diff) | |
download | external_webkit-8535e17115184dbb5e448b6364b88eb52df34482.zip external_webkit-8535e17115184dbb5e448b6364b88eb52df34482.tar.gz external_webkit-8535e17115184dbb5e448b6364b88eb52df34482.tar.bz2 |
share xfermode and color routines with chrome port
Besides sharing those routines in SkiaUtils.cpp, also remove our (now redundant)
android_setrect, etc. calls, since the type-conversion extras we added earlier
take care of this by using constructors.
Diffstat (limited to 'WebCore/platform/graphics/skia')
-rw-r--r-- | WebCore/platform/graphics/skia/SkiaUtils.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/WebCore/platform/graphics/skia/SkiaUtils.cpp b/WebCore/platform/graphics/skia/SkiaUtils.cpp index af168a2..55cba37 100644 --- a/WebCore/platform/graphics/skia/SkiaUtils.cpp +++ b/WebCore/platform/graphics/skia/SkiaUtils.cpp @@ -38,6 +38,7 @@ #include "SkColorPriv.h" #include "SkMatrix.h" #include "SkRegion.h" +#include "SkUnPreMultiply.h" namespace WebCore { @@ -74,29 +75,12 @@ SkPorterDuff::Mode WebCoreCompositeToSkiaComposite(CompositeOperator op) return SkPorterDuff::kSrcOver_Mode; // fall-back } -static U8CPU InvScaleByte(U8CPU component, uint32_t scale) -{ - SkASSERT(component == (uint8_t)component); - return (component * scale + 0x8000) >> 16; -} - -SkColor SkPMColorToColor(SkPMColor pm) -{ - if (0 == pm) - return 0; - - unsigned a = SkGetPackedA32(pm); - uint32_t scale = (255 << 16) / a; - - return SkColorSetARGB(a, - InvScaleByte(SkGetPackedR32(pm), scale), - InvScaleByte(SkGetPackedG32(pm), scale), - InvScaleByte(SkGetPackedB32(pm), scale)); -} - Color SkPMColorToWebCoreColor(SkPMColor pm) { - return SkPMColorToColor(pm); + SkColor c = SkUnPreMultiply::PMColorToColor(pm); + // need the cast to find the right constructor + return WebCore::Color((int)SkColorGetR(c), (int)SkColorGetG(c), + (int)SkColorGetB(c), (int)SkColorGetA(c)); } void IntersectRectAndRegion(const SkRegion& region, const SkRect& srcRect, SkRect* destRect) { |