| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 operand[0].fS32 > 0 ? SK_MaxS32 : -SK_MaxS32; | 242 operand[0].fS32 > 0 ? SK_MaxS32 : -SK_MaxS32; |
| 243 else | 243 else |
| 244 if (operand[1].fS32 != 0) // throw error on divide by zero? | 244 if (operand[1].fS32 != 0) // throw error on divide by zero? |
| 245 operand[0].fS32 /= operand[1].fS32; | 245 operand[0].fS32 /= operand[1].fS32; |
| 246 break; | 246 break; |
| 247 case SkScriptEngine2::kDivideScalar: | 247 case SkScriptEngine2::kDivideScalar: |
| 248 if (operand[1].fScalar == 0) | 248 if (operand[1].fScalar == 0) |
| 249 operand[0].fScalar = operand[0].fScalar == 0 ? SK_ScalarNaN : | 249 operand[0].fScalar = operand[0].fScalar == 0 ? SK_ScalarNaN : |
| 250 operand[0].fScalar > 0 ? SK_ScalarMax : -SK_ScalarMax; | 250 operand[0].fScalar > 0 ? SK_ScalarMax : -SK_ScalarMax; |
| 251 else | 251 else |
| 252 operand[0].fScalar = operand[0].fScalar / operand[1].fScalar; | 252 operand[0].fScalar = SkScalarDiv(operand[0].fScalar, operand[1].
fScalar); |
| 253 break; | 253 break; |
| 254 case SkScriptEngine2::kEqualInt: | 254 case SkScriptEngine2::kEqualInt: |
| 255 operand[0].fS32 = operand[0].fS32 == operand[1].fS32; | 255 operand[0].fS32 = operand[0].fS32 == operand[1].fS32; |
| 256 break; | 256 break; |
| 257 case SkScriptEngine2::kEqualScalar: | 257 case SkScriptEngine2::kEqualScalar: |
| 258 operand[0].fS32 = operand[0].fScalar == operand[1].fScalar; | 258 operand[0].fS32 = operand[0].fScalar == operand[1].fScalar; |
| 259 break; | 259 break; |
| 260 case SkScriptEngine2::kEqualString: | 260 case SkScriptEngine2::kEqualString: |
| 261 operand[0].fS32 = *operand[0].fString == *operand[1].fString; | 261 operand[0].fS32 = *operand[0].fString == *operand[1].fString; |
| 262 break; | 262 break; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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] = NULL; |
| 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] = NULL; |
| 351 } | 351 } |
| OLD | NEW |