| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; ) |
| OLD | NEW |