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

Side by Side Diff: gm/texteffects.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/textblobuseaftergpufree.cpp ('k') | gm/texturedomaineffect.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 "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
11 #include "SkReadBuffer.h" 11 #include "SkReadBuffer.h"
12 #include "SkWriteBuffer.h" 12 #include "SkWriteBuffer.h"
13 #include "SkLayerRasterizer.h" 13 #include "SkLayerRasterizer.h"
14 14
15 static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { 15 static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
16 p.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, 16 p.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
17 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)) ))->unref(); 17 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)) ))->unref();
18 rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); 18 rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
19 19
20 p.setMaskFilter(NULL); 20 p.setMaskFilter(nullptr);
21 p.setStyle(SkPaint::kStroke_Style); 21 p.setStyle(SkPaint::kStroke_Style);
22 p.setStrokeWidth(SK_Scalar1); 22 p.setStrokeWidth(SK_Scalar1);
23 rastBuilder->addLayer(p); 23 rastBuilder->addLayer(p);
24 24
25 p.setAlpha(0x11); 25 p.setAlpha(0x11);
26 p.setStyle(SkPaint::kFill_Style); 26 p.setStyle(SkPaint::kFill_Style);
27 p.setXfermodeMode(SkXfermode::kSrc_Mode); 27 p.setXfermodeMode(SkXfermode::kSrc_Mode);
28 rastBuilder->addLayer(p); 28 rastBuilder->addLayer(p);
29 } 29 }
30 30
(...skipping 30 matching lines...) Expand all
61 } 61 }
62 62
63 static void r4(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { 63 static void r4(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
64 p.setAlpha(0x60); 64 p.setAlpha(0x60);
65 rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); 65 rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
66 66
67 p.setAlpha(0xFF); 67 p.setAlpha(0xFF);
68 p.setXfermodeMode(SkXfermode::kClear_Mode); 68 p.setXfermodeMode(SkXfermode::kClear_Mode);
69 rastBuilder->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2); 69 rastBuilder->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2);
70 70
71 p.setXfermode(NULL); 71 p.setXfermode(nullptr);
72 rastBuilder->addLayer(p); 72 rastBuilder->addLayer(p);
73 } 73 }
74 74
75 #include "SkDiscretePathEffect.h" 75 #include "SkDiscretePathEffect.h"
76 76
77 static void r5(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { 77 static void r5(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
78 rastBuilder->addLayer(p); 78 rastBuilder->addLayer(p);
79 79
80 p.setPathEffect(SkDiscretePathEffect::Create(SK_Scalar1*4, SK_Scalar1*3))->u nref(); 80 p.setPathEffect(SkDiscretePathEffect::Create(SK_Scalar1*4, SK_Scalar1*3))->u nref();
81 p.setXfermodeMode(SkXfermode::kSrcOut_Mode); 81 p.setXfermodeMode(SkXfermode::kSrcOut_Mode);
(...skipping 30 matching lines...) Expand all
112 static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { 112 static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
113 rastBuilder->addLayer(p); 113 rastBuilder->addLayer(p);
114 114
115 SkMatrix lattice; 115 SkMatrix lattice;
116 lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); 116 lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0);
117 lattice.postSkew(SK_Scalar1/3, 0, 0, 0); 117 lattice.postSkew(SK_Scalar1/3, 0, 0, 0);
118 p.setPathEffect(MakeDotEffect(SK_Scalar1*2, lattice))->unref(); 118 p.setPathEffect(MakeDotEffect(SK_Scalar1*2, lattice))->unref();
119 p.setXfermodeMode(SkXfermode::kClear_Mode); 119 p.setXfermodeMode(SkXfermode::kClear_Mode);
120 rastBuilder->addLayer(p); 120 rastBuilder->addLayer(p);
121 121
122 p.setPathEffect(NULL); 122 p.setPathEffect(nullptr);
123 p.setXfermode(NULL); 123 p.setXfermode(nullptr);
124 p.setStyle(SkPaint::kStroke_Style); 124 p.setStyle(SkPaint::kStroke_Style);
125 p.setStrokeWidth(SK_Scalar1); 125 p.setStrokeWidth(SK_Scalar1);
126 rastBuilder->addLayer(p); 126 rastBuilder->addLayer(p);
127 } 127 }
128 128
129 static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) { 129 static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
130 rastBuilder->addLayer(p); 130 rastBuilder->addLayer(p);
131 131
132 SkMatrix lattice; 132 SkMatrix lattice;
133 lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0); 133 lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0);
134 lattice.postRotate(SkIntToScalar(30), 0, 0); 134 lattice.postRotate(SkIntToScalar(30), 0, 0);
135 p.setPathEffect(SkLine2DPathEffect::Create(SK_Scalar1*2, lattice))->unref(); 135 p.setPathEffect(SkLine2DPathEffect::Create(SK_Scalar1*2, lattice))->unref();
136 p.setXfermodeMode(SkXfermode::kClear_Mode); 136 p.setXfermodeMode(SkXfermode::kClear_Mode);
137 rastBuilder->addLayer(p); 137 rastBuilder->addLayer(p);
138 138
139 p.setPathEffect(NULL); 139 p.setPathEffect(nullptr);
140 p.setXfermode(NULL); 140 p.setXfermode(nullptr);
141 p.setStyle(SkPaint::kStroke_Style); 141 p.setStyle(SkPaint::kStroke_Style);
142 p.setStrokeWidth(SK_Scalar1); 142 p.setStrokeWidth(SK_Scalar1);
143 rastBuilder->addLayer(p); 143 rastBuilder->addLayer(p);
144 } 144 }
145 145
146 typedef void (*raster_proc)(SkLayerRasterizer::Builder*, SkPaint&); 146 typedef void (*raster_proc)(SkLayerRasterizer::Builder*, SkPaint&);
147 147
148 static const raster_proc gRastProcs[] = { 148 static const raster_proc gRastProcs[] = {
149 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9 149 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9
150 }; 150 };
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 paint.setTextSize(SkIntToScalar(56)); 192 paint.setTextSize(SkIntToScalar(56));
193 193
194 SkScalar x = SkIntToScalar(20); 194 SkScalar x = SkIntToScalar(20);
195 SkScalar y = paint.getTextSize(); 195 SkScalar y = paint.getTextSize();
196 196
197 SkString str("Hamburgefons"); 197 SkString str("Hamburgefons");
198 198
199 for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gRastProcs)); i++) { 199 for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gRastProcs)); i++) {
200 apply_shader(&paint, i); 200 apply_shader(&paint, i);
201 201
202 // paint.setMaskFilter(NULL); 202 // paint.setMaskFilter(nullptr);
203 // paint.setColor(SK_ColorBLACK); 203 // paint.setColor(SK_ColorBLACK);
204 204
205 canvas->drawText(str.c_str(), str.size(), x, y, paint); 205 canvas->drawText(str.c_str(), str.size(), x, y, paint);
206 206
207 y += paint.getFontSpacing(); 207 y += paint.getFontSpacing();
208 } 208 }
209 209
210 canvas->restore(); 210 canvas->restore();
211 } 211 }
212 212
213 private: 213 private:
214 typedef skiagm::GM INHERITED; 214 typedef skiagm::GM INHERITED;
215 }; 215 };
216 216
217 ////////////////////////////////////////////////////////////////////////////// 217 //////////////////////////////////////////////////////////////////////////////
218 218
219 static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; } 219 static skiagm::GM* MyFactory(void*) { return new TextEffectsGM; }
220 static skiagm::GMRegistry reg(MyFactory); 220 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/textblobuseaftergpufree.cpp ('k') | gm/texturedomaineffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698