aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-12 20:42:21 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-12 20:42:21 +0000
commit5970f625e96cdc007c563ae72f343ae0d71719a1 (patch)
treed8768c59927628cabd07ab50f9a3b8e6e6779b84 /samplecode
parent68a3815401f461976f76891d0477cb1440fa0aba (diff)
re-land hide get/setLocalMatrix
This reverts commit b1d702a43b07934f5b001b1b09db2c57ede909a1. TBR=scroggo@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/279903002 git-svn-id: http://skia.googlecode.com/svn/trunk@14702 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleFatBits.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index 9ea1d9e479..6057c68fde 100644
--- a/samplecode/SampleFatBits.cpp
+++ b/samplecode/SampleFatBits.cpp
@@ -35,7 +35,7 @@ static void erase(SkSurface* surface) {
surface->getCanvas()->clear(SK_ColorTRANSPARENT);
}
-static SkShader* createChecker() {
+static SkShader* createChecker(const SkMatrix& localMatrix) {
// SkColor colors[] = { 0xFFFDFDFD, 0xFFF4F4F4 };
SkColor colors[] = { 0xFFFFFFFF, 0xFFFFFFFF };
SkBitmap bm;
@@ -43,15 +43,13 @@ static SkShader* createChecker() {
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, &m);
+ SkShader::kRepeat_TileMode, &localMatrix);
}
class FatBits {
public:
- FatBits() : fShader(createChecker()) {
+ FatBits() {
fAA = false;
fStyle = kHair_Style;
fGrid = true;
@@ -100,7 +98,7 @@ public:
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->setLocalMatrix(fMatrix);
+ fShader.reset(createChecker(fMatrix));
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
fMinSurface.reset(SkSurface::NewRaster(info));