Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Unified Diff: samplecode/SampleFatBits.cpp

Issue 279563002: hide get/setLocalMatrix (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkShader.h ('k') | src/core/SkPictureShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleFatBits.cpp
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index 9ea1d9e47999658fea77fd374453c4067bd73f70..6057c68fde561dd0bde1140a32e1b28496a5672f 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));
« no previous file with comments | « include/core/SkShader.h ('k') | src/core/SkPictureShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698