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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 /** | 57 /** |
58 * Compare output of drawSprite and drawBitmap (esp. clipping and imagefilters) | 58 * Compare output of drawSprite and drawBitmap (esp. clipping and imagefilters) |
59 */ | 59 */ |
60 class SpriteBitmapGM : public skiagm::GM { | 60 class SpriteBitmapGM : public skiagm::GM { |
61 public: | 61 public: |
62 SpriteBitmapGM() {} | 62 SpriteBitmapGM() {} |
63 | 63 |
64 protected: | 64 protected: |
65 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 65 uint32_t onGetFlags() const SK_OVERRIDE { |
66 return kSkipTiled_Flag; | 66 return kSkipTiled_Flag; |
67 } | 67 } |
68 | 68 |
69 virtual SkString onShortName() SK_OVERRIDE { | 69 SkString onShortName() SK_OVERRIDE { |
70 return SkString("spritebitmap"); | 70 return SkString("spritebitmap"); |
71 } | 71 } |
72 | 72 |
73 virtual SkISize onISize() SK_OVERRIDE { | 73 SkISize onISize() SK_OVERRIDE { |
74 return SkISize::Make(640, 480); | 74 return SkISize::Make(640, 480); |
75 } | 75 } |
76 | 76 |
77 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 77 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
78 SkBitmap bm; | 78 SkBitmap bm; |
79 make_bm(&bm); | 79 make_bm(&bm); |
80 | 80 |
81 int dx = 10; | 81 int dx = 10; |
82 int dy = 10; | 82 int dy = 10; |
83 | 83 |
84 SkScalar sigma = 8; | 84 SkScalar sigma = 8; |
85 SkAutoTUnref<SkImageFilter> filter(SkBlurImageFilter::Create(sigma, sigm
a)); | 85 SkAutoTUnref<SkImageFilter> filter(SkBlurImageFilter::Create(sigma, sigm
a)); |
86 | 86 |
87 draw_2_bitmaps(canvas, bm, false, dx, dy); | 87 draw_2_bitmaps(canvas, bm, false, dx, dy); |
88 dy += bm.height() + 20; | 88 dy += bm.height() + 20; |
89 draw_2_bitmaps(canvas, bm, false, dx, dy, filter); | 89 draw_2_bitmaps(canvas, bm, false, dx, dy, filter); |
90 dy += bm.height() + 20; | 90 dy += bm.height() + 20; |
91 draw_2_bitmaps(canvas, bm, true, dx, dy); | 91 draw_2_bitmaps(canvas, bm, true, dx, dy); |
92 dy += bm.height() + 20; | 92 dy += bm.height() + 20; |
93 draw_2_bitmaps(canvas, bm, true, dx, dy, filter); | 93 draw_2_bitmaps(canvas, bm, true, dx, dy, filter); |
94 } | 94 } |
95 | 95 |
96 private: | 96 private: |
97 typedef GM INHERITED; | 97 typedef GM INHERITED; |
98 }; | 98 }; |
99 | 99 |
100 ////////////////////////////////////////////////////////////////////////////// | 100 ////////////////////////////////////////////////////////////////////////////// |
101 | 101 |
102 DEF_GM( return new SpriteBitmapGM; ) | 102 DEF_GM( return new SpriteBitmapGM; ) |
OLD | NEW |