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

Unified Diff: src/core/SkRecordOpts.cpp

Issue 1300163002: unsigned -> int for counts and indices in picture-related code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecordPattern.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordOpts.cpp
diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp
index 83512926da7f30e28207943185c56152a474a041..07aac3e4674f43000bd268ba51ec267b324c7984 100644
--- a/src/core/SkRecordOpts.cpp
+++ b/src/core/SkRecordOpts.cpp
@@ -26,7 +26,7 @@ void SkRecordOptimize(SkRecord* record) {
// Most of the optimizations in this file are pattern-based. These are all defined as structs with:
// - a Pattern typedef
-// - a bool onMatch(SkRceord*, Pattern*, unsigned begin, unsigned end) method,
+// - a bool onMatch(SkRceord*, Pattern*, int begin, int end) method,
// which returns true if it made changes and false if not.
// Run a pattern-based optimization once across the SkRecord, returning true if it made any changes.
@@ -36,7 +36,7 @@ template <typename Pass>
static bool apply(Pass* pass, SkRecord* record) {
typename Pass::Pattern pattern;
bool changed = false;
- unsigned begin, end = 0;
+ int begin, end = 0;
while (pattern.search(record, &begin, &end)) {
changed |= pass->onMatch(record, &pattern, begin, end);
@@ -51,7 +51,7 @@ struct SaveOnlyDrawsRestoreNooper {
Is<Restore> >
Pattern;
- bool onMatch(SkRecord* record, Pattern* pattern, unsigned begin, unsigned end) {
+ bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
record->replace<NoOp>(begin); // Save
record->replace<NoOp>(end-1); // Restore
return true;
@@ -127,9 +127,9 @@ struct SaveNoDrawsRestoreNooper {
Is<Restore> >
Pattern;
- bool onMatch(SkRecord* record, Pattern* pattern, unsigned begin, unsigned end) {
+ bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
// The entire span between Save and Restore (inclusively) does nothing.
- for (unsigned i = begin; i < end; i++) {
+ for (int i = begin; i < end; i++) {
record->replace<NoOp>(i);
}
return true;
@@ -148,7 +148,7 @@ void SkRecordNoopSaveRestores(SkRecord* record) {
struct SaveLayerDrawRestoreNooper {
typedef Pattern3<Is<SaveLayer>, IsDraw, Is<Restore> > Pattern;
- bool onMatch(SkRecord* record, Pattern* pattern, unsigned begin, unsigned end) {
+ bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
// A SaveLayer's bounds field is just a hint, so we should be free to ignore it.
SkPaint* layerPaint = pattern->first<SaveLayer>()->paint;
if (NULL == layerPaint) {
@@ -170,7 +170,7 @@ struct SaveLayerDrawRestoreNooper {
return KillSaveLayerAndRestore(record, begin);
}
- static bool KillSaveLayerAndRestore(SkRecord* record, unsigned saveLayerIndex) {
+ static bool KillSaveLayerAndRestore(SkRecord* record, int saveLayerIndex) {
record->replace<NoOp>(saveLayerIndex); // SaveLayer
record->replace<NoOp>(saveLayerIndex+2); // Restore
return true;
@@ -195,7 +195,7 @@ struct SvgOpacityAndFilterLayerMergePass {
typedef Pattern7<Is<SaveLayer>, Is<Save>, Is<ClipRect>, Is<SaveLayer>,
Is<Restore>, Is<Restore>, Is<Restore> > Pattern;
- bool onMatch(SkRecord* record, Pattern* pattern, unsigned begin, unsigned end) {
+ bool onMatch(SkRecord* record, Pattern* pattern, int begin, int end) {
SkPaint* opacityPaint = pattern->first<SaveLayer>()->paint;
if (NULL == opacityPaint) {
// There wasn't really any point to this SaveLayer at all.
@@ -219,7 +219,7 @@ struct SvgOpacityAndFilterLayerMergePass {
return KillSaveLayerAndRestore(record, begin);
}
- static bool KillSaveLayerAndRestore(SkRecord* record, unsigned saveLayerIndex) {
+ static bool KillSaveLayerAndRestore(SkRecord* record, int saveLayerIndex) {
record->replace<NoOp>(saveLayerIndex); // SaveLayer
record->replace<NoOp>(saveLayerIndex + 6); // Restore
return true;
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecordPattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698