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 29 matching lines...) Expand all Loading... |
40 paint.setDither(true); | 40 paint.setDither(true); |
41 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, | 41 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, |
42 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode, um))->unref()
; | 42 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode, um))->unref()
; |
43 canvas.drawPaint(paint); | 43 canvas.drawPaint(paint); |
44 } | 44 } |
45 | 45 |
46 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, | 46 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, |
47 SkShader::TileMode tmx, SkShader::TileMode tmy) { | 47 SkShader::TileMode tmx, SkShader::TileMode tmy) { |
48 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); | 48 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); |
49 paint->setShader(shader)->unref(); | 49 paint->setShader(shader)->unref(); |
50 paint->setFilterBitmap(filter); | 50 paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_Fi
lterLevel); |
51 } | 51 } |
52 | 52 |
53 static const SkBitmap::Config gConfigs[] = { | 53 static const SkBitmap::Config gConfigs[] = { |
54 SkBitmap::kARGB_8888_Config, | 54 SkBitmap::kARGB_8888_Config, |
55 SkBitmap::kRGB_565_Config, | 55 SkBitmap::kRGB_565_Config, |
56 }; | 56 }; |
57 | 57 |
58 class TilingGM : public skiagm::GM { | 58 class TilingGM : public skiagm::GM { |
59 public: | 59 public: |
60 TilingGM(bool powerOfTwoSize) | 60 TilingGM(bool powerOfTwoSize) |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 private: | 262 private: |
263 typedef skiagm::GM INHERITED; | 263 typedef skiagm::GM INHERITED; |
264 }; | 264 }; |
265 | 265 |
266 ////////////////////////////////////////////////////////////////////////////// | 266 ////////////////////////////////////////////////////////////////////////////// |
267 | 267 |
268 DEF_GM( return new TilingGM(true); ) | 268 DEF_GM( return new TilingGM(true); ) |
269 DEF_GM( return new TilingGM(false); ) | 269 DEF_GM( return new TilingGM(false); ) |
270 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) | 270 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) |
271 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) | 271 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) |
OLD | NEW |