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

Side by Side Diff: gm/offsetimagefilter.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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
« no previous file with comments | « gm/ninepatchstretch.cpp ('k') | gm/ovals.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 2013 Google Inc. 2 * Copyright 2013 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "SkBitmapSource.h" 9 #include "SkBitmapSource.h"
10 #include "SkOffsetImageFilter.h" 10 #include "SkOffsetImageFilter.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SkScalar dy = SkIntToScalar(i*10); 89 SkScalar dy = SkIntToScalar(i*10);
90 SkAutoTUnref<SkImageFilter> filter(SkOffsetImageFilter::Create(dx, d y, tileInput, 90 SkAutoTUnref<SkImageFilter> filter(SkOffsetImageFilter::Create(dx, d y, tileInput,
91 &rect )); 91 &rect ));
92 paint.setImageFilter(filter); 92 paint.setImageFilter(filter);
93 drawClippedBitmap(canvas, *bitmap, paint, 1, cropRect); 93 drawClippedBitmap(canvas, *bitmap, paint, 1, cropRect);
94 canvas->translate(SkIntToScalar(bitmap->width() + MARGIN), 0); 94 canvas->translate(SkIntToScalar(bitmap->width() + MARGIN), 0);
95 } 95 }
96 96
97 SkIRect cropRect = SkIRect::MakeXYWH(0, 0, 100, 100); 97 SkIRect cropRect = SkIRect::MakeXYWH(0, 0, 100, 100);
98 SkImageFilter::CropRect rect(SkRect::Make(cropRect)); 98 SkImageFilter::CropRect rect(SkRect::Make(cropRect));
99 SkAutoTUnref<SkImageFilter> filter(SkOffsetImageFilter::Create(-5, -10, NULL, &rect)); 99 SkAutoTUnref<SkImageFilter> filter(SkOffsetImageFilter::Create(-5, -10, nullptr, &rect));
100 paint.setImageFilter(filter); 100 paint.setImageFilter(filter);
101 drawClippedBitmap(canvas, fBitmap, paint, 2, cropRect); 101 drawClippedBitmap(canvas, fBitmap, paint, 2, cropRect);
102 } 102 }
103 private: 103 private:
104 typedef skiagm::GM INHERITED; 104 typedef skiagm::GM INHERITED;
105 SkBitmap fBitmap, fCheckerboard; 105 SkBitmap fBitmap, fCheckerboard;
106 }; 106 };
107 DEF_GM( return new OffsetImageFilterGM; ) 107 DEF_GM( return new OffsetImageFilterGM; )
108 108
109 ////////////////////////////////////////////////////////////////////////////// 109 //////////////////////////////////////////////////////////////////////////////
110 110
111 class SimpleOffsetImageFilterGM : public skiagm::GM { 111 class SimpleOffsetImageFilterGM : public skiagm::GM {
112 public: 112 public:
113 SimpleOffsetImageFilterGM() {} 113 SimpleOffsetImageFilterGM() {}
114 114
115 protected: 115 protected:
116 SkString onShortName() override { 116 SkString onShortName() override {
117 return SkString("simple-offsetimagefilter"); 117 return SkString("simple-offsetimagefilter");
118 } 118 }
119 119
120 SkISize onISize() override { return SkISize::Make(640, 200); } 120 SkISize onISize() override { return SkISize::Make(640, 200); }
121 121
122 void doDraw(SkCanvas* canvas, const SkRect& r, SkImageFilter* imgf, 122 void doDraw(SkCanvas* canvas, const SkRect& r, SkImageFilter* imgf,
123 const SkRect* clipR = NULL) { 123 const SkRect* clipR = nullptr) {
124 SkPaint p; 124 SkPaint p;
125 125
126 if (clipR) { 126 if (clipR) {
127 p.setColor(0xFF00FF00); 127 p.setColor(0xFF00FF00);
128 p.setStyle(SkPaint::kStroke_Style); 128 p.setStyle(SkPaint::kStroke_Style);
129 canvas->drawRect(clipR->makeInset(SK_ScalarHalf, SK_ScalarHalf), p); 129 canvas->drawRect(clipR->makeInset(SK_ScalarHalf, SK_ScalarHalf), p);
130 p.setStyle(SkPaint::kFill_Style); 130 p.setStyle(SkPaint::kFill_Style);
131 } 131 }
132 132
133 if (imgf && imgf->cropRectIsSet()) { 133 if (imgf && imgf->cropRectIsSet()) {
(...skipping 26 matching lines...) Expand all
160 void onDraw(SkCanvas* canvas) override { 160 void onDraw(SkCanvas* canvas) override {
161 const SkRect r = SkRect::MakeWH(40, 40); 161 const SkRect r = SkRect::MakeWH(40, 40);
162 SkImageFilter::CropRect cr0(r); 162 SkImageFilter::CropRect cr0(r);
163 SkImageFilter::CropRect cr1(SkRect::MakeWH(20, 20)); 163 SkImageFilter::CropRect cr1(SkRect::MakeWH(20, 20));
164 const SkRect r2 = SkRect::MakeXYWH(40, 0, 40, 40); 164 const SkRect r2 = SkRect::MakeXYWH(40, 0, 40, 40);
165 SkImageFilter::CropRect cr2(r2); 165 SkImageFilter::CropRect cr2(r2);
166 166
167 canvas->translate(40, 40); 167 canvas->translate(40, 40);
168 168
169 canvas->save(); 169 canvas->save();
170 this->doDraw(canvas, r, NULL); 170 this->doDraw(canvas, r, nullptr);
171 171
172 canvas->translate(100, 0); 172 canvas->translate(100, 0);
173 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20)); 173 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20));
174 174
175 canvas->translate(100, 0); 175 canvas->translate(100, 0);
176 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, &cr0)) ; 176 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, &cr 0));
177 177
178 canvas->translate(100, 0); 178 canvas->translate(100, 0);
179 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20), &r); 179 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20), &r);
180 180
181 canvas->translate(100, 0); 181 canvas->translate(100, 0);
182 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, &cr1)) ; 182 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, &cr 1));
183 183
184 SkRect clipR = SkRect::MakeXYWH(40, 40, 40, 40); 184 SkRect clipR = SkRect::MakeXYWH(40, 40, 40, 40);
185 canvas->translate(100, 0); 185 canvas->translate(100, 0);
186 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, NULL), &clipR); 186 this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, nul lptr), &clipR);
187 canvas->restore(); 187 canvas->restore();
188 188
189 // 2nd row 189 // 2nd row
190 canvas->translate(0, 80); 190 canvas->translate(0, 80);
191 191
192 /* 192 /*
193 * combos of clip and crop rects that align with src and dst 193 * combos of clip and crop rects that align with src and dst
194 */ 194 */
195 195
196 // crop==clip==src 196 // crop==clip==src
197 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr0), &r); 197 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr0 ), &r);
198 198
199 // crop==src, clip==dst 199 // crop==src, clip==dst
200 canvas->translate(100, 0); 200 canvas->translate(100, 0);
201 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr0), &r2); 201 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr0 ), &r2);
202 202
203 // crop==dst, clip==src 203 // crop==dst, clip==src
204 canvas->translate(100, 0); 204 canvas->translate(100, 0);
205 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2), &r); 205 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr2 ), &r);
206 206
207 // crop==clip==dst 207 // crop==clip==dst
208 canvas->translate(100, 0); 208 canvas->translate(100, 0);
209 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2), &r2); 209 this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, nullptr, &cr2 ), &r2);
210 } 210 }
211 211
212 private: 212 private:
213 typedef skiagm::GM INHERITED; 213 typedef skiagm::GM INHERITED;
214 }; 214 };
215 DEF_GM( return new SimpleOffsetImageFilterGM; ) 215 DEF_GM( return new SimpleOffsetImageFilterGM; )
OLDNEW
« no previous file with comments | « gm/ninepatchstretch.cpp ('k') | gm/ovals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698