OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkPath.h" | 8 #include "SkPath.h" |
9 #include "SkRegion.h" | 9 #include "SkRegion.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 ScaledTiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { | 192 ScaledTiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { |
193 fName.printf("scaled_tilemode_%s", name); | 193 fName.printf("scaled_tilemode_%s", name); |
194 } | 194 } |
195 | 195 |
196 protected: | 196 protected: |
197 | 197 |
198 SkString onShortName() override { | 198 SkString onShortName() override { |
199 return fName; | 199 return fName; |
200 } | 200 } |
201 | 201 |
202 SkISize onISize() override { return SkISize::Make(880, 560); } | 202 SkISize onISize() override { return SkISize::Make(650, 610); } |
203 | 203 |
204 void onDraw(SkCanvas* canvas) override { | 204 void onDraw(SkCanvas* canvas) override { |
205 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); | 205 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); |
206 | 206 |
207 const SkScalar w = SkIntToScalar(gWidth); | 207 const SkScalar w = SkIntToScalar(gWidth); |
208 const SkScalar h = SkIntToScalar(gHeight); | 208 const SkScalar h = SkIntToScalar(gHeight); |
209 SkRect r = { -w, -h, w*2, h*2 }; | 209 SkRect r = { -w, -h, w*2, h*2 }; |
210 | 210 |
211 static const SkShader::TileMode gModes[] = { | 211 static const SkShader::TileMode gModes[] = { |
212 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi
rror_TileMode | 212 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi
rror_TileMode |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 private: | 257 private: |
258 typedef skiagm::GM INHERITED; | 258 typedef skiagm::GM INHERITED; |
259 }; | 259 }; |
260 | 260 |
261 ////////////////////////////////////////////////////////////////////////////// | 261 ////////////////////////////////////////////////////////////////////////////// |
262 | 262 |
263 DEF_GM( return new ScaledTilingGM(true); ) | 263 DEF_GM( return new ScaledTilingGM(true); ) |
264 DEF_GM( return new ScaledTilingGM(false); ) | 264 DEF_GM( return new ScaledTilingGM(false); ) |
265 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) | 265 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) |
266 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) | 266 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) |
OLD | NEW |