Index: samplecode/SampleFatBits.cpp |
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp |
index 6057c68fde561dd0bde1140a32e1b28496a5672f..9ea1d9e47999658fea77fd374453c4067bd73f70 100644 |
--- a/samplecode/SampleFatBits.cpp |
+++ b/samplecode/SampleFatBits.cpp |
@@ -35,7 +35,7 @@ |
surface->getCanvas()->clear(SK_ColorTRANSPARENT); |
} |
-static SkShader* createChecker(const SkMatrix& localMatrix) { |
+static SkShader* createChecker() { |
// SkColor colors[] = { 0xFFFDFDFD, 0xFFF4F4F4 }; |
SkColor colors[] = { 0xFFFFFFFF, 0xFFFFFFFF }; |
SkBitmap bm; |
@@ -43,13 +43,15 @@ |
bm.lockPixels(); |
*bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = SkPreMultiplyColor(colors[0]); |
*bm.getAddr32(0, 1) = *bm.getAddr32(1, 0) = SkPreMultiplyColor(colors[1]); |
+ SkMatrix m; |
+ m.setScale(12, 12); |
return SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, |
- SkShader::kRepeat_TileMode, &localMatrix); |
+ SkShader::kRepeat_TileMode, &m); |
} |
class FatBits { |
public: |
- FatBits() { |
+ FatBits() : fShader(createChecker()) { |
fAA = false; |
fStyle = kHair_Style; |
fGrid = true; |
@@ -98,7 +100,7 @@ |
fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zoom)); |
fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); |
fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); |
- fShader.reset(createChecker(fMatrix)); |
+ fShader->setLocalMatrix(fMatrix); |
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
fMinSurface.reset(SkSurface::NewRaster(info)); |