Mark all methods on SkXfermode as const, in preparation for declaring all
xfermodes as immutable/reentrant-safe
Review URL: https://codereview.appspot.com/6941065
git-svn-id: http://skia.googlecode.com/svn/trunk@6855 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkAvoidXfermode.cpp b/src/effects/SkAvoidXfermode.cpp
index 89ae1f9..f39ee74 100644
--- a/src/effects/SkAvoidXfermode.cpp
+++ b/src/effects/SkAvoidXfermode.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,13 +5,11 @@
* found in the LICENSE file.
*/
-
#include "SkAvoidXfermode.h"
#include "SkColorPriv.h"
#include "SkFlattenableBuffers.h"
-SkAvoidXfermode::SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode)
-{
+SkAvoidXfermode::SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode) {
if (tolerance > 255) {
tolerance = 255;
}
@@ -23,15 +20,13 @@
}
SkAvoidXfermode::SkAvoidXfermode(SkFlattenableReadBuffer& buffer)
- : INHERITED(buffer)
-{
+ : INHERITED(buffer) {
fOpColor = buffer.readColor();
fDistMul = buffer.readUInt();
fMode = (Mode)buffer.readUInt();
}
-void SkAvoidXfermode::flatten(SkFlattenableWriteBuffer& buffer) const
-{
+void SkAvoidXfermode::flatten(SkFlattenableWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
buffer.writeColor(fOpColor);
@@ -40,8 +35,7 @@
}
// returns 0..31
-static unsigned color_dist16(uint16_t c, unsigned r, unsigned g, unsigned b)
-{
+static unsigned color_dist16(uint16_t c, unsigned r, unsigned g, unsigned b) {
SkASSERT(r <= SK_R16_MASK);
SkASSERT(g <= SK_G16_MASK);
SkASSERT(b <= SK_B16_MASK);
@@ -54,8 +48,7 @@
}
// returns 0..15
-static unsigned color_dist4444(uint16_t c, unsigned r, unsigned g, unsigned b)
-{
+static unsigned color_dist4444(uint16_t c, unsigned r, unsigned g, unsigned b) {
SkASSERT(r <= 0xF);
SkASSERT(g <= 0xF);
SkASSERT(b <= 0xF);
@@ -68,8 +61,7 @@
}
// returns 0..255
-static unsigned color_dist32(SkPMColor c, U8CPU r, U8CPU g, U8CPU b)
-{
+static unsigned color_dist32(SkPMColor c, U8CPU r, U8CPU g, U8CPU b) {
SkASSERT(r <= 0xFF);
SkASSERT(g <= 0xFF);
SkASSERT(b <= 0xFF);
@@ -81,8 +73,7 @@
return SkMax32(dr, SkMax32(dg, db));
}
-static int scale_dist_14(int dist, uint32_t mul, uint32_t sub)
-{
+static int scale_dist_14(int dist, uint32_t mul, uint32_t sub) {
int tmp = dist * mul - sub;
int result = (tmp + (1 << 13)) >> 14;
@@ -94,8 +85,7 @@
}
void SkAvoidXfermode::xfer32(SkPMColor dst[], const SkPMColor src[], int count,
- const SkAlpha aa[])
-{
+ const SkAlpha aa[]) const {
unsigned opR = SkColorGetR(fOpColor);
unsigned opG = SkColorGetG(fOpColor);
unsigned opB = SkColorGetB(fOpColor);
@@ -134,8 +124,7 @@
}
}
-static inline U16CPU SkBlend3216(SkPMColor src, U16CPU dst, unsigned scale)
-{
+static inline U16CPU SkBlend3216(SkPMColor src, U16CPU dst, unsigned scale) {
SkASSERT(scale <= 32);
scale <<= 3;
@@ -145,8 +134,7 @@
}
void SkAvoidXfermode::xfer16(uint16_t dst[], const SkPMColor src[], int count,
- const SkAlpha aa[])
-{
+ const SkAlpha aa[]) const {
unsigned opR = SkColorGetR(fOpColor) >> (8 - SK_R16_BITS);
unsigned opG = SkColorGetG(fOpColor) >> (8 - SK_G16_BITS);
unsigned opB = SkColorGetB(fOpColor) >> (8 - SK_R16_BITS);
@@ -186,8 +174,7 @@
}
void SkAvoidXfermode::xfer4444(uint16_t dst[], const SkPMColor src[], int count,
- const SkAlpha aa[])
-{
+ const SkAlpha aa[]) const {
unsigned opR = SkColorGetR(fOpColor) >> 4;
unsigned opG = SkColorGetG(fOpColor) >> 4;
unsigned opB = SkColorGetB(fOpColor) >> 4;
@@ -226,7 +213,7 @@
}
}
-void SkAvoidXfermode::xferA8(SkAlpha dst[], const SkPMColor src[], int count, const SkAlpha aa[])
-{
+void SkAvoidXfermode::xferA8(SkAlpha dst[], const SkPMColor src[], int count,
+ const SkAlpha aa[]) const {
// override in subclass
}