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

Side by Side Diff: src/animator/SkAnimateActive.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 | « site/user/api/skpaint.md ('k') | src/animator/SkAnimateBase.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 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 8
9 9
10 #include "SkAnimateActive.h" 10 #include "SkAnimateActive.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 switch (state.fMode) { 145 switch (state.fMode) {
146 case SkApply::kMode_immediate: 146 case SkApply::kMode_immediate:
147 case SkApply::kMode_create: 147 case SkApply::kMode_create:
148 duration = state.fSteps ? state.fSteps * SK_MSec1 : 1; 148 duration = state.fSteps ? state.fSteps * SK_MSec1 : 1;
149 break; 149 break;
150 // case SkApply::kMode_hold: { 150 // case SkApply::kMode_hold: {
151 // int entries = animate->entries(); 151 // int entries = animate->entries();
152 // SkScriptValue value; 152 // SkScriptValue value;
153 // value.fOperand = animate->getValues()[entries - 1]; 153 // value.fOperand = animate->getValues()[entries - 1];
154 // value.fType = animate->getValuesType(); 154 // value.fType = animate->getValuesType();
155 // bool result = SkScriptEngine::ConvertTo(NULL, SkType_Int, &value); 155 // bool result = SkScriptEngine::ConvertTo(nullptr, SkType_Int, &value);
156 // SkASSERT(result); 156 // SkASSERT(result);
157 // duration = value.fOperand.fS32 * SK_MSec1; 157 // duration = value.fOperand.fS32 * SK_MSec1;
158 // break; 158 // break;
159 // } 159 // }
160 } 160 }
161 state.fDuration = duration; 161 state.fDuration = duration;
162 SkMSec maxTime = state.fBegin + duration; 162 SkMSec maxTime = state.fBegin + duration;
163 if (fMaxTime < maxTime) 163 if (fMaxTime < maxTime)
164 fMaxTime = maxTime; 164 fMaxTime = maxTime;
165 } 165 }
166 166
167 void SkActive::create(SkADrawable* drawable, SkMSec time) { 167 void SkActive::create(SkADrawable* drawable, SkMSec time) {
168 fApply.fLastTime = time; 168 fApply.fLastTime = time;
169 fApply.refresh(fMaker); 169 fApply.refresh(fMaker);
170 for (int index = 0; index < fAnimators.count(); index++) { 170 for (int index = 0; index < fAnimators.count(); index++) {
171 SkAnimateBase* animate = fAnimators[index]; 171 SkAnimateBase* animate = fAnimators[index];
172 SkOperandInterpolator& interpolator = *fInterpolators[index]; 172 SkOperandInterpolator& interpolator = *fInterpolators[index];
173 int count = animate->components(); 173 int count = animate->components();
174 if (animate->formula.size() > 0) { 174 if (animate->formula.size() > 0) {
175 SkTDOperandArray values; 175 SkTDOperandArray values;
176 values.setCount(count); 176 values.setCount(count);
177 SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, & values, 0, 0, NULL, 177 SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMaker, & values, 0, 0, nullptr,
178 animate->getValuesType(), animate->formula); 178 animate->getValuesType(), animate->formula);
179 SkASSERT(success); 179 SkASSERT(success);
180 fApply.applyValues(index, values.begin(), count, animate->getValuesT ype(), time); 180 fApply.applyValues(index, values.begin(), count, animate->getValuesT ype(), time);
181 } else { 181 } else {
182 SkAutoSTMalloc<16, SkOperand> values(count); 182 SkAutoSTMalloc<16, SkOperand> values(count);
183 interpolator.timeToValues(time, values.get()); 183 interpolator.timeToValues(time, values.get());
184 fApply.applyValues(index, values.get(), count, animate->getValuesTyp e(), time); 184 fApply.applyValues(index, values.get(), count, animate->getValuesTyp e(), time);
185 } 185 }
186 } 186 }
187 drawable->enable(fMaker); 187 drawable->enable(fMaker);
(...skipping 17 matching lines...) Expand all
205 if (state.fBegin > time) 205 if (state.fBegin > time)
206 continue; 206 continue;
207 if (time > state.fBegin + state.fDuration) 207 if (time > state.fBegin + state.fDuration)
208 continue; 208 continue;
209 applied = true; 209 applied = true;
210 SkOperandInterpolator& interpolator = *fInterpolators[index]; 210 SkOperandInterpolator& interpolator = *fInterpolators[index];
211 int count = animate->components(); 211 int count = animate->components();
212 if (animate->formula.size() > 0) { 212 if (animate->formula.size() > 0) {
213 SkTDOperandArray values; 213 SkTDOperandArray values;
214 values.setCount(count); 214 values.setCount(count);
215 SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMake r, &values, 0, 0, NULL, 215 SkDEBUGCODE(bool success = ) animate->fFieldInfo->setValue(fMake r, &values, 0, 0, nullptr,
216 animate->getValuesType(), animate->formula); 216 animate->getValuesType(), animate->formula);
217 SkASSERT(success); 217 SkASSERT(success);
218 fApply.applyValues(index, values.begin(), count, animate->getVal uesType(), time); 218 fApply.applyValues(index, values.begin(), count, animate->getVal uesType(), time);
219 } else { 219 } else {
220 SkAutoSTMalloc<16, SkOperand> values(count); 220 SkAutoSTMalloc<16, SkOperand> values(count);
221 interpolator.timeToValues(time, values.get()); 221 interpolator.timeToValues(time, values.get());
222 fApply.applyValues(index, values.get(), count, animate->getValue sType(), time); 222 fApply.applyValues(index, values.get(), count, animate->getValue sType(), time);
223 } 223 }
224 } 224 }
225 if (enable) 225 if (enable)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 void SkActive::saveInterpolatorValues(int index) { 361 void SkActive::saveInterpolatorValues(int index) {
362 SkOperandInterpolator& interpolator = *fInterpolators[index]; 362 SkOperandInterpolator& interpolator = *fInterpolators[index];
363 index += fDrawIndex ; 363 index += fDrawIndex ;
364 int count = interpolator.getValuesCount(); 364 int count = interpolator.getValuesCount();
365 SkOperand* cache = new SkOperand[count]; // this should use sk_malloc/sk_ free since SkOperand does not have a constructor/destructor 365 SkOperand* cache = new SkOperand[count]; // this should use sk_malloc/sk_ free since SkOperand does not have a constructor/destructor
366 fSaveInterpolators[index] = cache; 366 fSaveInterpolators[index] = cache;
367 memcpy(cache, interpolator.getValues(), count * sizeof(SkOperand)); 367 memcpy(cache, interpolator.getValues(), count * sizeof(SkOperand));
368 } 368 }
369 369
370 void SkActive::setInterpolator(int index, SkOperand* from) { 370 void SkActive::setInterpolator(int index, SkOperand* from) {
371 if (from == NULL) // legitimate for set string 371 if (from == nullptr) // legitimate for set string
372 return; 372 return;
373 SkAnimateBase* animate = fAnimators[index]; 373 SkAnimateBase* animate = fAnimators[index];
374 int entries = animate->entries(); 374 int entries = animate->entries();
375 SkASSERT(entries > 0); 375 SkASSERT(entries > 0);
376 SkMSec duration = fState[index].fDuration; 376 SkMSec duration = fState[index].fDuration;
377 int components = animate->components(); 377 int components = animate->components();
378 SkOperandInterpolator& interpolator = *fInterpolators[index]; 378 SkOperandInterpolator& interpolator = *fInterpolators[index];
379 interpolator.reset(components, entries == 1 ? 2 : entries, animate->getValue sType()); 379 interpolator.reset(components, entries == 1 ? 2 : entries, animate->getValue sType());
380 interpolator.setMirror(SkToBool(animate->fMirror)); 380 interpolator.setMirror(SkToBool(animate->fMirror));
381 interpolator.setReset(SkToBool(animate->fReset)); 381 interpolator.setReset(SkToBool(animate->fReset));
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // result = fSave; 495 // result = fSave;
496 // else 496 // else
497 if (fTransition == SkApply::kTransition_reverse) { 497 if (fTransition == SkApply::kTransition_reverse) {
498 if (SkMSec_LT(fDuration, time)) 498 if (SkMSec_LT(fDuration, time))
499 result = 0; 499 result = 0;
500 else 500 else
501 result = fDuration - time; 501 result = fDuration - time;
502 } 502 }
503 return result; 503 return result;
504 } 504 }
OLDNEW
« no previous file with comments | « site/user/api/skpaint.md ('k') | src/animator/SkAnimateBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698