diff options
author | mtklein <mtklein@chromium.org> | 2015-08-19 09:51:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-19 09:51:01 -0700 |
commit | c6ad06acefa096716f8dabed5342f9b89dc43dfe (patch) | |
tree | d7f0f880609d4e7876790a846cdbab4702590109 /src/core/SkRecordPattern.h | |
parent | 4b013296bf67df6c8d119a8f5a2b3dd6530c0b6f (diff) |
unsigned -> int for counts and indices in picture-related code
also, (C)
BUG=skia:
Review URL: https://codereview.chromium.org/1300163002
Diffstat (limited to 'src/core/SkRecordPattern.h')
-rw-r--r-- | src/core/SkRecordPattern.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/core/SkRecordPattern.h b/src/core/SkRecordPattern.h index 85c38ac5fe..174665afc3 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 |