Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: gm/morphology.cpp

Issue 26371002: Change SkImageFilter's cropRect from SkIRect to a CropRect struct (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Alternate version, using a single fFlags member. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/lighting.cpp ('k') | gm/offsetimagefilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/lighting.cpp ('k') | gm/offsetimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698