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

Side by Side Diff: gm/imagefilterscropexpand.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/imagefiltersclipped.cpp ('k') | gm/imagefilterscropped.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 2014 Google Inc. 2 * Copyright 2014 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 SkScalar x = SkIntToScalar(width / 2); 61 SkScalar x = SkIntToScalar(width / 2);
62 SkScalar y = SkIntToScalar(height / 2); 62 SkScalar y = SkIntToScalar(height / 2);
63 SkScalar radius = SkMinScalar(x, y) * 0.8f; 63 SkScalar radius = SkMinScalar(x, y) * 0.8f;
64 bitmap->allocN32Pixels(width, height); 64 bitmap->allocN32Pixels(width, height);
65 SkCanvas canvas(*bitmap); 65 SkCanvas canvas(*bitmap);
66 canvas.clear(0x00000000); 66 canvas.clear(0x00000000);
67 SkColor colors[2]; 67 SkColor colors[2];
68 colors[0] = SK_ColorWHITE; 68 colors[0] = SK_ColorWHITE;
69 colors[1] = SK_ColorBLACK; 69 colors[1] = SK_ColorBLACK;
70 SkAutoTUnref<SkShader> shader( 70 SkAutoTUnref<SkShader> shader(
71 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL, 2, 71 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
72 SkShader::kClamp_TileMode) 72 SkShader::kClamp_TileMode)
73 ); 73 );
74 SkPaint paint; 74 SkPaint paint;
75 paint.setShader(shader); 75 paint.setShader(shader);
76 canvas.drawCircle(x, y, radius, paint); 76 canvas.drawCircle(x, y, radius, paint);
77 } 77 }
78 78
79 static void draw(SkCanvas* canvas, const SkBitmap& bitmap, const SkRect& rec t, SkImageFilter* filter) { 79 static void draw(SkCanvas* canvas, const SkBitmap& bitmap, const SkRect& rec t, SkImageFilter* filter) {
80 SkPaint paint; 80 SkPaint paint;
81 paint.setImageFilter(filter)->unref(); 81 paint.setImageFilter(filter)->unref();
(...skipping 16 matching lines...) Expand all
98 SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), 98 SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)),
99 SkImageFilter::CropRect::kHasAll_CropEdge); 99 SkImageFilter::CropRect::kHasAll_CropEdge);
100 100
101 SkBitmap gradient_circle, checkerboard; 101 SkBitmap gradient_circle, checkerboard;
102 make_gradient_circle(64, 64, &gradient_circle); 102 make_gradient_circle(64, 64, &gradient_circle);
103 make_checkerboard(&checkerboard); 103 make_checkerboard(&checkerboard);
104 104
105 SkAutoTUnref<SkImageFilter> gradient_circle_source( 105 SkAutoTUnref<SkImageFilter> gradient_circle_source(
106 SkBitmapSource::Create(gradient_circle)); 106 SkBitmapSource::Create(gradient_circle));
107 SkAutoTUnref<SkImageFilter> noop_cropped( 107 SkAutoTUnref<SkImageFilter> noop_cropped(
108 SkOffsetImageFilter::Create(0, 0, NULL, &crop_rect)); 108 SkOffsetImageFilter::Create(0, 0, nullptr, &crop_rect));
109 SkScalar sk255 = SkIntToScalar(255); 109 SkScalar sk255 = SkIntToScalar(255);
110 SkScalar matrix[20] = { 1, 0, 0, 0, 0, 110 SkScalar matrix[20] = { 1, 0, 0, 0, 0,
111 0, 1, 0, 0, sk255, 111 0, 1, 0, 0, sk255,
112 0, 0, 1, 0, 0, 112 0, 0, 1, 0, 0,
113 0, 0, 0, 0, sk255 }; 113 0, 0, 0, 0, sk255 };
114 SkAutoTUnref<SkColorFilter> cf_alpha_trans(SkColorMatrixFilter::Create(m atrix)); 114 SkAutoTUnref<SkColorFilter> cf_alpha_trans(SkColorMatrixFilter::Create(m atrix));
115 115
116 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); 116 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
117 SkScalar MARGIN = SkIntToScalar(12); 117 SkScalar MARGIN = SkIntToScalar(12);
118 118
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 private: 164 private:
165 typedef GM INHERITED; 165 typedef GM INHERITED;
166 }; 166 };
167 167
168 /////////////////////////////////////////////////////////////////////////////// 168 ///////////////////////////////////////////////////////////////////////////////
169 169
170 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCropExpandGM; } 170 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCropExpandGM; }
171 static skiagm::GMRegistry reg(MyFactory); 171 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/imagefiltersclipped.cpp ('k') | gm/imagefilterscropped.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698