unsigned -> int for counts and indices in picture-related code

also, (C)

BUG=skia:

Review URL: https://codereview.chromium.org/1300163002
diff --git a/bench/RTreeBench.cpp b/bench/RTreeBench.cpp
index 6f76bd1..3b3dc72 100644
--- a/bench/RTreeBench.cpp
+++ b/bench/RTreeBench.cpp
@@ -79,7 +79,7 @@
     void onDraw(const int loops, SkCanvas* canvas) override {
         SkRandom rand;
         for (int i = 0; i < loops; ++i) {
-            SkTDArray<unsigned> hits;
+            SkTDArray<int> hits;
             SkRect query;
             query.fLeft   = rand.nextRangeF(0, GENERATE_EXTENTS);
             query.fTop    = rand.nextRangeF(0, GENERATE_EXTENTS);
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 5b2ccc8..a7240b8 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1060,7 +1060,7 @@
             macroCanvas,
             drawables ? *drawables : empty,
         };
-        for (unsigned i = 0; i < skr.count(); i++) {
+        for (int i = 0; i < skr.count(); i++) {
             skr.visit<void>(i, drawsAsSingletonPictures);
         }
         SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
diff --git a/src/core/SkBBoxHierarchy.h b/src/core/SkBBoxHierarchy.h
index 69fb4fd..795406f 100644
--- a/src/core/SkBBoxHierarchy.h
+++ b/src/core/SkBBoxHierarchy.h
@@ -30,14 +30,14 @@
     /**
      * Populate results with the indices of bounding boxes interesecting that query.
      */
-    virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const = 0;
+    virtual void search(const SkRect& query, SkTDArray<int>* results) const = 0;
 
     virtual size_t bytesUsed() const = 0;
 
     // Get the root bound.
     virtual SkRect getRootBound() const = 0;
 
-    
+
 private:
     typedef SkRefCnt INHERITED;
 };
diff --git a/src/core/SkBigPicture.cpp b/src/core/SkBigPicture.cpp
index 6609586..bbe9882 100644
--- a/src/core/SkBigPicture.cpp
+++ b/src/core/SkBigPicture.cpp
@@ -43,8 +43,8 @@
 }
 
 void SkBigPicture::partialPlayback(SkCanvas* canvas,
-                                   unsigned start,
-                                   unsigned stop,
+                                   int start,
+                                   int stop,
                                    const SkMatrix& initialCTM) const {
     SkASSERT(canvas);
     SkRecordPartialDraw(*fRecord,
@@ -86,7 +86,7 @@
     SkPathCounter  path;
 
     bool hasText = false, hasBitmap = false;
-    for (unsigned i = 0; i < record.count(); i++) {
+    for (int i = 0; i < record.count(); i++) {
         hasText   = hasText   || record.visit<bool>(i,   text);
         hasBitmap = hasBitmap || record.visit<bool>(i, bitmap);
         record.visit<void>(i, path);
diff --git a/src/core/SkBigPicture.h b/src/core/SkBigPicture.h
index 14e413b..b7da09e 100644
--- a/src/core/SkBigPicture.h
+++ b/src/core/SkBigPicture.h
@@ -52,8 +52,8 @@
 
 // Used by GrLayerHoister
     void partialPlayback(SkCanvas*,
-                         unsigned start,
-                         unsigned stop,
+                         int start,
+                         int stop,
                          const SkMatrix& initialCTM) const;
 // Used by GrRecordReplaceDraw
     const SkBBoxHierarchy* bbh() const { return fBBH; }
diff --git a/src/core/SkLayerInfo.h b/src/core/SkLayerInfo.h
index 3d4b269..54c4f7b 100644
--- a/src/core/SkLayerInfo.h
+++ b/src/core/SkLayerInfo.h
@@ -56,8 +56,8 @@
         // The variable length key for this saveLayer block. It stores the
         // thread of drawPicture and saveLayer operation indices that lead to this
         // saveLayer (including its own op index). The BlockInfo owns this memory.
-        unsigned* fKey;
-        int     fKeySize;  // # of ints
+        int* fKey;
+        int  fKeySize;  // # of ints
     };
 
     SkLayerInfo() {}
diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp
index 2fded6f..bae2fdc 100644
--- a/src/core/SkRTree.cpp
+++ b/src/core/SkRTree.cpp
@@ -161,13 +161,13 @@
     return this->bulkLoad(branches, level + 1);
 }
 
-void SkRTree::search(const SkRect& query, SkTDArray<unsigned>* results) const {
+void SkRTree::search(const SkRect& query, SkTDArray<int>* results) const {
     if (fCount > 0 && SkRect::Intersects(fRoot.fBounds, query)) {
         this->search(fRoot.fSubtree, query, results);
     }
 }
 
-void SkRTree::search(Node* node, const SkRect& query, SkTDArray<unsigned>* results) const {
+void SkRTree::search(Node* node, const SkRect& query, SkTDArray<int>* results) const {
     for (int i = 0; i < node->fNumChildren; ++i) {
         if (SkRect::Intersects(node->fChildren[i].fBounds, query)) {
             if (0 == node->fLevel) {
diff --git a/src/core/SkRTree.h b/src/core/SkRTree.h
index 205c0b6..5578171 100644
--- a/src/core/SkRTree.h
+++ b/src/core/SkRTree.h
@@ -31,7 +31,7 @@
  */
 class SkRTree : public SkBBoxHierarchy {
 public:
-    
+
 
     /**
      * If you have some prior information about the distribution of bounds you're expecting, you
@@ -42,7 +42,7 @@
     virtual ~SkRTree() {}
 
     void insert(const SkRect[], int N) override;
-    void search(const SkRect& query, SkTDArray<unsigned>* results) const override;
+    void search(const SkRect& query, SkTDArray<int>* results) const override;
     size_t bytesUsed() const override;
 
     // Methods and constants below here are only public for tests.
@@ -65,7 +65,7 @@
     struct Branch {
         union {
             Node* fSubtree;
-            unsigned fOpIndex;
+            int fOpIndex;
         };
         SkRect fBounds;
     };
@@ -76,7 +76,7 @@
         Branch fChildren[kMaxChildren];
     };
 
-    void search(Node* root, const SkRect& query, SkTDArray<unsigned>* results) const;
+    void search(Node* root, const SkRect& query, SkTDArray<int>* results) const;
 
     // Consumes the input array.
     Branch bulkLoad(SkTDArray<Branch>* branches, int level = 0);
diff --git a/src/core/SkRecord.cpp b/src/core/SkRecord.cpp
index 349fbf6..2d2fa58 100644
--- a/src/core/SkRecord.cpp
+++ b/src/core/SkRecord.cpp
@@ -9,7 +9,7 @@
 
 SkRecord::~SkRecord() {
     Destroyer destroyer;
-    for (unsigned i = 0; i < this->count(); i++) {
+    for (int i = 0; i < this->count(); i++) {
         this->mutate<void>(i, destroyer);
     }
 }
diff --git a/src/core/SkRecord.h b/src/core/SkRecord.h
index 0fe316e..9672bbc 100644
--- a/src/core/SkRecord.h
+++ b/src/core/SkRecord.h
@@ -40,14 +40,14 @@
     ~SkRecord();
 
     // Returns the number of canvas commands in this SkRecord.
-    unsigned count() const { return fCount; }
+    int count() const { return fCount; }
 
     // Visit the i-th canvas command with a functor matching this interface:
     //   template <typename T>
     //   R operator()(const T& record) { ... }
     // This operator() must be defined for at least all SkRecords::*.
     template <typename R, typename F>
-    R visit(unsigned i, F& f) const {
+    R visit(int i, F& f) const {
         SkASSERT(i < this->count());
         return fRecords[i].visit<R>(f);
     }
@@ -57,7 +57,7 @@
     //   R operator()(T* record) { ... }
     // This operator() must be defined for at least all SkRecords::*.
     template <typename R, typename F>
-    R mutate(unsigned i, F& f) {
+    R mutate(int i, F& f) {
         SkASSERT(i < this->count());
         return fRecords[i].mutate<R>(f);
     }
@@ -85,7 +85,7 @@
     // You are expected to placement new an object of type T onto this pointer.
     // References to the original command are invalidated.
     template <typename T>
-    T* replace(unsigned i) {
+    T* replace(int i) {
         SkASSERT(i < this->count());
 
         Destroyer destroyer;
@@ -98,7 +98,7 @@
     // You are expected to placement new an object of type T onto this pointer.
     // You must show proof that you've already adopted the existing command.
     template <typename T, typename Existing>
-    T* replace(unsigned i, const SkRecords::Adopted<Existing>& proofOfAdoption) {
+    T* replace(int i, const SkRecords::Adopted<Existing>& proofOfAdoption) {
         SkASSERT(i < this->count());
 
         SkASSERT(Existing::kType == fRecords[i].type());
@@ -186,7 +186,7 @@
 
     // fRecords needs to be a data structure that can append fixed length data, and need to
     // support efficient random access and forward iteration.  (It doesn't need to be contiguous.)
-    unsigned fCount, fReserved;
+    int fCount, fReserved;
     SkAutoSTMalloc<kInlineRecords, Record> fRecords;
 
     // fAlloc needs to be a data structure which can append variable length data in contiguous
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 8c884d9..890a0bf 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -29,7 +29,7 @@
             query.setEmpty();
         }
 
-        SkTDArray<unsigned> ops;
+        SkTDArray<int> ops;
         bbh->search(query, &ops);
 
         SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount);
@@ -45,7 +45,7 @@
     } else {
         // Draw all ops.
         SkRecords::Draw draw(canvas, drawablePicts, drawables, drawableCount);
-        for (unsigned i = 0; i < record.count(); i++) {
+        for (int i = 0; i < record.count(); i++) {
             if (callback && callback->abort()) {
                 return;
             }
@@ -59,13 +59,13 @@
 
 void SkRecordPartialDraw(const SkRecord& record, SkCanvas* canvas,
                          SkPicture const* const drawablePicts[], int drawableCount,
-                         unsigned start, unsigned stop,
+                         int start, int stop,
                          const SkMatrix& initialCTM) {
     SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
 
     stop = SkTMin(stop, record.count());
     SkRecords::Draw draw(canvas, drawablePicts, NULL, drawableCount, &initialCTM);
-    for (unsigned i = start; i < stop; i++) {
+    for (int i = start; i < stop; i++) {
         record.visit<void>(i, draw);
     }
 }
@@ -161,7 +161,7 @@
         fCurrentClipBounds = fCullRect;
     }
 
-    void setCurrentOp(unsigned currentOp) { fCurrentOp = currentOp; }
+    void setCurrentOp(int currentOp) { fCurrentOp = currentOp; }
 
     void cleanUp(SkBBoxHierarchy* bbh) {
         // If we have any lingering unpaired Saves, simulate restores to make
@@ -190,9 +190,9 @@
     // In this file, SkRect are in local coordinates, Bounds are translated back to identity space.
     typedef SkRect Bounds;
 
-    unsigned currentOp() const { return fCurrentOp; }
+    int currentOp() const { return fCurrentOp; }
     const SkMatrix& ctm() const { return *fCTM; }
-    const Bounds& getBounds(unsigned index) const { return fBounds[index]; }
+    const Bounds& getBounds(int index) const { return fBounds[index]; }
 
     // Adjust rect for all paints that may affect its geometry, then map it to identity space.
     Bounds adjustAndMap(SkRect rect, const SkPaint* paint) const {
@@ -574,7 +574,7 @@
         return true;
     }
 
-    const unsigned fNumRecords;
+    const int fNumRecords;
 
     // We do not guarantee anything for operations outside of the cull rect
     const SkRect fCullRect;
@@ -585,13 +585,13 @@
     // We walk fCurrentOp through the SkRecord, as we go using updateCTM()
     // and updateClipBounds() to maintain the exact CTM (fCTM) and conservative
     // identity-space bounds of the current clip (fCurrentClipBounds).
-    unsigned fCurrentOp;
+    int fCurrentOp;
     const SkMatrix* fCTM;
     Bounds fCurrentClipBounds;
 
     // Used to track the bounds of Save/Restore blocks and the control ops inside them.
     SkTDArray<SaveBounds> fSaveStack;
-    SkTDArray<unsigned>   fControlIndices;
+    SkTDArray<int>   fControlIndices;
 };
 
 // SkRecord visitor to gather saveLayer/restore information.
@@ -605,7 +605,7 @@
         , fFillBounds(cullRect, record)
     {}
 
-    void setCurrentOp(unsigned currentOp) { fFillBounds.setCurrentOp(currentOp); }
+    void setCurrentOp(int currentOp) { fFillBounds.setCurrentOp(currentOp); }
 
     void cleanUp(SkBBoxHierarchy* bbh) {
         // fFillBounds must perform its cleanUp first so that all the bounding
@@ -696,10 +696,10 @@
 
             // Store 'saveLayer ops from enclosing picture' + drawPict op + 'ops from sub-picture'
             dst.fKeySize = fSaveLayerOpStack.count() + src.fKeySize + 1;
-            dst.fKey = SkNEW_ARRAY(unsigned, dst.fKeySize);
-            memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count() * sizeof(unsigned));
+            dst.fKey = SkNEW_ARRAY(int, dst.fKeySize);
+            memcpy(dst.fKey, fSaveLayerOpStack.begin(), fSaveLayerOpStack.count() * sizeof(int));
             dst.fKey[fSaveLayerOpStack.count()] = fFillBounds.currentOp();
-            memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySize * sizeof(unsigned));
+            memcpy(&dst.fKey[fSaveLayerOpStack.count()+1], src.fKey, src.fKeySize * sizeof(int));
         }
     }
 
@@ -773,8 +773,8 @@
         block.fIsNested = fSaveLayersInStack > 0;
 
         block.fKeySize = fSaveLayerOpStack.count();
-        block.fKey = SkNEW_ARRAY(unsigned, block.fKeySize);
-        memcpy(block.fKey, fSaveLayerOpStack.begin(), block.fKeySize * sizeof(unsigned));
+        block.fKey = SkNEW_ARRAY(int, block.fKeySize);
+        memcpy(block.fKey, fSaveLayerOpStack.begin(), block.fKeySize * sizeof(int));
 
         fSaveLayerOpStack.pop();
     }
@@ -783,7 +783,7 @@
     int                      fSaveLayersInStack;
     SkTDArray<SaveLayerInfo> fSaveLayerStack;
     // The op code indices of all the currently active saveLayers
-    SkTDArray<unsigned>      fSaveLayerOpStack;
+    SkTDArray<int>           fSaveLayerOpStack;
     SkLayerInfo*             fAccelData;
     const SkBigPicture::SnapshotArray* fPictList;
 
@@ -795,7 +795,7 @@
 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkBBoxHierarchy* bbh) {
     SkRecords::FillBounds visitor(cullRect, record);
 
-    for (unsigned curOp = 0; curOp < record.count(); curOp++) {
+    for (int curOp = 0; curOp < record.count(); curOp++) {
         visitor.setCurrentOp(curOp);
         record.visit<void>(curOp, visitor);
     }
@@ -808,7 +808,7 @@
                            SkLayerInfo* data) {
     SkRecords::CollectLayers visitor(cullRect, record, pictList, data);
 
-    for (unsigned curOp = 0; curOp < record.count(); curOp++) {
+    for (int curOp = 0; curOp < record.count(); curOp++) {
         visitor.setCurrentOp(curOp);
         record.visit<void>(curOp, visitor);
     }
diff --git a/src/core/SkRecordDraw.h b/src/core/SkRecordDraw.h
index 5b248cf..5af74dc 100644
--- a/src/core/SkRecordDraw.h
+++ b/src/core/SkRecordDraw.h
@@ -36,7 +36,7 @@
 // the initialCTM parameter must set to just the replay matrix.
 void SkRecordPartialDraw(const SkRecord&, SkCanvas*,
                          SkPicture const* const drawablePicts[], int drawableCount,
-                         unsigned start, unsigned stop, const SkMatrix& initialCTM);
+                         int start, int stop, const SkMatrix& initialCTM);
 
 namespace SkRecords {
 
diff --git a/src/core/SkRecordOpts.cpp b/src/core/SkRecordOpts.cpp
index 8351292..07aac3e 100644
--- a/src/core/SkRecordOpts.cpp
+++ b/src/core/SkRecordOpts.cpp
@@ -26,7 +26,7 @@
 
 // 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 @@
 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 @@
                      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 @@
                      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 @@
 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 @@
         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 @@
     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 @@
         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;
diff --git a/src/core/SkRecordPattern.h b/src/core/SkRecordPattern.h
index 85c38ac..174665a 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 @@
 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 @@
 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 @@
 
     // 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 @@
 // 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
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index c00a353..b12b1eb 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -245,7 +245,7 @@
 
 void SkRecorder::onDrawPosText(const void* text, size_t byteLength,
                                const SkPoint pos[], const SkPaint& paint) {
-    const unsigned points = paint.countText(text, byteLength);
+    const int points = paint.countText(text, byteLength);
     APPEND(DrawPosText,
            paint,
            this->copy((const char*)text, byteLength),
@@ -255,7 +255,7 @@
 
 void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength,
                                 const SkScalar xpos[], SkScalar constY, const SkPaint& paint) {
-    const unsigned points = paint.countText(text, byteLength);
+    const int points = paint.countText(text, byteLength);
     APPEND(DrawPosTextH,
            paint,
            this->copy((const char*)text, byteLength),
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp
index 4d5f2b4..4a20607 100644
--- a/src/gpu/GrLayerCache.cpp
+++ b/src/gpu/GrLayerCache.cpp
@@ -128,7 +128,7 @@
                                          const SkIRect& srcIR,
                                          const SkIRect& dstIR,
                                          const SkMatrix& initialMat,
-                                         const unsigned* key,
+                                         const int* key,
                                          int keySize,
                                          const SkPaint* paint) {
     SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0);
@@ -141,7 +141,7 @@
 }
 
 GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID, const SkMatrix& initialMat,
-                                       const unsigned* key, int keySize) {
+                                       const int* key, int keySize) {
     SkASSERT(pictureID != SK_InvalidGenID);
     return fLayerHash.find(GrCachedLayer::Key(pictureID, initialMat, key, keySize));
 }
@@ -151,7 +151,7 @@
                                                const SkIRect& srcIR,
                                                const SkIRect& dstIR,
                                                const SkMatrix& initialMat,
-                                               const unsigned* key,
+                                               const int* key,
                                                int keySize,
                                                const SkPaint* paint) {
     SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0);
@@ -216,7 +216,7 @@
                 pictInfo->incPlotUsage(plot->id());
 #endif
                 // The layer was successfully added to the atlas
-                const SkIRect bounds = SkIRect::MakeXYWH(loc.fX, loc.fY, 
+                const SkIRect bounds = SkIRect::MakeXYWH(loc.fX, loc.fY,
                                                          desc.fWidth, desc.fHeight);
                 layer->setTexture(fAtlas->getTexture(), bounds);
                 layer->setPlot(plot);
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index df8c670..cf35de8 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -31,9 +31,9 @@
     static uint32_t Hash(const uint32_t& key) { return SkChecksum::Mix(key); }
 
     // GrPictureInfo proper
-    GrPictureInfo(uint32_t pictureID) : fPictureID(pictureID) { 
+    GrPictureInfo(uint32_t pictureID) : fPictureID(pictureID) {
 #if !GR_CACHE_HOISTED_LAYERS
-        memset(fPlotUses, 0, sizeof(fPlotUses)); 
+        memset(fPlotUses, 0, sizeof(fPlotUses));
 #endif
     }
 
@@ -49,7 +49,7 @@
         fPlotUses[plotID]--;
     }
 
-    int plotUsage(int plotID) const { 
+    int plotUsage(int plotID) const {
         SkASSERT(plotID < kNumPlots);
         return fPlotUses[plotID];
     }
@@ -67,7 +67,7 @@
 // GrCachedLayer encapsulates the caching information for a single saveLayer.
 //
 // Atlased layers get a ref to the backing GrTexture while non-atlased layers
-// get a ref to the GrTexture in which they reside. In both cases 'fRect' 
+// get a ref to the GrTexture in which they reside. In both cases 'fRect'
 // contains the layer's extent in its texture.
 // Atlased layers also get a pointer to the plot in which they reside.
 // For non-atlased layers, the lock field just corresponds to locking in
@@ -77,17 +77,17 @@
 public:
     // For SkTDynamicHash
     struct Key {
-        Key(uint32_t pictureID, const SkMatrix& initialMat, 
-            const unsigned* key, int keySize, bool copyKey = false)
-        : fKeySize(keySize) 
+        Key(uint32_t pictureID, const SkMatrix& initialMat,
+            const int* key, int keySize, bool copyKey = false)
+        : fKeySize(keySize)
         , fFreeKey(copyKey) {
             fIDMatrix.fPictureID = pictureID;
             fIDMatrix.fInitialMat = initialMat;
             fIDMatrix.fInitialMat.getType(); // force initialization of type so hashes match
 
             if (copyKey) {
-                unsigned* tempKey = SkNEW_ARRAY(unsigned, keySize);
-                memcpy(tempKey, key, keySize*sizeof(unsigned));
+                int* tempKey = SkNEW_ARRAY(int, keySize);
+                memcpy(tempKey, key, keySize*sizeof(int));
                 fKey = tempKey;
             } else {
                 fKey = key;
@@ -116,13 +116,13 @@
         uint32_t pictureID() const { return fIDMatrix.fPictureID; }
 
         // TODO: remove these when GrCachedLayer & ReplacementInfo fuse
-        const unsigned* key() const { SkASSERT(fFreeKey);  return fKey; }
+        const int* key() const { SkASSERT(fFreeKey);  return fKey; }
         int keySize() const { SkASSERT(fFreeKey); return fKeySize; }
 
         uint32_t hash() const {
             uint32_t hash = SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(fKey),
                                                 fKeySize * sizeof(int));
-            return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&fIDMatrix), 
+            return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&fIDMatrix),
                                        sizeof(IDMatrix), hash);
         }
 
@@ -134,19 +134,19 @@
             SkMatrix fInitialMat;
         }              fIDMatrix;
 
-        const unsigned* fKey;
-        const int       fKeySize;
-        bool            fFreeKey;
+        const int* fKey;
+        const int  fKeySize;
+        bool       fFreeKey;
     };
 
     static const Key& GetKey(const GrCachedLayer& layer) { return layer.fKey; }
     static uint32_t Hash(const Key& key) { return key.hash(); }
 
     // GrCachedLayer proper
-    GrCachedLayer(uint32_t pictureID, unsigned start, unsigned stop,
+    GrCachedLayer(uint32_t pictureID, int start, int stop,
                   const SkIRect& srcIR, const SkIRect& dstIR,
                   const SkMatrix& ctm,
-                  const unsigned* key, int keySize,
+                  const int* key, int keySize,
                   const SkPaint* paint)
         : fKey(pictureID, ctm, key, keySize, true)
         , fStart(start)
@@ -179,14 +179,14 @@
 
     uint32_t pictureID() const { return fKey.pictureID(); }
     // TODO: remove these when GrCachedLayer & ReplacementInfo fuse
-    const unsigned* key() const { return fKey.key(); }
+    const int* key() const { return fKey.key(); }
     int keySize() const { return fKey.keySize(); }
 
-    unsigned start() const { return fStart; }
+    int start() const { return fStart; }
     // TODO: make bound debug only
     const SkIRect& srcIR() const { return fSrcIR; }
     const SkIRect& dstIR() const { return fDstIR; }
-    unsigned stop() const { return fStop; }
+    int stop() const { return fStop; }
     void setTexture(GrTexture* texture, const SkIRect& rect) {
         SkRefCnt_SafeAssign(fTexture, texture);
         fRect = rect;
@@ -220,9 +220,9 @@
     const Key       fKey;
 
     // The "saveLayer" operation index of the cached layer
-    const unsigned  fStart;
+    const int  fStart;
     // The final "restore" operation index of the cached layer
-    const unsigned  fStop;
+    const int  fStop;
 
     // The layer's src rect (i.e., the portion of the source scene required
     // for filtering).
@@ -291,13 +291,13 @@
     void freeAll();
 
     GrCachedLayer* findLayer(uint32_t pictureID, const SkMatrix& ctm,
-                             const unsigned* key, int keySize);
+                             const int* key, int keySize);
     GrCachedLayer* findLayerOrCreate(uint32_t pictureID,
-                                     int start, int stop, 
+                                     int start, int stop,
                                      const SkIRect& srcIR,
                                      const SkIRect& dstIR,
                                      const SkMatrix& initialMat,
-                                     const unsigned* key, int keySize,
+                                     const int* key, int keySize,
                                      const SkPaint* paint);
 
     // Attempt to place 'layer' in the atlas. Return true on success; false on failure.
@@ -357,7 +357,7 @@
 
     // We cache this information here (rather then, say, on the owning picture)
     // because we want to be able to clean it up as needed (e.g., if a picture
-    // is leaked and never cleans itself up we still want to be able to 
+    // is leaked and never cleans itself up we still want to be able to
     // remove the GrPictureInfo once its layers are purged from all the atlas
     // plots).
     SkTDynamicHash<GrPictureInfo, uint32_t> fPictureHash;
@@ -381,7 +381,7 @@
     GrCachedLayer* createLayer(uint32_t pictureID, int start, int stop,
                                const SkIRect& srcIR, const SkIRect& dstIR,
                                const SkMatrix& initialMat,
-                               const unsigned* key, int keySize,
+                               const int* key, int keySize,
                                const SkPaint* paint);
 
     // Remove all the layers (and unlock any resources) associated with 'pictureID'
diff --git a/src/gpu/GrRecordReplaceDraw.cpp b/src/gpu/GrRecordReplaceDraw.cpp
index 11eb38d..d1a8d93 100644
--- a/src/gpu/GrRecordReplaceDraw.cpp
+++ b/src/gpu/GrRecordReplaceDraw.cpp
@@ -63,7 +63,7 @@
                 const SkBigPicture* picture,
                 const SkMatrix& initialMatrix,
                 SkPicture::AbortCallback* callback,
-                const unsigned* opIndices, int numIndices)
+                const int* opIndices, int numIndices)
         : INHERITED(canvas, drawablePicts, NULL, drawableCount)
         , fCanvas(canvas)
         , fLayerCache(layerCache)
@@ -154,7 +154,7 @@
 
         // For a saveLayer command, check if it can be replaced by a drawBitmap
         // call and, if so, draw it and then update the current op index accordingly.
-        unsigned startOffset;
+        int startOffset;
         if (fOps.count()) {
             startOffset = fOps[fIndex];
         } else {
@@ -199,12 +199,12 @@
     const SkMatrix            fInitialMatrix;
     SkPicture::AbortCallback* fCallback;
 
-    SkTDArray<unsigned>       fOps;
+    SkTDArray<int>            fOps;
     int                       fIndex;
     int                       fNumReplaced;
 
     // The op code indices of all the enclosing drawPicture and saveLayer calls
-    SkTDArray<unsigned>       fOpIndexStack;
+    SkTDArray<int>            fOpIndexStack;
 
     typedef Draw INHERITED;
 };
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
index efb1ec1..411a10b 100644
--- a/tests/GpuLayerCacheTest.cpp
+++ b/tests/GpuLayerCacheTest.cpp
@@ -15,7 +15,7 @@
 
 class TestingAccess {
 public:
-    static unsigned NumLayers(GrLayerCache* cache) {
+    static int NumLayers(GrLayerCache* cache) {
         return cache->numLayers();
     }
     static void Purge(GrLayerCache* cache, uint32_t pictureID) {
@@ -25,8 +25,8 @@
         return layer->uses();
     }
     static GrCachedLayer* Find(GrLayerCache* cache, uint32_t pictureID,
-                               const SkMatrix& initialMat, 
-                               const unsigned* key, int keySize) {
+                               const SkMatrix& initialMat,
+                               const int* key, int keySize) {
         return cache->findLayer(pictureID, initialMat, key, keySize);
     }
 };
@@ -35,20 +35,20 @@
 static void create_layers(skiatest::Reporter* reporter,
                           GrLayerCache* cache,
                           const SkPicture& picture,
-                          unsigned numToAdd,
-                          unsigned idOffset) {
+                          int numToAdd,
+                          int idOffset) {
 
-    for (unsigned i = 0; i < numToAdd; ++i) {
-        unsigned indices[1] = { idOffset+i+1 };
-        GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(), 
-                                                        idOffset+i+1, idOffset+i+2, 
+    for (int i = 0; i < numToAdd; ++i) {
+        int indices[1] = { idOffset+i+1 };
+        GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(),
+                                                        idOffset+i+1, idOffset+i+2,
                                                         SkIRect::MakeEmpty(),
                                                         SkIRect::MakeEmpty(),
                                                         SkMatrix::I(),
                                                         indices, 1,
                                                         NULL);
         REPORTER_ASSERT(reporter, layer);
-        GrCachedLayer* temp = TestingAccess::Find(cache, picture.uniqueID(), SkMatrix::I(), 
+        GrCachedLayer* temp = TestingAccess::Find(cache, picture.uniqueID(), SkMatrix::I(),
                                                   indices, 1);
         REPORTER_ASSERT(reporter, temp == layer);
 
@@ -95,7 +95,7 @@
 // locking & unlocking textures).
 // TODO: need to add checks on VRAM usage!
 DEF_GPUTEST(GpuLayerCache, reporter, factory) {
-    static const unsigned kInitialNumLayers = 5;
+    static const int kInitialNumLayers = 5;
 
     for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
         GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType) i;
@@ -121,8 +121,8 @@
 
         create_layers(reporter, &cache, *picture, kInitialNumLayers, 0);
 
-        for (unsigned i = 0; i < kInitialNumLayers; ++i) {
-            unsigned indices[1] = { i + 1 };
+        for (int i = 0; i < kInitialNumLayers; ++i) {
+            int indices[1] = { i + 1 };
             GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
                                                        indices, 1);
             REPORTER_ASSERT(reporter, layer);
@@ -140,8 +140,8 @@
         }
 
         // Unlock the textures
-        for (unsigned i = 0; i < kInitialNumLayers; ++i) {
-            unsigned indices[1] = { i+1 };
+        for (int i = 0; i < kInitialNumLayers; ++i) {
+            int indices[1] = { i+1 };
 
             GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
                                                        indices, 1);
@@ -149,8 +149,8 @@
             cache.removeUse(layer);
         }
 
-        for (unsigned i = 0; i < kInitialNumLayers; ++i) {
-            unsigned indices[1] = { i+1 };
+        for (int i = 0; i < kInitialNumLayers; ++i) {
+            int indices[1] = { i+1 };
 
             GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
                                                        indices, 1);
@@ -177,9 +177,9 @@
         }
 
         {
-            unsigned indices[1] = { kInitialNumLayers+1 };
+            int indices[1] = { kInitialNumLayers+1 };
 
-            // Add an additional layer. Since all the layers are unlocked this 
+            // Add an additional layer. Since all the layers are unlocked this
             // will force out the first atlased layer
             create_layers(reporter, &cache, *picture, 1, kInitialNumLayers);
             GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
@@ -190,8 +190,8 @@
             cache.removeUse(layer);
         }
 
-        for (unsigned i = 0; i < kInitialNumLayers+1; ++i) {
-            unsigned indices[1] = { i+1 };
+        for (int i = 0; i < kInitialNumLayers+1; ++i) {
+            int indices[1] = { i+1 };
 
             GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
                                                        indices, 1);
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index bcfd9c4..17a8f31 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1247,7 +1247,7 @@
 
     CountingBBH(const SkRect& bound) : searchCalls(0), rootBound(bound) {}
 
-    void search(const SkRect& query, SkTDArray<unsigned>* results) const override {
+    void search(const SkRect& query, SkTDArray<int>* results) const override {
         this->searchCalls++;
     }
 
diff --git a/tests/RTreeTest.cpp b/tests/RTreeTest.cpp
index 16ccb4f..b39af67 100644
--- a/tests/RTreeTest.cpp
+++ b/tests/RTreeTest.cpp
@@ -25,8 +25,8 @@
     return rect;
 }
 
-static bool verify_query(SkRect query, SkRect rects[], SkTDArray<unsigned>& found) {
-    SkTDArray<unsigned> expected;
+static bool verify_query(SkRect query, SkRect rects[], SkTDArray<int>& found) {
+    SkTDArray<int> expected;
     // manually intersect with every rectangle
     for (int i = 0; i < NUM_RECTS; ++i) {
         if (SkRect::Intersects(query, rects[i])) {
@@ -46,7 +46,7 @@
 static void run_queries(skiatest::Reporter* reporter, SkRandom& rand, SkRect rects[],
                         const SkRTree& tree) {
     for (size_t i = 0; i < NUM_QUERIES; ++i) {
-        SkTDArray<unsigned> hits;
+        SkTDArray<int> hits;
         SkRect query = random_rect(rand);
         tree.search(query, &hits);
         REPORTER_ASSERT(reporter, verify_query(query, rects, hits));
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index da78296..84ceb20 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -126,17 +126,17 @@
     void insert(const SkRect boundsArray[], int N) override {
         fEntries.setCount(N);
         for (int i = 0; i < N; i++) {
-            Entry e = { (unsigned)i, boundsArray[i] };
+            Entry e = { i, boundsArray[i] };
             fEntries[i] = e;
         }
     }
 
-    void search(const SkRect& query, SkTDArray<unsigned>* results) const override {}
+    void search(const SkRect& query, SkTDArray<int>* results) const override {}
     size_t bytesUsed() const override { return 0; }
     SkRect getRootBound() const override { return SkRect::MakeEmpty(); }
 
     struct Entry {
-        unsigned opIndex;
+        int opIndex;
         SkRect bounds;
     };
     SkTDArray<Entry> fEntries;
@@ -166,7 +166,7 @@
 
     REPORTER_ASSERT(r, bbh.fEntries.count() == 5);
     for (int i = 0; i < bbh.fEntries.count(); i++) {
-        REPORTER_ASSERT(r, bbh.fEntries[i].opIndex == (unsigned)i);
+        REPORTER_ASSERT(r, bbh.fEntries[i].opIndex == i);
 
         REPORTER_ASSERT(r, sloppy_rect_eq(SkRect::MakeWH(400, 480), bbh.fEntries[i].bounds));
     }
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp
index e550244..25102c4 100644
--- a/tests/RecordOptsTest.cpp
+++ b/tests/RecordOptsTest.cpp
@@ -43,7 +43,7 @@
     recorder.restore();
 
     SkRecordNoopSaveRestores(&record);
-    for (unsigned i = 0; i < 3; i++) {
+    for (int i = 0; i < 3; i++) {
         assert_type<SkRecords::NoOp>(r, record, i);
     }
 }
@@ -66,7 +66,7 @@
     recorder.restore();
 
     SkRecordNoopSaveRestores(&record);
-    for (unsigned index = 0; index < record.count(); index++) {
+    for (int index = 0; index < record.count(); index++) {
         assert_type<SkRecords::NoOp>(r, record, index);
     }
 }
@@ -102,7 +102,7 @@
 
 static void assert_savelayer_restore(skiatest::Reporter* r,
                                      SkRecord* record,
-                                     unsigned i,
+                                     int i,
                                      bool shouldBeNoOped) {
     SkRecordNoopSaveLayerDrawRestores(record);
     if (shouldBeNoOped) {
@@ -175,7 +175,7 @@
 
 static void assert_merge_svg_opacity_and_filter_layers(skiatest::Reporter* r,
                                                        SkRecord* record,
-                                                       unsigned i,
+                                                       int i,
                                                        bool shouldBeNoOped) {
     SkRecordMergeSvgOpacityAndFilterLayers(record);
     if (shouldBeNoOped) {
diff --git a/tests/RecordPatternTest.cpp b/tests/RecordPatternTest.cpp
index ae13b28..b88165d 100644
--- a/tests/RecordPatternTest.cpp
+++ b/tests/RecordPatternTest.cpp
@@ -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.
+ */
+
 #include "Test.h"
 
 #include "SkRecord.h"
@@ -47,7 +54,7 @@
     }
 
     // We should match only at 0 and 3.  Going over the length should fail gracefully.
-    for (unsigned i = 0; i < 8; i++) {
+    for (int i = 0; i < 8; i++) {
         if (i == 0 || i == 3) {
             REPORTER_ASSERT(r, pattern.match(&record, i) == i + 3);
         } else {
@@ -99,7 +106,7 @@
 
     SkRecord record;
     SkRecorder recorder(&record, 1920, 1200);
-    unsigned start, begin, end;
+    int start, begin, end;
 
     start = record.count();
     recorder.save();
diff --git a/tests/RecordReplaceDrawTest.cpp b/tests/RecordReplaceDrawTest.cpp
index 473683b..8c45ee1 100644
--- a/tests/RecordReplaceDrawTest.cpp
+++ b/tests/RecordReplaceDrawTest.cpp
@@ -108,7 +108,7 @@
         pic.reset(recorder.endRecording());
     }
 
-    unsigned key[1] = { 0 };
+    int key[1] = { 0 };
 
     SkPaint paint;
     GrLayerCache* layerCache = context->getLayerCache();
@@ -149,7 +149,7 @@
     }
 }
 
-DEF_GPUTEST(RecordReplaceDraw, r, factory) { 
+DEF_GPUTEST(RecordReplaceDraw, r, factory) {
     for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
         GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
         if (!GrContextFactory::IsRenderingGLContext(glType)) {
diff --git a/tests/RecordTest.cpp b/tests/RecordTest.cpp
index 49efc28..b510da7 100644
--- a/tests/RecordTest.cpp
+++ b/tests/RecordTest.cpp
@@ -27,7 +27,7 @@
     int area() const { return fArea; }
 
     void apply(const SkRecord& record) {
-        for (unsigned i = 0; i < record.count(); i++) {
+        for (int i = 0; i < record.count(); i++) {
             record.visit<void>(i, *this);
         }
     }
@@ -45,7 +45,7 @@
     }
 
     void apply(SkRecord* record) {
-        for (unsigned i = 0; i < record->count(); i++) {
+        for (int i = 0; i < record->count(); i++) {
             record->mutate<void>(i, *this);
         }
     }
diff --git a/tests/RecordTestUtils.h b/tests/RecordTestUtils.h
index 4bab8e4..8243089 100644
--- a/tests/RecordTestUtils.h
+++ b/tests/RecordTestUtils.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 RecordTestUtils_DEFINED
 #define RecordTestUtils_DEFINED
 
@@ -20,7 +27,7 @@
 
 // Assert that the ith command in record is of type T, and return it.
 template <typename T>
-static const T* assert_type(skiatest::Reporter* r, const SkRecord& record, unsigned index) {
+static const T* assert_type(skiatest::Reporter* r, const SkRecord& record, int index) {
     ReadAs<T> reader;
     record.visit<void>(index, reader);
     REPORTER_ASSERT(r, T::kType == reader.type);
@@ -36,7 +43,7 @@
 template <typename DrawT> int count_instances_of_type(const SkRecord& record) {
     MatchType<DrawT> matcher;
     int counter = 0;
-    for (unsigned i = 0; i < record.count(); i++) {
+    for (int i = 0; i < record.count(); i++) {
         counter += record.visit<int>(i, matcher);
     }
     return counter;
@@ -44,7 +51,7 @@
 
 template <typename DrawT> int find_first_instances_of_type(const SkRecord& record) {
     MatchType<DrawT> matcher;
-    for (unsigned i = 0; i < record.count(); i++) {
+    for (int i = 0; i < record.count(); i++) {
         if (record.visit<int>(i, matcher)) {
             return i;
         }
diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp
index c41d634..b4bc58d 100644
--- a/tests/RecorderTest.cpp
+++ b/tests/RecorderTest.cpp
@@ -30,7 +30,7 @@
     int count() const { return fHistogram[T::kType]; }
 
     void apply(const SkRecord& record) {
-        for (unsigned i = 0; i < record.count(); i++) {
+        for (int i = 0; i < record.count(); i++) {
             record.visit<void>(i, *this);
         }
     }
diff --git a/tools/DumpRecord.cpp b/tools/DumpRecord.cpp
index 4f05fd4..3c34231 100644
--- a/tools/DumpRecord.cpp
+++ b/tools/DumpRecord.cpp
@@ -105,7 +105,7 @@
                   SkCanvas* canvas,
                   bool timeWithCommand) {
     Dumper dumper(canvas, record.count(), timeWithCommand);
-    for (unsigned i = 0; i < record.count(); i++) {
+    for (int i = 0; i < record.count(); i++) {
         record.visit<void>(i, dumper);
     }
 }