OLD | NEW |
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 "SkScriptRuntime.h" | 8 #include "SkScriptRuntime.h" |
9 #include "SkScript2.h" | 9 #include "SkScript2.h" |
10 #include "SkMath.h" | 10 #include "SkMath.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 strPtr->appendS32(operand[op - SkScriptEngine2::kIntToString].fS
32); | 193 strPtr->appendS32(operand[op - SkScriptEngine2::kIntToString].fS
32); |
194 else | 194 else |
195 strPtr->appendScalar(operand[op - SkScriptEngine2::kScalarToStri
ng].fScalar); | 195 strPtr->appendScalar(operand[op - SkScriptEngine2::kScalarToStri
ng].fScalar); |
196 operand[0].fString = strPtr; | 196 operand[0].fString = strPtr; |
197 } break; | 197 } break; |
198 case SkScriptEngine2::kIntToScalar: | 198 case SkScriptEngine2::kIntToScalar: |
199 case SkScriptEngine2::kIntToScalar2: | 199 case SkScriptEngine2::kIntToScalar2: |
200 operand[0].fScalar = SkScriptEngine2::IntToScalar(operand[op - SkScr
iptEngine2::kIntToScalar].fS32); | 200 operand[0].fScalar = SkScriptEngine2::IntToScalar(operand[op - SkScr
iptEngine2::kIntToScalar].fS32); |
201 break; | 201 break; |
202 case SkScriptEngine2::kStringToInt: | 202 case SkScriptEngine2::kStringToInt: |
203 if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32)
== NULL) | 203 if (SkParse::FindS32(operand[0].fString->c_str(), &operand[0].fS32)
== nullptr) |
204 return false; | 204 return false; |
205 break; | 205 break; |
206 case SkScriptEngine2::kStringToScalar: | 206 case SkScriptEngine2::kStringToScalar: |
207 case SkScriptEngine2::kStringToScalar2: | 207 case SkScriptEngine2::kStringToScalar2: |
208 if (SkParse::FindScalar(operand[0].fString->c_str(), | 208 if (SkParse::FindScalar(operand[0].fString->c_str(), |
209 &operand[op - SkScriptEngine2::kStringToScalar].fScalar) ==
NULL) | 209 &operand[op - SkScriptEngine2::kStringToScalar].fScalar) ==
nullptr) |
210 return false; | 210 return false; |
211 break; | 211 break; |
212 case SkScriptEngine2::kScalarToInt: | 212 case SkScriptEngine2::kScalarToInt: |
213 operand[0].fS32 = SkScalarFloorToInt(operand[0].fScalar); | 213 operand[0].fS32 = SkScalarFloorToInt(operand[0].fScalar); |
214 break; | 214 break; |
215 // arithmetic ops | 215 // arithmetic ops |
216 case SkScriptEngine2::kAddInt: | 216 case SkScriptEngine2::kAddInt: |
217 operand[0].fS32 += operand[1].fS32; | 217 operand[0].fS32 += operand[1].fS32; |
218 break; | 218 break; |
219 case SkScriptEngine2::kAddScalar: | 219 case SkScriptEngine2::kAddScalar: |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 334 } |
335 | 335 |
336 void SkScriptRuntime::track(SkString* string) { | 336 void SkScriptRuntime::track(SkString* string) { |
337 SkASSERT(fTrackString.find(string) < 0); | 337 SkASSERT(fTrackString.find(string) < 0); |
338 *fTrackString.append() = string; | 338 *fTrackString.append() = string; |
339 } | 339 } |
340 | 340 |
341 void SkScriptRuntime::untrack(SkOpArray* array) { | 341 void SkScriptRuntime::untrack(SkOpArray* array) { |
342 int index = fTrackArray.find(array); | 342 int index = fTrackArray.find(array); |
343 SkASSERT(index >= 0); | 343 SkASSERT(index >= 0); |
344 fTrackArray.begin()[index] = NULL; | 344 fTrackArray.begin()[index] = nullptr; |
345 } | 345 } |
346 | 346 |
347 void SkScriptRuntime::untrack(SkString* string) { | 347 void SkScriptRuntime::untrack(SkString* string) { |
348 int index = fTrackString.find(string); | 348 int index = fTrackString.find(string); |
349 SkASSERT(index >= 0); | 349 SkASSERT(index >= 0); |
350 fTrackString.begin()[index] = NULL; | 350 fTrackString.begin()[index] = nullptr; |
351 } | 351 } |
OLD | NEW |