OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRegion.h" | 10 #include "SkRegion.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 paint.setDither(true); | 31 paint.setDither(true); |
32 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, | 32 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, |
33 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode))->unref(); | 33 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode))->unref(); |
34 canvas.drawPaint(paint); | 34 canvas.drawPaint(paint); |
35 } | 35 } |
36 | 36 |
37 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, | 37 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, |
38 SkShader::TileMode tmx, SkShader::TileMode tmy) { | 38 SkShader::TileMode tmx, SkShader::TileMode tmy) { |
39 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); | 39 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); |
40 paint->setShader(shader)->unref(); | 40 paint->setShader(shader)->unref(); |
41 paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_Fi
lterLevel); | 41 paint->setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQualit
y); |
42 } | 42 } |
43 | 43 |
44 static const SkColorType gColorTypes[] = { | 44 static const SkColorType gColorTypes[] = { |
45 kN32_SkColorType, | 45 kN32_SkColorType, |
46 kRGB_565_SkColorType, | 46 kRGB_565_SkColorType, |
47 }; | 47 }; |
48 | 48 |
49 class TilingGM : public skiagm::GM { | 49 class TilingGM : public skiagm::GM { |
50 public: | 50 public: |
51 TilingGM(bool powerOfTwoSize) | 51 TilingGM(bool powerOfTwoSize) |
(...skipping 205 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 TilingGM(true); ) | 263 DEF_GM( return new TilingGM(true); ) |
264 DEF_GM( return new TilingGM(false); ) | 264 DEF_GM( return new TilingGM(false); ) |
265 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) | 265 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) |
266 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) | 266 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) |
OLD | NEW |