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 "SkMatrixImageFilter.h" | 9 #include "SkMatrixImageFilter.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 | |
37 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 33 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
38 SkPaint paint; | 34 SkPaint paint; |
39 SkMatrix matrix; | 35 SkMatrix matrix; |
40 matrix.setScale(RESIZE_FACTOR, RESIZE_FACTOR); | 36 matrix.setScale(RESIZE_FACTOR, RESIZE_FACTOR); |
41 SkAutoTUnref<SkImageFilter> imageFilter( | 37 SkAutoTUnref<SkImageFilter> imageFilter( |
42 SkMatrixImageFilter::Create(matrix, SkPaint::kNone_FilterLevel)); | 38 SkMatrixImageFilter::Create(matrix, SkPaint::kNone_FilterLevel)); |
43 paint.setImageFilter(imageFilter.get()); | 39 paint.setImageFilter(imageFilter.get()); |
44 const SkScalar tile_size = SkIntToScalar(100); | 40 const SkScalar tile_size = SkIntToScalar(100); |
45 SkRect bounds; | 41 SkRect bounds; |
46 canvas->getClipBounds(&bounds); | 42 canvas->getClipBounds(&bounds); |
(...skipping 27 matching lines...) Expand all Loading... |
74 | 70 |
75 private: | 71 private: |
76 typedef GM INHERITED; | 72 typedef GM INHERITED; |
77 }; | 73 }; |
78 | 74 |
79 ////////////////////////////////////////////////////////////////////////////// | 75 ////////////////////////////////////////////////////////////////////////////// |
80 | 76 |
81 DEF_GM(return new ImageResizeTiledGM(); ) | 77 DEF_GM(return new ImageResizeTiledGM(); ) |
82 | 78 |
83 } | 79 } |
OLD | NEW |