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

Side by Side Diff: samplecode/SampleHT.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/SampleGradients.cpp ('k') | samplecode/SampleHairModes.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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 SkRect fR; 47 SkRect fR;
48 SkColor fColor; 48 SkColor fColor;
49 SkInterpolator* fInterp; 49 SkInterpolator* fInterp;
50 SkMSec fTime; 50 SkMSec fTime;
51 51
52 public: 52 public:
53 HTDrawable(SkRandom& rand) { 53 HTDrawable(SkRandom& rand) {
54 fR = SkRect::MakeXYWH(rand.nextRangeF(0, 640), rand.nextRangeF(0, 480), 54 fR = SkRect::MakeXYWH(rand.nextRangeF(0, 640), rand.nextRangeF(0, 480),
55 rand.nextRangeF(20, 200), rand.nextRangeF(20, 200) ); 55 rand.nextRangeF(20, 200), rand.nextRangeF(20, 200) );
56 fColor = rand_opaque_color(rand.nextU()); 56 fColor = rand_opaque_color(rand.nextU());
57 fInterp = NULL; 57 fInterp = nullptr;
58 fTime = 0; 58 fTime = 0;
59 } 59 }
60 60
61 void spawnAnimation(SkMSec now) { 61 void spawnAnimation(SkMSec now) {
62 this->setTime(now); 62 this->setTime(now);
63 63
64 delete fInterp; 64 delete fInterp;
65 fInterp = new SkInterpolator(5, 3); 65 fInterp = new SkInterpolator(5, 3);
66 SkScalar values[5]; 66 SkScalar values[5];
67 color_to_floats(fColor, values); values[4] = 0; 67 color_to_floats(fColor, values); values[4] = 0;
(...skipping 27 matching lines...) Expand all
95 fColor = floats_to_color(values); 95 fColor = floats_to_color(values);
96 96
97 canvas->save(); 97 canvas->save();
98 canvas->translate(fR.centerX(), fR.centerY()); 98 canvas->translate(fR.centerX(), fR.centerY());
99 canvas->rotate(values[4]); 99 canvas->rotate(values[4]);
100 canvas->translate(-fR.centerX(), -fR.centerY()); 100 canvas->translate(-fR.centerX(), -fR.centerY());
101 101
102 switch (res) { 102 switch (res) {
103 case SkInterpolator::kFreezeEnd_Result: 103 case SkInterpolator::kFreezeEnd_Result:
104 delete fInterp; 104 delete fInterp;
105 fInterp = NULL; 105 fInterp = nullptr;
106 break; 106 break;
107 default: 107 default:
108 break; 108 break;
109 } 109 }
110 } 110 }
111 paint.setColor(fColor); 111 paint.setColor(fColor);
112 canvas->drawRect(fR, paint); 112 canvas->drawRect(fR, paint);
113 } 113 }
114 114
115 SkRect onGetBounds() override { return fR; } 115 SkRect onGetBounds() override { return fR; }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride { 167 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove rride {
168 // search backwards to find the top-most 168 // search backwards to find the top-most
169 for (int i = N - 1; i >= 0; --i) { 169 for (int i = N - 1; i >= 0; --i) {
170 if (fArray[i].fDrawable->hitTest(x, y)) { 170 if (fArray[i].fDrawable->hitTest(x, y)) {
171 fArray[i].fDrawable->spawnAnimation(fTime); 171 fArray[i].fDrawable->spawnAnimation(fTime);
172 break; 172 break;
173 } 173 }
174 } 174 }
175 this->inval(NULL); 175 this->inval(nullptr);
176 return NULL; 176 return nullptr;
177 } 177 }
178 178
179 private: 179 private:
180 typedef SampleView INHERITED; 180 typedef SampleView INHERITED;
181 }; 181 };
182 182
183 ////////////////////////////////////////////////////////////////////////////// 183 //////////////////////////////////////////////////////////////////////////////
184 184
185 static SkView* MyFactory() { return new HTView; } 185 static SkView* MyFactory() { return new HTView; }
186 static SkViewRegister reg(MyFactory); 186 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleGradients.cpp ('k') | samplecode/SampleHairModes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698