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

Side by Side Diff: gm/srcmode.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/spritebitmap.cpp ('k') | gm/strokefill.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 #include "SkPath.h" 11 #include "SkPath.h"
12 #include "SkSurface.h" 12 #include "SkSurface.h"
13 13
14 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
15 #include "SkGpuDevice.h" 15 #include "SkGpuDevice.h"
16 #endif 16 #endif
17 17
18 #define W SkIntToScalar(80) 18 #define W SkIntToScalar(80)
19 #define H SkIntToScalar(60) 19 #define H SkIntToScalar(60)
20 20
21 typedef void (*PaintProc)(SkPaint*); 21 typedef void (*PaintProc)(SkPaint*);
22 22
23 static void identity_paintproc(SkPaint* paint) { 23 static void identity_paintproc(SkPaint* paint) {
24 paint->setShader(NULL); 24 paint->setShader(nullptr);
25 } 25 }
26 26
27 static void gradient_paintproc(SkPaint* paint) { 27 static void gradient_paintproc(SkPaint* paint) {
28 const SkColor colors[] = { SK_ColorGREEN, SK_ColorBLUE }; 28 const SkColor colors[] = { SK_ColorGREEN, SK_ColorBLUE };
29 const SkPoint pts[] = { { 0, 0 }, { W, H } }; 29 const SkPoint pts[] = { { 0, 0 }, { W, H } };
30 SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 30 SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr,
31 SK_ARRAY_COUNT(colors), 31 SK_ARRAY_COUNT(colors),
32 SkShader::kClamp_TileMode); 32 SkShader::kClamp_TileMode);
33 paint->setShader(s)->unref(); 33 paint->setShader(s)->unref();
34 } 34 }
35 35
36 typedef void (*Proc)(SkCanvas*, const SkPaint&); 36 typedef void (*Proc)(SkCanvas*, const SkPaint&);
37 37
38 static void draw_hair(SkCanvas* canvas, const SkPaint& paint) { 38 static void draw_hair(SkCanvas* canvas, const SkPaint& paint) {
39 SkPaint p(paint); 39 SkPaint p(paint);
40 p.setStrokeWidth(0); 40 p.setStrokeWidth(0);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 static SkSurface* compat_surface(SkCanvas* canvas, const SkISize& size, bool skipGPU) { 120 static SkSurface* compat_surface(SkCanvas* canvas, const SkISize& size, bool skipGPU) {
121 SkImageInfo info = SkImageInfo::MakeN32Premul(size); 121 SkImageInfo info = SkImageInfo::MakeN32Premul(size);
122 122
123 bool callNewSurface = true; 123 bool callNewSurface = true;
124 #if SK_SUPPORT_GPU 124 #if SK_SUPPORT_GPU
125 if (canvas->getGrContext() && skipGPU) { 125 if (canvas->getGrContext() && skipGPU) {
126 callNewSurface = false; 126 callNewSurface = false;
127 } 127 }
128 #endif 128 #endif
129 SkSurface* surface = callNewSurface ? canvas->newSurface(info) : NULL; 129 SkSurface* surface = callNewSurface ? canvas->newSurface(info) : nullptr ;
130 if (NULL == surface) { 130 if (nullptr == surface) {
131 // picture canvas will return null, so fall-back to raster 131 // picture canvas will return null, so fall-back to raster
132 surface = SkSurface::NewRaster(info); 132 surface = SkSurface::NewRaster(info);
133 } 133 }
134 return surface; 134 return surface;
135 } 135 }
136 136
137 virtual void onDraw(SkCanvas* canvas) { 137 virtual void onDraw(SkCanvas* canvas) {
138 SkAutoTUnref<SkSurface> surf(compat_surface(canvas, this->getISize(), 138 SkAutoTUnref<SkSurface> surf(compat_surface(canvas, this->getISize(),
139 this->isCanvasDeferred())); 139 this->isCanvasDeferred()));
140 surf->getCanvas()->drawColor(SK_ColorWHITE); 140 surf->getCanvas()->drawColor(SK_ColorWHITE);
141 this->drawContent(surf->getCanvas()); 141 this->drawContent(surf->getCanvas());
142 surf->draw(canvas, 0, 0, NULL); 142 surf->draw(canvas, 0, 0, nullptr);
143 } 143 }
144 144
145 private: 145 private:
146 typedef skiagm::GM INHERITED; 146 typedef skiagm::GM INHERITED;
147 }; 147 };
148 148
149 /////////////////////////////////////////////////////////////////////////////// 149 ///////////////////////////////////////////////////////////////////////////////
150 150
151 DEF_GM(return new SrcModeGM;) 151 DEF_GM(return new SrcModeGM;)
OLDNEW
« no previous file with comments | « gm/spritebitmap.cpp ('k') | gm/strokefill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698