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

also, (C)

BUG=skia:

Review URL: https://codereview.chromium.org/1300163002
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);
         }
     }