| 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 { 140, 140, 2, 2 }, | 63 { 140, 140, 2, 2 }, |
| 64 { 24, 24, 25, 25 }, | 64 { 24, 24, 25, 25 }, |
| 65 }; | 65 }; |
| 66 SkPaint paint; | 66 SkPaint paint; |
| 67 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80)); | 67 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80)); |
| 68 | 68 |
| 69 for (unsigned j = 0; j < 4; ++j) { | 69 for (unsigned j = 0; j < 4; ++j) { |
| 70 for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { | 70 for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { |
| 71 const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : nullp
tr; | 71 const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : nullp
tr; |
| 72 if (j & 0x01) { | 72 if (j & 0x01) { |
| 73 paint.setImageFilter(SkErodeImageFilter::Create( | 73 paint.setImageFilter(SkErodeImageFilter::Make(samples[i].fRa
diusX, |
| 74 samples[i].fRadiusX, | 74 samples[i].fRa
diusY, |
| 75 samples[i].fRadiusY, | 75 nullptr, |
| 76 nullptr, | 76 cr)); |
| 77 cr))->unref(); | |
| 78 } else { | 77 } else { |
| 79 paint.setImageFilter(SkDilateImageFilter::Create( | 78 paint.setImageFilter(SkDilateImageFilter::Make(samples[i].fR
adiusX, |
| 80 samples[i].fRadiusX, | 79 samples[i].fR
adiusY, |
| 81 samples[i].fRadiusY, | 80 nullptr, |
| 82 nullptr, | 81 cr)); |
| 83 cr))->unref(); | |
| 84 } | 82 } |
| 85 this->drawClippedBitmap(canvas, paint, i * 140, j * 140); | 83 this->drawClippedBitmap(canvas, paint, i * 140, j * 140); |
| 86 } | 84 } |
| 87 } | 85 } |
| 88 } | 86 } |
| 89 | 87 |
| 90 private: | 88 private: |
| 91 SkBitmap fBitmap; | 89 SkBitmap fBitmap; |
| 92 | 90 |
| 93 typedef GM INHERITED; | 91 typedef GM INHERITED; |
| 94 }; | 92 }; |
| 95 | 93 |
| 96 ////////////////////////////////////////////////////////////////////////////// | 94 ////////////////////////////////////////////////////////////////////////////// |
| 97 | 95 |
| 98 DEF_GM(return new MorphologyGM;) | 96 DEF_GM(return new MorphologyGM;) |
| 99 | 97 |
| 100 } | 98 } |
| OLD | NEW |