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

Side by Side Diff: gm/perlinnoise.cpp

Issue 279903002: reland hide get/setLocalMatrix (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remember global initialization of flattenables 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkShader.h » ('j') | src/core/SkShader.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkPerlinNoiseShader.h" 9 #include "SkPerlinNoiseShader.h"
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 canvas->drawRect(r, paint); 138 canvas->drawRect(r, paint);
139 canvas->restore(); 139 canvas->restore();
140 140
141 // The next row should draw the same as the previous, even though we are using a local 141 // The next row should draw the same as the previous, even though we are using a local
142 // matrix instead of the canvas. 142 // matrix instead of the canvas.
143 143
144 canvas->translate(0, h * 2 + 10); 144 canvas->translate(0, h * 2 + 10);
145 145
146 SkMatrix lm; 146 SkMatrix lm;
147 lm.setScale(2, 2); 147 lm.setScale(2, 2);
148 paint.getShader()->setLocalMatrix(lm); 148 paint.setShader(SkShader::CreateLocalMatrixShader(paint.getShader(), lm) )->unref();
149 r.fRight += r.width(); 149 r.fRight += r.width();
150 r.fBottom += r.height(); 150 r.fBottom += r.height();
151 151
152 canvas->save(); 152 canvas->save();
153 canvas->translate(0, h + 10); 153 canvas->translate(0, h + 10);
154 canvas->drawRect(r, paint); 154 canvas->drawRect(r, paint);
155 canvas->restore(); 155 canvas->restore();
156 156
157 canvas->save(); 157 canvas->save();
158 canvas->translate(w + 100, h + 10); 158 canvas->translate(w + 100, h + 10);
159 canvas->drawRect(r, paint); 159 canvas->drawRect(r, paint);
160 canvas->restore(); 160 canvas->restore();
161 } 161 }
162 162
163 private: 163 private:
164 typedef GM INHERITED; 164 typedef GM INHERITED;
165 SkISize fSize; 165 SkISize fSize;
166 }; 166 };
167 167
168 ////////////////////////////////////////////////////////////////////////////// 168 //////////////////////////////////////////////////////////////////////////////
169 169
170 DEF_GM( return new PerlinNoiseGM; ) 170 DEF_GM( return new PerlinNoiseGM; )
171 DEF_GM( return new PerlinNoiseGM2; ) 171 DEF_GM( return new PerlinNoiseGM2; )
OLDNEW
« no previous file with comments | « no previous file | include/core/SkShader.h » ('j') | src/core/SkShader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698