OLD | NEW |
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 canvas->drawRect(r, paint); | 147 canvas->drawRect(r, paint); |
148 canvas->restore(); | 148 canvas->restore(); |
149 | 149 |
150 // The next row should draw the same as the previous, even though we are
using a local | 150 // The next row should draw the same as the previous, even though we are
using a local |
151 // matrix instead of the canvas. | 151 // matrix instead of the canvas. |
152 | 152 |
153 canvas->translate(0, h * 2 + 10); | 153 canvas->translate(0, h * 2 + 10); |
154 | 154 |
155 SkMatrix lm; | 155 SkMatrix lm; |
156 lm.setScale(2, 2); | 156 lm.setScale(2, 2); |
157 paint.setShader(SkShader::CreateLocalMatrixShader(paint.getShader(), lm)
)->unref(); | 157 paint.setShader(paint.getShader()->newWithLocalMatrix(lm))->unref(); |
158 r.fRight += r.width(); | 158 r.fRight += r.width(); |
159 r.fBottom += r.height(); | 159 r.fBottom += r.height(); |
160 | 160 |
161 canvas->save(); | 161 canvas->save(); |
162 canvas->translate(0, h + 10); | 162 canvas->translate(0, h + 10); |
163 canvas->drawRect(r, paint); | 163 canvas->drawRect(r, paint); |
164 canvas->restore(); | 164 canvas->restore(); |
165 | 165 |
166 canvas->save(); | 166 canvas->save(); |
167 canvas->translate(w + 100, h + 10); | 167 canvas->translate(w + 100, h + 10); |
168 canvas->drawRect(r, paint); | 168 canvas->drawRect(r, paint); |
169 canvas->restore(); | 169 canvas->restore(); |
170 } | 170 } |
171 | 171 |
172 private: | 172 private: |
173 typedef GM INHERITED; | 173 typedef GM INHERITED; |
174 SkISize fSize; | 174 SkISize fSize; |
175 }; | 175 }; |
176 | 176 |
177 ////////////////////////////////////////////////////////////////////////////// | 177 ////////////////////////////////////////////////////////////////////////////// |
178 | 178 |
179 DEF_GM( return new PerlinNoiseGM; ) | 179 DEF_GM( return new PerlinNoiseGM; ) |
180 DEF_GM( return new PerlinNoiseGM2; ) | 180 DEF_GM( return new PerlinNoiseGM2; ) |
OLD | NEW |