| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 { 140, 140, 0, 2 }, | 66 { 140, 140, 0, 2 }, |
| 67 { 140, 140, 2, 0 }, | 67 { 140, 140, 2, 0 }, |
| 68 { 140, 140, 2, 2 }, | 68 { 140, 140, 2, 2 }, |
| 69 { 24, 24, 25, 25 }, | 69 { 24, 24, 25, 25 }, |
| 70 }; | 70 }; |
| 71 SkPaint paint; | 71 SkPaint paint; |
| 72 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80)); | 72 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80)); |
| 73 | 73 |
| 74 for (unsigned j = 0; j < 4; ++j) { | 74 for (unsigned j = 0; j < 4; ++j) { |
| 75 for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { | 75 for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { |
| 76 const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : NULL; | 76 const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : nullp
tr; |
| 77 if (j & 0x01) { | 77 if (j & 0x01) { |
| 78 paint.setImageFilter(SkErodeImageFilter::Create( | 78 paint.setImageFilter(SkErodeImageFilter::Create( |
| 79 samples[i].fRadiusX, | 79 samples[i].fRadiusX, |
| 80 samples[i].fRadiusY, | 80 samples[i].fRadiusY, |
| 81 NULL, | 81 nullptr, |
| 82 cr))->unref(); | 82 cr))->unref(); |
| 83 } else { | 83 } else { |
| 84 paint.setImageFilter(SkDilateImageFilter::Create( | 84 paint.setImageFilter(SkDilateImageFilter::Create( |
| 85 samples[i].fRadiusX, | 85 samples[i].fRadiusX, |
| 86 samples[i].fRadiusY, | 86 samples[i].fRadiusY, |
| 87 NULL, | 87 nullptr, |
| 88 cr))->unref(); | 88 cr))->unref(); |
| 89 } | 89 } |
| 90 drawClippedBitmap(canvas, paint, i * 140, j * 140); | 90 drawClippedBitmap(canvas, paint, i * 140, j * 140); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 typedef GM INHERITED; | 96 typedef GM INHERITED; |
| 97 SkBitmap fBitmap; | 97 SkBitmap fBitmap; |
| 98 bool fOnce; | 98 bool fOnce; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 ////////////////////////////////////////////////////////////////////////////// | 101 ////////////////////////////////////////////////////////////////////////////// |
| 102 | 102 |
| 103 static GM* MyFactory(void*) { return new MorphologyGM; } | 103 static GM* MyFactory(void*) { return new MorphologyGM; } |
| 104 static GMRegistry reg(MyFactory); | 104 static GMRegistry reg(MyFactory); |
| 105 | 105 |
| 106 } | 106 } |
| OLD | NEW |