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

Unified Diff: src/core/SkRecordPattern.h

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/SkRecordOpts.cpp ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordPattern.h
diff --git a/src/core/SkRecordPattern.h b/src/core/SkRecordPattern.h
index 85c38ac5fe6c3666c1bdb124348d579073d2e00a..174665afc3b287935800b042ef462a4c76adae4a 100644
--- a/src/core/SkRecordPattern.h
+++ b/src/core/SkRecordPattern.h
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#ifndef SkRecordPattern_DEFINED
#define SkRecordPattern_DEFINED
@@ -109,14 +116,14 @@ class Cons {
public:
// If this pattern matches the SkRecord starting at i,
// return the index just past the end of the pattern, otherwise return 0.
- SK_ALWAYS_INLINE unsigned match(SkRecord* record, unsigned i) {
+ SK_ALWAYS_INLINE int match(SkRecord* record, int i) {
i = this->matchHead(&fHead, record, i);
return i == 0 ? 0 : fTail.match(record, i);
}
// Starting from *end, walk through the SkRecord to find the first span matching this pattern.
// If there is no such span, return false. If there is, return true and set [*begin, *end).
- SK_ALWAYS_INLINE bool search(SkRecord* record, unsigned* begin, unsigned* end) {
+ SK_ALWAYS_INLINE bool search(SkRecord* record, int* begin, int* end) {
for (*begin = *end; *begin < record->count(); ++(*begin)) {
*end = this->match(record, *begin);
if (*end != 0) {
@@ -137,7 +144,7 @@ public:
private:
// If head isn't a Star, try to match at i once.
template <typename T>
- unsigned matchHead(T*, SkRecord* record, unsigned i) {
+ int matchHead(T*, SkRecord* record, int i) {
if (i < record->count()) {
if (record->mutate<bool>(i, fHead)) {
return i+1;
@@ -148,7 +155,7 @@ private:
// If head is a Star, walk i until it doesn't match.
template <typename T>
- unsigned matchHead(Star<T>*, SkRecord* record, unsigned i) {
+ int matchHead(Star<T>*, SkRecord* record, int i) {
while (i < record->count()) {
if (!record->mutate<bool>(i, fHead)) {
return i;
@@ -168,7 +175,7 @@ private:
// Nil is the end of every pattern Cons chain.
struct Nil {
// Bottoms out recursion down the fTail chain. Just return whatever i the front decided on.
- unsigned match(SkRecord*, unsigned i) { return i; }
+ int match(SkRecord*, int i) { return i; }
};
// These Pattern# types are syntax sugar over Cons and Nil, just to help eliminate some of the
« no previous file with comments | « src/core/SkRecordOpts.cpp ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698