aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-08 14:51:44 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-08 14:51:44 +0000
commit8cad58624bc194390b14a21d0578dfcdd6fbad6f (patch)
treef7607b1f631ca6a830e4d7d910e0be329515aae9
parenta6d59f60aab59fb6556841b063ead5d49b46ba8d (diff)
add const to SkColorShader's asABitmap
git-svn-id: http://skia.googlecode.com/svn/trunk@900 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkColorShader.h12
-rw-r--r--src/core/SkShader.cpp2
2 files changed, 7 insertions, 7 deletions
diff --git a/include/core/SkColorShader.h b/include/core/SkColorShader.h
index 1f833556f9..f7251ff8a4 100644
--- a/include/core/SkColorShader.h
+++ b/include/core/SkColorShader.h
@@ -47,10 +47,10 @@ public:
virtual void shadeSpan16(int x, int y, uint16_t span[], int count);
virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count);
- virtual BitmapType asABitmap(SkBitmap* outTexture,
+ virtual BitmapType asABitmap(SkBitmap* outTexture,
SkMatrix* outMatrix,
- TileMode xy[2],
- SkScalar* twoPointRadialParams);
+ TileMode xy[2],
+ SkScalar* twoPointRadialParams) const;
virtual GradientType asAGradient(GradientInfo* info) const;
@@ -59,8 +59,8 @@ protected:
virtual void flatten(SkFlattenableWriteBuffer& );
virtual Factory getFactory() { return CreateProc; }
private:
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkColorShader, (buffer));
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
+ return SkNEW_ARGS(SkColorShader, (buffer));
}
SkColor fColor; // ignored if fInheritColor is true
SkPMColor fPMColor; // cached after setContext()
@@ -69,7 +69,7 @@ private:
SkBool8 fInheritColor;
// deferred allocation, used for asABitmap()
- SkPixelRef* fAsABitmapPixelRef;
+ mutable SkPixelRef* fAsABitmapPixelRef;
typedef SkShader INHERITED;
};
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 015389ebd1..8e469f2bbd 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -312,7 +312,7 @@ void SkColorShader::shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) {
// if we had a asAColor method, that would be more efficient...
SkShader::BitmapType SkColorShader::asABitmap(SkBitmap* bitmap, SkMatrix* matrix,
TileMode modes[],
- SkScalar* twoPointRadialParams) {
+ SkScalar* twoPointRadialParams) const {
// we cache the pixelref, since its generateID is used in the texture cache
if (NULL == fAsABitmapPixelRef) {
SkPMColor* storage = (SkPMColor*)sk_malloc_throw(sizeof(SkPMColor));