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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 &paint); | 154 &paint); |
155 } | 155 } |
156 | 156 |
157 /////////////////////////////////////////////////////////////////////////////// | 157 /////////////////////////////////////////////////////////////////////////////// |
158 | 158 |
159 class ImageFiltersBaseGM : public skiagm::GM { | 159 class ImageFiltersBaseGM : public skiagm::GM { |
160 public: | 160 public: |
161 ImageFiltersBaseGM () {} | 161 ImageFiltersBaseGM () {} |
162 | 162 |
163 protected: | 163 protected: |
164 | |
165 virtual SkString onShortName() { | 164 virtual SkString onShortName() { |
166 return SkString("imagefiltersbase"); | 165 return SkString("imagefiltersbase"); |
167 } | 166 } |
168 | 167 |
169 virtual SkISize onISize() { return SkISize::Make(700, 500); } | 168 virtual SkISize onISize() { return SkISize::Make(700, 500); } |
170 | 169 |
171 void draw_frame(SkCanvas* canvas, const SkRect& r) { | 170 void draw_frame(SkCanvas* canvas, const SkRect& r) { |
172 SkPaint paint; | 171 SkPaint paint; |
173 paint.setStyle(SkPaint::kStroke_Style); | 172 paint.setStyle(SkPaint::kStroke_Style); |
174 paint.setColor(SK_ColorRED); | 173 paint.setColor(SK_ColorRED); |
175 canvas->drawRect(r, paint); | 174 canvas->drawRect(r, paint); |
176 } | 175 } |
177 | 176 |
178 virtual uint32_t onGetFlags() const { | 177 virtual uint32_t onGetFlags() const { |
179 // Because of the use of drawSprite, this test is excluded | 178 // Because of the use of drawSprite, this test is excluded |
180 // from scaled replay tests because drawSprite ignores the | 179 // from scaled replay tests because drawSprite ignores the |
181 // reciprocal scale that is applied at record time, which is | 180 // reciprocal scale that is applied at record time, which is |
182 // the intended behavior of drawSprite. | 181 // the intended behavior of drawSprite. |
183 return kSkipScaledReplay_Flag; | 182 return kSkipScaledReplay_Flag | kSkipTiled_Flag; |
184 } | 183 } |
185 | 184 |
186 virtual void onDraw(SkCanvas* canvas) { | 185 virtual void onDraw(SkCanvas* canvas) { |
187 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { | 186 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { |
188 draw_paint, | 187 draw_paint, |
189 draw_line, draw_rect, draw_path, draw_text, | 188 draw_line, draw_rect, draw_path, draw_text, |
190 draw_bitmap, | 189 draw_bitmap, |
191 draw_sprite | 190 draw_sprite |
192 }; | 191 }; |
193 | 192 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 226 } |
228 | 227 |
229 private: | 228 private: |
230 typedef GM INHERITED; | 229 typedef GM INHERITED; |
231 }; | 230 }; |
232 | 231 |
233 /////////////////////////////////////////////////////////////////////////////// | 232 /////////////////////////////////////////////////////////////////////////////// |
234 | 233 |
235 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } | 234 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } |
236 static skiagm::GMRegistry reg(MyFactory); | 235 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |