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

Side by Side Diff: samplecode/SampleVertices.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 | « samplecode/SampleUnpremul.cpp ('k') | samplecode/SampleXfermodesBlur.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 28 matching lines...) Expand all
39 bm.unlockPixels(); 39 bm.unlockPixels();
40 40
41 return SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, 41 return SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode,
42 SkShader::kRepeat_TileMode); 42 SkShader::kRepeat_TileMode);
43 } 43 }
44 44
45 static SkShader* make_shader1(const SkIPoint& size) { 45 static SkShader* make_shader1(const SkIPoint& size) {
46 SkPoint pts[] = { { 0, 0 }, 46 SkPoint pts[] = { { 0, 0 },
47 { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } }; 47 { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
48 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED } ; 48 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED } ;
49 return SkGradientShader::CreateLinear(pts, colors, NULL, 49 return SkGradientShader::CreateLinear(pts, colors, nullptr,
50 SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode); 50 SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode);
51 } 51 }
52 52
53 class VerticesView : public SampleView { 53 class VerticesView : public SampleView {
54 SkShader* fShader0; 54 SkShader* fShader0;
55 SkShader* fShader1; 55 SkShader* fShader1;
56 56
57 public: 57 public:
58 VerticesView() { 58 VerticesView() {
59 SkIPoint size; 59 SkIPoint size;
(...skipping 28 matching lines...) Expand all
88 SkScalar fScale; 88 SkScalar fScale;
89 89
90 void onDrawContent(SkCanvas* canvas) override { 90 void onDrawContent(SkCanvas* canvas) override {
91 SkPaint paint; 91 SkPaint paint;
92 paint.setDither(true); 92 paint.setDither(true);
93 paint.setFilterQuality(kLow_SkFilterQuality); 93 paint.setFilterQuality(kLow_SkFilterQuality);
94 94
95 for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) { 95 for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
96 canvas->save(); 96 canvas->save();
97 97
98 paint.setShader(NULL); 98 paint.setShader(nullptr);
99 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount, 99 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
100 fRecs[i].fVerts, fRecs[i].fTexs, 100 fRecs[i].fVerts, fRecs[i].fTexs,
101 NULL, NULL, NULL, 0, paint); 101 nullptr, nullptr, nullptr, 0, paint);
102 102
103 canvas->translate(SkIntToScalar(250), 0); 103 canvas->translate(SkIntToScalar(250), 0);
104 104
105 paint.setShader(fShader0); 105 paint.setShader(fShader0);
106 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount, 106 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
107 fRecs[i].fVerts, fRecs[i].fTexs, 107 fRecs[i].fVerts, fRecs[i].fTexs,
108 NULL, NULL, NULL, 0, paint); 108 nullptr, nullptr, nullptr, 0, paint);
109 109
110 canvas->translate(SkIntToScalar(250), 0); 110 canvas->translate(SkIntToScalar(250), 0);
111 111
112 paint.setShader(fShader1); 112 paint.setShader(fShader1);
113 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount, 113 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
114 fRecs[i].fVerts, fRecs[i].fTexs, 114 fRecs[i].fVerts, fRecs[i].fTexs,
115 NULL, NULL, NULL, 0, paint); 115 nullptr, nullptr, nullptr, 0, paint);
116 canvas->restore(); 116 canvas->restore();
117 117
118 canvas->translate(0, SkIntToScalar(250)); 118 canvas->translate(0, SkIntToScalar(250));
119 } 119 }
120 } 120 }
121 121
122 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override { 122 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override {
123 return new Click(this); 123 return new Click(this);
124 } 124 }
125 125
126 bool onClick(Click* click) override { 126 bool onClick(Click* click) override {
127 // fCurrX = click->fICurr.fX; 127 // fCurrX = click->fICurr.fX;
128 // fCurrY = click->fICurr.fY; 128 // fCurrY = click->fICurr.fY;
129 this->inval(NULL); 129 this->inval(nullptr);
130 return true; 130 return true;
131 } 131 }
132 132
133 private: 133 private:
134 struct Rec { 134 struct Rec {
135 SkCanvas::VertexMode fMode; 135 SkCanvas::VertexMode fMode;
136 int fCount; 136 int fCount;
137 SkPoint* fVerts; 137 SkPoint* fVerts;
138 SkPoint* fTexs; 138 SkPoint* fTexs;
139 139
140 Rec() : fCount(0), fVerts(NULL), fTexs(NULL) {} 140 Rec() : fCount(0), fVerts(nullptr), fTexs(nullptr) {}
141 ~Rec() { delete[] fVerts; delete[] fTexs; } 141 ~Rec() { delete[] fVerts; delete[] fTexs; }
142 }; 142 };
143 143
144 void make_tris(Rec* rec) { 144 void make_tris(Rec* rec) {
145 int n = 10; 145 int n = 10;
146 SkRandom rand; 146 SkRandom rand;
147 147
148 rec->fMode = SkCanvas::kTriangles_VertexMode; 148 rec->fMode = SkCanvas::kTriangles_VertexMode;
149 rec->fCount = n * 3; 149 rec->fCount = n * 3;
150 rec->fVerts = new SkPoint[rec->fCount]; 150 rec->fVerts = new SkPoint[rec->fCount];
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 Rec fRecs[3]; 224 Rec fRecs[3];
225 225
226 typedef SampleView INHERITED; 226 typedef SampleView INHERITED;
227 }; 227 };
228 228
229 ////////////////////////////////////////////////////////////////////////////// 229 //////////////////////////////////////////////////////////////////////////////
230 230
231 static SkView* MyFactory() { return new VerticesView; } 231 static SkView* MyFactory() { return new VerticesView; }
232 static SkViewRegister reg(MyFactory); 232 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleUnpremul.cpp ('k') | samplecode/SampleXfermodesBlur.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698