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

Side by Side Diff: samplecode/SampleHT.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 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/SampleArc.cpp ('k') | samplecode/SampleIdentityScale.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = NULL;
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 SkDELETE(fInterp); 64 delete fInterp;
65 fInterp = SkNEW_ARGS(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;
68 fInterp->setKeyFrame(0, now, values); 68 fInterp->setKeyFrame(0, now, values);
69 values[0] = 0; values[4] = 180; 69 values[0] = 0; values[4] = 180;
70 fInterp->setKeyFrame(1, now + 1000, values); 70 fInterp->setKeyFrame(1, now + 1000, values);
71 color_to_floats(rand_opaque_color(fColor), values); values[4] = 360; 71 color_to_floats(rand_opaque_color(fColor), values); values[4] = 360;
72 fInterp->setKeyFrame(2, now + 2000, values); 72 fInterp->setKeyFrame(2, now + 2000, values);
73 73
74 fInterp->setMirror(true); 74 fInterp->setMirror(true);
75 fInterp->setRepeatCount(3); 75 fInterp->setRepeatCount(3);
(...skipping 18 matching lines...) Expand all
94 SkInterpolator::Result res = fInterp->timeToValues(fTime, values); 94 SkInterpolator::Result res = fInterp->timeToValues(fTime, values);
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 SkDELETE(fInterp); 104 delete fInterp;
105 fInterp = NULL; 105 fInterp = NULL;
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
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/SampleArc.cpp ('k') | samplecode/SampleIdentityScale.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698