diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-12-17 19:55:24 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-12-17 19:55:24 +0000 |
commit | 30da745bbf67a0ee0f305ca7bbdb685cc8a9e686 (patch) | |
tree | 9b040462c5d1a2f00b09a1db762b7c8a2dac93c5 /src/effects | |
parent | 82ec0b00f380906c1cdeb4b4cc4a355264ab3882 (diff) |
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
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkArithmeticMode.cpp | 4 | ||||
-rw-r--r-- | src/effects/SkAvoidXfermode.cpp | 39 |
2 files changed, 15 insertions, 28 deletions
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp index c999ce08c9..54a28ce3da 100644 --- a/src/effects/SkArithmeticMode.cpp +++ b/src/effects/SkArithmeticMode.cpp @@ -12,7 +12,7 @@ public: } virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, - const SkAlpha aa[]) SK_OVERRIDE; + const SkAlpha aa[]) const SK_OVERRIDE; SK_DECLARE_UNFLATTENABLE_OBJECT() @@ -48,7 +48,7 @@ static bool needsUnpremul(int alpha) { } void SkArithmeticMode_scalar::xfer32(SkPMColor dst[], const SkPMColor src[], - int count, const SkAlpha aaCoverage[]) { + int count, const SkAlpha aaCoverage[]) const { SkScalar k1 = fK[0] / 255; SkScalar k2 = fK[1]; SkScalar k3 = fK[2]; diff --git a/src/effects/SkAvoidXfermode.cpp b/src/effects/SkAvoidXfermode.cpp index 89ae1f9c8c..f39ee747d9 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(SkColor opColor, U8CPU tolerance, Mode mode) } 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 @@ void SkAvoidXfermode::flatten(SkFlattenableWriteBuffer& buffer) const } // 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 @@ static unsigned color_dist16(uint16_t c, unsigned r, unsigned g, unsigned b) } // 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 @@ static unsigned color_dist4444(uint16_t c, unsigned r, unsigned g, unsigned b) } // 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 @@ static unsigned color_dist32(SkPMColor c, U8CPU r, U8CPU g, U8CPU b) 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 @@ static inline unsigned Accurate255To256(unsigned x) { } 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 @@ void SkAvoidXfermode::xfer32(SkPMColor dst[], const SkPMColor src[], int count, } } -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 @@ static inline U16CPU SkBlend3216(SkPMColor src, U16CPU dst, unsigned scale) } 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::xfer16(uint16_t dst[], const SkPMColor src[], int count, } 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::xfer4444(uint16_t dst[], const SkPMColor src[], int count, } } -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 } |