OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkMorphologyImageFilter.h" | 9 #include "SkMorphologyImageFilter.h" |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 int fWidth, fHeight; | 63 int fWidth, fHeight; |
64 int fRadiusX, fRadiusY; | 64 int fRadiusX, fRadiusY; |
65 } samples[] = { | 65 } samples[] = { |
66 { 140, 140, 0, 0 }, | 66 { 140, 140, 0, 0 }, |
67 { 140, 140, 0, 2 }, | 67 { 140, 140, 0, 2 }, |
68 { 140, 140, 2, 0 }, | 68 { 140, 140, 2, 0 }, |
69 { 140, 140, 2, 2 }, | 69 { 140, 140, 2, 2 }, |
70 { 24, 24, 25, 25 }, | 70 { 24, 24, 25, 25 }, |
71 }; | 71 }; |
72 SkPaint paint; | 72 SkPaint paint; |
| 73 #ifdef SK_CROP_RECT_IS_INT |
73 SkIRect cropRect = SkIRect::MakeXYWH(25, 20, 100, 80); | 74 SkIRect cropRect = SkIRect::MakeXYWH(25, 20, 100, 80); |
| 75 #else |
| 76 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80)); |
| 77 #endif |
74 | 78 |
75 for (unsigned j = 0; j < 4; ++j) { | 79 for (unsigned j = 0; j < 4; ++j) { |
76 for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { | 80 for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { |
77 const SkIRect* cr = j & 0x02 ? &cropRect : NULL; | 81 const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : NULL; |
78 if (j & 0x01) { | 82 if (j & 0x01) { |
79 paint.setImageFilter(new SkErodeImageFilter( | 83 paint.setImageFilter(new SkErodeImageFilter( |
80 samples[i].fRadiusX, | 84 samples[i].fRadiusX, |
81 samples[i].fRadiusY, | 85 samples[i].fRadiusY, |
82 NULL, | 86 NULL, |
83 cr))->unref(); | 87 cr))->unref(); |
84 } else { | 88 } else { |
85 paint.setImageFilter(new SkDilateImageFilter( | 89 paint.setImageFilter(new SkDilateImageFilter( |
86 samples[i].fRadiusX, | 90 samples[i].fRadiusX, |
87 samples[i].fRadiusY, | 91 samples[i].fRadiusY, |
(...skipping 10 matching lines...) Expand all Loading... |
98 SkBitmap fBitmap; | 102 SkBitmap fBitmap; |
99 bool fOnce; | 103 bool fOnce; |
100 }; | 104 }; |
101 | 105 |
102 ////////////////////////////////////////////////////////////////////////////// | 106 ////////////////////////////////////////////////////////////////////////////// |
103 | 107 |
104 static GM* MyFactory(void*) { return new MorphologyGM; } | 108 static GM* MyFactory(void*) { return new MorphologyGM; } |
105 static GMRegistry reg(MyFactory); | 109 static GMRegistry reg(MyFactory); |
106 | 110 |
107 } | 111 } |
OLD | NEW |