use premul macro to pack components
authormike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Sun, 12 Aug 2012 18:50:34 +0000 (18:50 +0000)
committermike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Sun, 12 Aug 2012 18:50:34 +0000 (18:50 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@5043 2bbb7eff-a529-9590-31e7-b0007b416f81

src/effects/SkArithmeticMode.cpp

index c999ce0..cd3c31d 100644 (file)
@@ -107,14 +107,7 @@ void SkArithmeticMode_scalar::xfer32(SkPMColor dst[], const SkPMColor src[],
                 b = blend(b, SkGetPackedB32(sc), scale);
             }
 
-            // turn the result back into premul
-            if (0xFF != a) {
-                int scale = a + (a >> 7);
-                r = SkAlphaMul(r, scale);
-                g = SkAlphaMul(g, scale);
-                b = SkAlphaMul(b, scale);
-            }
-            dst[i] = SkPackARGB32(a, r, g, b);
+            dst[i] = SkPremultiplyARGBInline(a, r, g, b);
         }
     }
 }