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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Tiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { | 187 Tiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { |
188 fName.printf("tilemode_%s", name); | 188 fName.printf("tilemode_%s", name); |
189 } | 189 } |
190 | 190 |
191 protected: | 191 protected: |
192 | 192 |
193 SkString onShortName() override { | 193 SkString onShortName() override { |
194 return fName; | 194 return fName; |
195 } | 195 } |
196 | 196 |
197 SkISize onISize() override { return SkISize::Make(880, 560); } | 197 SkISize onISize() override { return SkISize::Make(650, 610); } |
198 | 198 |
199 void onDraw(SkCanvas* canvas) override { | 199 void onDraw(SkCanvas* canvas) override { |
200 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); | 200 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); |
201 | 201 |
202 const SkScalar w = SkIntToScalar(gWidth); | 202 const SkScalar w = SkIntToScalar(gWidth); |
203 const SkScalar h = SkIntToScalar(gHeight); | 203 const SkScalar h = SkIntToScalar(gHeight); |
204 SkRect r = { -w, -h, w*2, h*2 }; | 204 SkRect r = { -w, -h, w*2, h*2 }; |
205 | 205 |
206 static const SkShader::TileMode gModes[] = { | 206 static const SkShader::TileMode gModes[] = { |
207 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi
rror_TileMode | 207 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi
rror_TileMode |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 private: | 252 private: |
253 typedef skiagm::GM INHERITED; | 253 typedef skiagm::GM INHERITED; |
254 }; | 254 }; |
255 | 255 |
256 ////////////////////////////////////////////////////////////////////////////// | 256 ////////////////////////////////////////////////////////////////////////////// |
257 | 257 |
258 DEF_GM( return new TilingGM(true); ) | 258 DEF_GM( return new TilingGM(true); ) |
259 DEF_GM( return new TilingGM(false); ) | 259 DEF_GM( return new TilingGM(false); ) |
260 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) | 260 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) |
261 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) | 261 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) |
OLD | NEW |