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

Side by Side Diff: gm/imagefilterscropped.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/imagefilterscropexpand.cpp ('k') | gm/imagefiltersgraph.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 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { 53 static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
54 SkPaint paint; 54 SkPaint paint;
55 55
56 SkIRect bounds; 56 SkIRect bounds;
57 r.roundOut(&bounds); 57 r.roundOut(&bounds);
58 58
59 SkBitmap bm; 59 SkBitmap bm;
60 bm.allocN32Pixels(bounds.width(), bounds.height()); 60 bm.allocN32Pixels(bounds.width(), bounds.height());
61 bm.eraseColor(SK_ColorTRANSPARENT); 61 bm.eraseColor(SK_ColorTRANSPARENT);
62 SkCanvas c(bm); 62 SkCanvas c(bm);
63 draw_path(&c, r, NULL); 63 draw_path(&c, r, nullptr);
64 64
65 paint.setImageFilter(imf); 65 paint.setImageFilter(imf);
66 canvas->drawBitmap(bm, 0, 0, &paint); 66 canvas->drawBitmap(bm, 0, 0, &paint);
67 } 67 }
68 68
69 static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { 69 static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
70 SkPaint paint; 70 SkPaint paint;
71 71
72 SkIRect bounds; 72 SkIRect bounds;
73 r.roundOut(&bounds); 73 r.roundOut(&bounds);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 SkAutoTUnref<SkColorFilter> cf( 142 SkAutoTUnref<SkColorFilter> cf(
143 SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mod e)); 143 SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mod e));
144 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); 144 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge);
145 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, - 100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge); 145 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, - 100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge);
146 146
147 SkAutoTUnref<SkImageFilter> offset(SkOffsetImageFilter::Create( 147 SkAutoTUnref<SkImageFilter> offset(SkOffsetImageFilter::Create(
148 SkIntToScalar(-10), SkIntToScalar(-10))); 148 SkIntToScalar(-10), SkIntToScalar(-10)));
149 149
150 SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf .get(), offset.get())); 150 SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf .get(), offset.get()));
151 151
152 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, NULL , &cropRect)); 152 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null ptr, &cropRect));
153 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, NULL , &cropRect)); 153 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null ptr, &cropRect));
154 154
155 SkImageFilter* filters[] = { 155 SkImageFilter* filters[] = {
156 NULL, 156 nullptr,
157 SkColorFilterImageFilter::Create(cf.get(), NULL, &cropRect), 157 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect),
158 SkBlurImageFilter::Create(1.0f, 1.0f, NULL, &cropRect), 158 SkBlurImageFilter::Create(1.0f, 1.0f, nullptr, &cropRect),
159 SkBlurImageFilter::Create(8.0f, 0.0f, NULL, &cropRect), 159 SkBlurImageFilter::Create(8.0f, 0.0f, nullptr, &cropRect),
160 SkBlurImageFilter::Create(0.0f, 8.0f, NULL, &cropRect), 160 SkBlurImageFilter::Create(0.0f, 8.0f, nullptr, &cropRect),
161 SkBlurImageFilter::Create(8.0f, 8.0f, NULL, &cropRect), 161 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &cropRect),
162 SkErodeImageFilter::Create(1, 1, NULL, &cropRect), 162 SkErodeImageFilter::Create(1, 1, nullptr, &cropRect),
163 SkErodeImageFilter::Create(8, 0, erodeY, &cropRect), 163 SkErodeImageFilter::Create(8, 0, erodeY, &cropRect),
164 SkErodeImageFilter::Create(0, 8, erodeX, &cropRect), 164 SkErodeImageFilter::Create(0, 8, erodeX, &cropRect),
165 SkErodeImageFilter::Create(8, 8, NULL, &cropRect), 165 SkErodeImageFilter::Create(8, 8, nullptr, &cropRect),
166 SkMergeImageFilter::Create(NULL, cfOffset.get(), SkXfermode::kSrcOve r_Mode, &cropRect), 166 SkMergeImageFilter::Create(nullptr, cfOffset.get(), SkXfermode::kSrc Over_Mode, &cropRect),
167 SkBlurImageFilter::Create(8.0f, 8.0f, NULL, &bogusRect), 167 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect),
168 SkColorFilterImageFilter::Create(cf.get(), NULL, &bogusRect), 168 SkColorFilterImageFilter::Create(cf.get(), nullptr, &bogusRect),
169 }; 169 };
170 170
171 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); 171 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
172 SkScalar MARGIN = SkIntToScalar(16); 172 SkScalar MARGIN = SkIntToScalar(16);
173 SkScalar DX = r.width() + MARGIN; 173 SkScalar DX = r.width() + MARGIN;
174 SkScalar DY = r.height() + MARGIN; 174 SkScalar DY = r.height() + MARGIN;
175 175
176 canvas->translate(MARGIN, MARGIN); 176 canvas->translate(MARGIN, MARGIN);
177 for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) { 177 for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) {
178 canvas->save(); 178 canvas->save();
(...skipping 14 matching lines...) Expand all
193 193
194 private: 194 private:
195 SkBitmap fCheckerboard; 195 SkBitmap fCheckerboard;
196 typedef GM INHERITED; 196 typedef GM INHERITED;
197 }; 197 };
198 198
199 /////////////////////////////////////////////////////////////////////////////// 199 ///////////////////////////////////////////////////////////////////////////////
200 200
201 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } 201 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; }
202 static skiagm::GMRegistry reg(MyFactory); 202 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/imagefilterscropexpand.cpp ('k') | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698