OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkResizeImageFilter.h" | 9 #include "SkResizeImageFilter.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 protected: | 24 protected: |
25 virtual SkString onShortName() SK_OVERRIDE { | 25 virtual SkString onShortName() SK_OVERRIDE { |
26 return SkString("imageresizetiled"); | 26 return SkString("imageresizetiled"); |
27 } | 27 } |
28 | 28 |
29 virtual SkISize onISize() SK_OVERRIDE { | 29 virtual SkISize onISize() SK_OVERRIDE { |
30 return make_isize(WIDTH, HEIGHT); | 30 return make_isize(WIDTH, HEIGHT); |
31 } | 31 } |
32 | 32 |
| 33 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 34 return kSkipTiled_Flag; |
| 35 } |
| 36 |
33 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 37 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
34 SkPaint paint; | 38 SkPaint paint; |
35 SkAutoTUnref<SkImageFilter> imageFilter( | 39 SkAutoTUnref<SkImageFilter> imageFilter( |
36 new SkResizeImageFilter(RESIZE_FACTOR, RESIZE_FACTOR, SkPaint::kNone
_FilterLevel)); | 40 new SkResizeImageFilter(RESIZE_FACTOR, RESIZE_FACTOR, SkPaint::kNone
_FilterLevel)); |
37 paint.setImageFilter(imageFilter.get()); | 41 paint.setImageFilter(imageFilter.get()); |
38 const SkScalar tile_size = SkIntToScalar(100); | 42 const SkScalar tile_size = SkIntToScalar(100); |
39 SkRect bounds; | 43 SkRect bounds; |
40 canvas->getClipBounds(&bounds); | 44 canvas->getClipBounds(&bounds); |
41 for (SkScalar y = 0; y < HEIGHT; y += tile_size) { | 45 for (SkScalar y = 0; y < HEIGHT; y += tile_size) { |
42 for (SkScalar x = 0; x < WIDTH; x += tile_size) { | 46 for (SkScalar x = 0; x < WIDTH; x += tile_size) { |
(...skipping 25 matching lines...) Expand all Loading... |
68 | 72 |
69 private: | 73 private: |
70 typedef GM INHERITED; | 74 typedef GM INHERITED; |
71 }; | 75 }; |
72 | 76 |
73 ////////////////////////////////////////////////////////////////////////////// | 77 ////////////////////////////////////////////////////////////////////////////// |
74 | 78 |
75 DEF_GM(return new ImageResizeTiledGM(); ) | 79 DEF_GM(return new ImageResizeTiledGM(); ) |
76 | 80 |
77 } | 81 } |
OLD | NEW |