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

Side by Side Diff: src/animator/SkScriptTokenizer.cpp

Issue 265163003: fix size_t/int warnings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 | « src/animator/SkScript2.h ('k') | no next file » | 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 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 void SkScriptEngine2::addTokenInt(int integer) { 164 void SkScriptEngine2::addTokenInt(int integer) {
165 fActiveStream->write(&integer, sizeof(integer)); 165 fActiveStream->write(&integer, sizeof(integer));
166 } 166 }
167 167
168 void SkScriptEngine2::addTokenScalar(SkScalar scalar) { 168 void SkScriptEngine2::addTokenScalar(SkScalar scalar) {
169 fActiveStream->write(&scalar, sizeof(scalar)); 169 fActiveStream->write(&scalar, sizeof(scalar));
170 } 170 }
171 171
172 void SkScriptEngine2::addTokenString(const SkString& string) { 172 void SkScriptEngine2::addTokenString(const SkString& string) {
173 int size = string.size(); 173 int size = SkToInt(string.size());
174 addTokenInt(size); 174 addTokenInt(size);
175 fActiveStream->write(string.c_str(), size); 175 fActiveStream->write(string.c_str(), size);
176 } 176 }
177 177
178 void SkScriptEngine2::addTokenValue(const SkScriptValue2& value, AddTokenRegiste r reg) { 178 void SkScriptEngine2::addTokenValue(const SkScriptValue2& value, AddTokenRegiste r reg) {
179 if (value.isConstant() == false) { 179 if (value.isConstant() == false) {
180 if (reg == kAccumulator) { 180 if (reg == kAccumulator) {
181 if (fAccumulatorType == SkOperand2::kNoType) 181 if (fAccumulatorType == SkOperand2::kNoType)
182 addToken(kAccumulatorPop); 182 addToken(kAccumulatorPop);
183 } else { 183 } else {
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 addTokenValue(fValueStack.top(), kAccumulator); 1016 addTokenValue(fValueStack.top(), kAccumulator);
1017 fValueStack.pop(); 1017 fValueStack.pop();
1018 addToken(kElseOp); 1018 addToken(kElseOp);
1019 size_t newOffset = getTokenOffset(); 1019 size_t newOffset = getTokenOffset();
1020 addTokenInt(0); // placeholder for future branch 1020 addTokenInt(0); // placeholder for future branch
1021 Branch& branch = fBranchStack.top(); 1021 Branch& branch = fBranchStack.top();
1022 resolveBranch(branch); 1022 resolveBranch(branch);
1023 branch.fOperator = op; 1023 branch.fOperator = op;
1024 branch.fDone = Branch::kIsNotDone; 1024 branch.fDone = Branch::kIsNotDone;
1025 SkASSERT(branch.fOpStackDepth == fOpStack.count()); 1025 SkASSERT(branch.fOpStackDepth == fOpStack.count());
1026 branch.fOffset = newOffset; 1026 branch.fOffset = SkToU16(newOffset);
1027 fAccumulatorType = SkOperand2::kNoType; 1027 fAccumulatorType = SkOperand2::kNoType;
1028 } break; 1028 } break;
1029 case kLogicalAnd: 1029 case kLogicalAnd:
1030 case kLogicalOr: { 1030 case kLogicalOr: {
1031 Branch& oldTop = fBranchStack.top(); 1031 Branch& oldTop = fBranchStack.top();
1032 Branch::Primed wasPrime = oldTop.fPrimed; 1032 Branch::Primed wasPrime = oldTop.fPrimed;
1033 Branch::Done wasDone = oldTop.fDone; 1033 Branch::Done wasDone = oldTop.fDone;
1034 oldTop.fPrimed = Branch::kIsNotPrimed; 1034 oldTop.fPrimed = Branch::kIsNotPrimed;
1035 oldTop.fDone = Branch::kIsNotDone; 1035 oldTop.fDone = Branch::kIsNotDone;
1036 if (fAccumulatorType == SkOperand2::kNoType) { 1036 if (fAccumulatorType == SkOperand2::kNoType) {
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 case SkOperand2::kString: 1497 case SkOperand2::kString:
1498 SkASSERT(value.fOperand.fString->equals(scriptTests[index].fStri ngAnswer)); 1498 SkASSERT(value.fOperand.fString->equals(scriptTests[index].fStri ngAnswer));
1499 break; 1499 break;
1500 default: 1500 default:
1501 SkASSERT(0); 1501 SkASSERT(0);
1502 } 1502 }
1503 } 1503 }
1504 #endif // SK_SUPPORT_UNITTEST 1504 #endif // SK_SUPPORT_UNITTEST
1505 } 1505 }
1506 #endif // SK_DEBUG 1506 #endif // SK_DEBUG
OLDNEW
« no previous file with comments | « src/animator/SkScript2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698