| 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 | |
| 74 SkIRect cropRect = SkIRect::MakeXYWH(25, 20, 100, 80); | |
| 75 #else | |
| 76 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80)); | 73 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80)); |
| 77 #endif | |
| 78 | 74 |
| 79 for (unsigned j = 0; j < 4; ++j) { | 75 for (unsigned j = 0; j < 4; ++j) { |
| 80 for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { | 76 for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { |
| 81 const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : NULL; | 77 const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : NULL; |
| 82 if (j & 0x01) { | 78 if (j & 0x01) { |
| 83 paint.setImageFilter(new SkErodeImageFilter( | 79 paint.setImageFilter(new SkErodeImageFilter( |
| 84 samples[i].fRadiusX, | 80 samples[i].fRadiusX, |
| 85 samples[i].fRadiusY, | 81 samples[i].fRadiusY, |
| 86 NULL, | 82 NULL, |
| 87 cr))->unref(); | 83 cr))->unref(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 102 SkBitmap fBitmap; | 98 SkBitmap fBitmap; |
| 103 bool fOnce; | 99 bool fOnce; |
| 104 }; | 100 }; |
| 105 | 101 |
| 106 ////////////////////////////////////////////////////////////////////////////// | 102 ////////////////////////////////////////////////////////////////////////////// |
| 107 | 103 |
| 108 static GM* MyFactory(void*) { return new MorphologyGM; } | 104 static GM* MyFactory(void*) { return new MorphologyGM; } |
| 109 static GMRegistry reg(MyFactory); | 105 static GMRegistry reg(MyFactory); |
| 110 | 106 |
| 111 } | 107 } |
| OLD | NEW |