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: src/animator/SkScriptTokenizer.cpp

Issue 117053002: remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
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 "SkScript2.h" 8 #include "SkScript2.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkFloatingPoint.h" 10 #include "SkFloatingPoint.h"
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 SkASSERT(0); 1267 SkASSERT(0);
1268 return false; 1268 return false;
1269 } 1269 }
1270 return true; // no error 1270 return true; // no error
1271 } 1271 }
1272 1272
1273 #ifdef SK_DEBUG 1273 #ifdef SK_DEBUG
1274 #if defined(SK_SUPPORT_UNITTEST) 1274 #if defined(SK_SUPPORT_UNITTEST)
1275 1275
1276 #define testInt(expression) { #expression, SkOperand2::kS32, expression, 0, NULL } 1276 #define testInt(expression) { #expression, SkOperand2::kS32, expression, 0, NULL }
1277 #ifdef SK_SCALAR_IS_FLOAT
1278 #define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) (e xpression), NULL } 1277 #define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) (e xpression), NULL }
1279 #define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmo df((float) exp1, (float) exp2), NULL } 1278 #define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmo df((float) exp1, (float) exp2), NULL }
1280 #else
1281 #define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (int) ((ex pression) * 65536.0f), NULL }
1282 #define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, (in t) (fmod(exp1, exp2) * 65536.0f), NULL }
1283 #endif
1284 #define testTrue(expression) { #expression, SkOperand2::kS32, 1, 0, NULL } 1279 #define testTrue(expression) { #expression, SkOperand2::kS32, 1, 0, NULL }
1285 #define testFalse(expression) { #expression, SkOperand2::kS32, 0, 0, NULL } 1280 #define testFalse(expression) { #expression, SkOperand2::kS32, 0, 0, NULL }
1286 1281
1287 static const SkScriptNAnswer2 scriptTests[] = { 1282 static const SkScriptNAnswer2 scriptTests[] = {
1288 testInt(1||(0&&3)), 1283 testInt(1||(0&&3)),
1289 testScalar(- -5.5- -1.5), 1284 testScalar(- -5.5- -1.5),
1290 testScalar(1.0+5), 1285 testScalar(1.0+5),
1291 testInt((6+7)*8), 1286 testInt((6+7)*8),
1292 testInt(3*(4+5)), 1287 testInt(3*(4+5)),
1293 testScalar(1.0+2.0), 1288 testScalar(1.0+2.0),
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 case SkOperand2::kString: 1497 case SkOperand2::kString:
1503 SkASSERT(value.fOperand.fString->equals(scriptTests[index].fStri ngAnswer)); 1498 SkASSERT(value.fOperand.fString->equals(scriptTests[index].fStri ngAnswer));
1504 break; 1499 break;
1505 default: 1500 default:
1506 SkASSERT(0); 1501 SkASSERT(0);
1507 } 1502 }
1508 } 1503 }
1509 #endif // SK_SUPPORT_UNITTEST 1504 #endif // SK_SUPPORT_UNITTEST
1510 } 1505 }
1511 #endif // SK_DEBUG 1506 #endif // SK_DEBUG
OLDNEW
« no previous file with comments | « src/animator/SkScript.cpp ('k') | src/core/SkCanvas.cpp » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698