diff --git a/bench/FontCacheBench.cpp b/bench/FontCacheBench.cpp
index c682f43..a52fd42 100644
--- a/bench/FontCacheBench.cpp
+++ b/bench/FontCacheBench.cpp
@@ -20,7 +20,7 @@
     while (*curr != gUniqueGlyphIDs_Sentinel) {
         curr += 1;
     }
-    return curr - start;
+    return static_cast<int>(curr - start);
 }
 
 class FontCacheBench : public SkBenchmark {
@@ -39,7 +39,7 @@
 
         const uint16_t* array = gUniqueGlyphIDs;
         while (*array != gUniqueGlyphIDs_Sentinel) {
-            size_t count = count_glyphs(array);
+            int count = count_glyphs(array);
             for (int i = 0; i < this->getLoops(); ++i) {
                 paint.measureText(array, count * sizeof(uint16_t));
             }
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 92a1448..f7a7633 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -150,10 +150,10 @@
 
     // op + flags
     uint32_t size = kSaveSize;
-    uint32_t initialOffset = this->addDraw(SAVE, &size);
+    size_t initialOffset = this->addDraw(SAVE, &size);
     addInt(flags);
 
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::save(flags);
 }
 
@@ -173,7 +173,7 @@
 
     SkASSERT(kSaveLayerNoBoundsSize == size || kSaveLayerWithBoundsSize == size);
 
-    uint32_t initialOffset = this->addDraw(SAVE_LAYER, &size);
+    size_t initialOffset = this->addDraw(SAVE_LAYER, &size);
     addRectPtr(bounds);
     SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.size());
     addPaintPtr(paint);
@@ -183,7 +183,7 @@
         fFirstSavedLayerIndex = fRestoreOffsetStack.count();
     }
 
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     /*  Don't actually call saveLayer, because that will try to allocate an
         offscreen device (potentially very big) which we don't actually need
         at this time (and may not be able to afford since during record our
@@ -603,66 +603,66 @@
 
     fRestoreOffsetStack.pop();
 
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::restore();
 }
 
 bool SkPictureRecord::translate(SkScalar dx, SkScalar dy) {
     // op + dx + dy
     uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
-    uint32_t initialOffset = this->addDraw(TRANSLATE, &size);
+    size_t initialOffset = this->addDraw(TRANSLATE, &size);
     addScalar(dx);
     addScalar(dy);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::translate(dx, dy);
 }
 
 bool SkPictureRecord::scale(SkScalar sx, SkScalar sy) {
     // op + sx + sy
     uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
-    uint32_t initialOffset = this->addDraw(SCALE, &size);
+    size_t initialOffset = this->addDraw(SCALE, &size);
     addScalar(sx);
     addScalar(sy);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::scale(sx, sy);
 }
 
 bool SkPictureRecord::rotate(SkScalar degrees) {
     // op + degrees
     uint32_t size = 1 * kUInt32Size + sizeof(SkScalar);
-    uint32_t initialOffset = this->addDraw(ROTATE, &size);
+    size_t initialOffset = this->addDraw(ROTATE, &size);
     addScalar(degrees);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::rotate(degrees);
 }
 
 bool SkPictureRecord::skew(SkScalar sx, SkScalar sy) {
     // op + sx + sy
     uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
-    uint32_t initialOffset = this->addDraw(SKEW, &size);
+    size_t initialOffset = this->addDraw(SKEW, &size);
     addScalar(sx);
     addScalar(sy);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::skew(sx, sy);
 }
 
 bool SkPictureRecord::concat(const SkMatrix& matrix) {
-    validate(fWriter.size(), 0);
+    this->validate(fWriter.size(), 0);
     // op + matrix index
     uint32_t size = 2 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(CONCAT, &size);
+    size_t initialOffset = this->addDraw(CONCAT, &size);
     addMatrix(matrix);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::concat(matrix);
 }
 
 void SkPictureRecord::setMatrix(const SkMatrix& matrix) {
-    validate(fWriter.size(), 0);
+    this->validate(fWriter.size(), 0);
     // op + matrix index
     uint32_t size = 2 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(SET_MATRIX, &size);
+    size_t initialOffset = this->addDraw(SET_MATRIX, &size);
     addMatrix(matrix);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     this->INHERITED::setMatrix(matrix);
 }
 
@@ -747,12 +747,12 @@
         // + restore offset
         size += kUInt32Size;
     }
-    uint32_t initialOffset = this->addDraw(CLIP_RECT, &size);
+    size_t initialOffset = this->addDraw(CLIP_RECT, &size);
     addRect(rect);
     addInt(ClipParams_pack(op, doAA));
     recordRestoreOffsetPlaceholder(op);
 
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::clipRect(rect, op, doAA);
 }
 
@@ -768,12 +768,12 @@
         // + restore offset
         size += kUInt32Size;
     }
-    uint32_t initialOffset = this->addDraw(CLIP_RRECT, &size);
+    size_t initialOffset = this->addDraw(CLIP_RRECT, &size);
     addRRect(rrect);
     addInt(ClipParams_pack(op, doAA));
     recordRestoreOffsetPlaceholder(op);
 
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 
     if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
         return this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
@@ -796,12 +796,12 @@
         // + restore offset
         size += kUInt32Size;
     }
-    uint32_t initialOffset = this->addDraw(CLIP_PATH, &size);
+    size_t initialOffset = this->addDraw(CLIP_PATH, &size);
     addPath(path);
     addInt(ClipParams_pack(op, doAA));
     recordRestoreOffsetPlaceholder(op);
 
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 
     if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
         return this->updateClipConservativelyUsingBounds(path.getBounds(), op,
@@ -819,63 +819,63 @@
         // + restore offset
         size += kUInt32Size;
     }
-    uint32_t initialOffset = this->addDraw(CLIP_REGION, &size);
+    size_t initialOffset = this->addDraw(CLIP_REGION, &size);
     addRegion(region);
     addInt(ClipParams_pack(op, false));
     recordRestoreOffsetPlaceholder(op);
 
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
     return this->INHERITED::clipRegion(region, op);
 }
 
 void SkPictureRecord::clear(SkColor color) {
     // op + color
     uint32_t size = 2 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(DRAW_CLEAR, &size);
+    size_t initialOffset = this->addDraw(DRAW_CLEAR, &size);
     addInt(color);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawPaint(const SkPaint& paint) {
     // op + paint index
     uint32_t size = 2 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(DRAW_PAINT, &size);
+    size_t initialOffset = this->addDraw(DRAW_PAINT, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.size());
     addPaint(paint);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
                                  const SkPaint& paint) {
     // op + paint index + mode + count + point data
     uint32_t size = 4 * kUInt32Size + count * sizeof(SkPoint);
-    uint32_t initialOffset = this->addDraw(DRAW_POINTS, &size);
+    size_t initialOffset = this->addDraw(DRAW_POINTS, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.size());
     addPaint(paint);
     addInt(mode);
     addInt(count);
     fWriter.writeMul4(pts, count * sizeof(SkPoint));
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) {
     // op + paint index + rect
     uint32_t size = 2 * kUInt32Size + sizeof(oval);
-    uint32_t initialOffset = this->addDraw(DRAW_OVAL, &size);
+    size_t initialOffset = this->addDraw(DRAW_OVAL, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.size());
     addPaint(paint);
     addRect(oval);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
     // op + paint index + rect
     uint32_t size = 2 * kUInt32Size + sizeof(rect);
-    uint32_t initialOffset = this->addDraw(DRAW_RECT, &size);
+    size_t initialOffset = this->addDraw(DRAW_RECT, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.size());
     addPaint(paint);
     addRect(rect);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
@@ -891,31 +891,31 @@
         SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.size());
         addPaint(paint);
         addRRect(rrect);
-        validate(initialOffset, size);
+        this->validate(initialOffset, size);
     }
 }
 
 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
     // op + paint index + path index
     uint32_t size = 3 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(DRAW_PATH, &size);
+    size_t initialOffset = this->addDraw(DRAW_PATH, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.size());
     addPaint(paint);
     addPath(path);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
                         const SkPaint* paint = NULL) {
     // op + paint index + bitmap index + left + top
     uint32_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar);
-    uint32_t initialOffset = this->addDraw(DRAW_BITMAP, &size);
+    size_t initialOffset = this->addDraw(DRAW_BITMAP, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.size());
     addPaintPtr(paint);
     addBitmap(bitmap);
     addScalar(left);
     addScalar(top);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
@@ -928,52 +928,52 @@
     }
     size += sizeof(dst);        // + rect
 
-    uint32_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size);
+    size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWriter.size());
     addPaintPtr(paint);
     addBitmap(bitmap);
     addRectPtr(src);  // may be null
     addRect(dst);
     addInt(flags);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix,
                                        const SkPaint* paint) {
     // id + paint index + bitmap index + matrix index
     uint32_t size = 4 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size);
+    size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.size());
     addPaintPtr(paint);
     addBitmap(bitmap);
     addMatrix(matrix);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
                                      const SkRect& dst, const SkPaint* paint) {
     // op + paint index + bitmap id + center + dst rect
     uint32_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
-    uint32_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
+    size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.size());
     addPaintPtr(paint);
     addBitmap(bitmap);
     addIRect(center);
     addRect(dst);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top,
                         const SkPaint* paint = NULL) {
     // op + paint index + bitmap index + left + top
     uint32_t size = 5 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
+    size_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.size());
     addPaintPtr(paint);
     addBitmap(bitmap);
     addInt(left);
     addInt(top);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbot[2]) {
@@ -1006,7 +1006,7 @@
     }
 
     DrawType op = fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT;
-    uint32_t initialOffset = this->addDraw(op, &size);
+    size_t initialOffset = this->addDraw(op, &size);
     SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.size());
     const SkFlatData* flatPaintData = addPaint(paint);
     SkASSERT(flatPaintData);
@@ -1016,7 +1016,7 @@
     if (fast) {
         addFontMetricsTopBottom(paint, *flatPaintData, y, y);
     }
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
@@ -1072,7 +1072,7 @@
     } else {
         op = DRAW_POS_TEXT;
     }
-    uint32_t initialOffset = this->addDraw(op, &size);
+    size_t initialOffset = this->addDraw(op, &size);
     SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.size());
     const SkFlatData* flatPaintData = addPaint(paint);
     SkASSERT(flatPaintData);
@@ -1100,7 +1100,7 @@
     fPointBytes += fWriter.size() - start;
     fPointWrites += points;
 #endif
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength,
@@ -1127,7 +1127,7 @@
     }
     // + y + the actual points
     size += 1 * kUInt32Size + points * sizeof(SkScalar);
-    uint32_t initialOffset = this->addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRAW_POS_TEXT_H,
+    size_t initialOffset = this->addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRAW_POS_TEXT_H,
                                            &size);
     SkASSERT(flatPaintData);
     addFlatPaint(flatPaintData);
@@ -1147,7 +1147,7 @@
     fPointBytes += fWriter.size() - start;
     fPointWrites += points;
 #endif
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawTextOnPath(const void* text, size_t byteLength,
@@ -1155,21 +1155,21 @@
                             const SkPaint& paint) {
     // op + paint index + length + 'length' worth of data + path index + matrix index
     uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
+    size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.size());
     addPaint(paint);
     addText(text, byteLength);
     addPath(path);
     addMatrixPtr(matrix);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawPicture(SkPicture& picture) {
     // op + picture index
     uint32_t size = 2 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(DRAW_PICTURE, &size);
+    size_t initialOffset = this->addDraw(DRAW_PICTURE, &size);
     addPicture(picture);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount,
@@ -1201,7 +1201,7 @@
         size += 1 * kUInt32Size + SkAlign4(indexCount * sizeof(uint16_t));
     }
 
-    uint32_t initialOffset = this->addDraw(DRAW_VERTICES, &size);
+    size_t initialOffset = this->addDraw(DRAW_VERTICES, &size);
     SkASSERT(initialOffset+getPaintOffset(DRAW_VERTICES, size) == fWriter.size());
     addPaint(paint);
     addInt(flags);
@@ -1218,25 +1218,25 @@
         addInt(indexCount);
         fWriter.writePad(indices, indexCount * sizeof(uint16_t));
     }
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::drawData(const void* data, size_t length) {
     // op + length + 'length' worth of data
     uint32_t size = 2 * kUInt32Size + SkAlign4(length);
-    uint32_t initialOffset = this->addDraw(DRAW_DATA, &size);
+    size_t initialOffset = this->addDraw(DRAW_DATA, &size);
     addInt(length);
     fWriter.writePad(data, length);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::beginCommentGroup(const char* description) {
     // op/size + length of string + \0 terminated chars
     int length = strlen(description);
     uint32_t size = 2 * kUInt32Size + SkAlign4(length + 1);
-    uint32_t initialOffset = this->addDraw(BEGIN_COMMENT_GROUP, &size);
+    size_t initialOffset = this->addDraw(BEGIN_COMMENT_GROUP, &size);
     fWriter.writeString(description, length);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::addComment(const char* kywd, const char* value) {
@@ -1244,17 +1244,17 @@
     int kywdLen = strlen(kywd);
     int valueLen = strlen(value);
     uint32_t size = 3 * kUInt32Size + SkAlign4(kywdLen + 1) + SkAlign4(valueLen + 1);
-    uint32_t initialOffset = this->addDraw(COMMENT, &size);
+    size_t initialOffset = this->addDraw(COMMENT, &size);
     fWriter.writeString(kywd, kywdLen);
     fWriter.writeString(value, valueLen);
-    validate(initialOffset, size);
+    this->validate(initialOffset, size);
 }
 
 void SkPictureRecord::endCommentGroup() {
     // op/size
     uint32_t size = 1 * kUInt32Size;
-    uint32_t initialOffset = this->addDraw(END_COMMENT_GROUP, &size);
-    validate(initialOffset, size);
+    size_t initialOffset = this->addDraw(END_COMMENT_GROUP, &size);
+    this->validate(initialOffset, size);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index a1eb40a..d80182c 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -130,8 +130,8 @@
      * end of blocks could go unused). Possibly add a second addDraw that
      * operates in this manner.
      */
-    uint32_t addDraw(DrawType drawType, uint32_t* size) {
-        uint32_t offset = fWriter.size();
+    size_t addDraw(DrawType drawType, uint32_t* size) {
+        size_t offset = fWriter.size();
 
         this->predrawNotify();
 
@@ -202,7 +202,7 @@
 
 #ifdef SK_DEBUG_VALIDATE
 public:
-    void validate(uint32_t initialOffset, uint32_t size) const;
+    void validate(size_t initialOffset, uint32_t size) const;
 private:
     void validateBitmaps() const;
     void validateMatrices() const;
@@ -211,7 +211,7 @@
     void validateRegions() const;
 #else
 public:
-    void validate(uint32_t initialOffset, uint32_t size) const {
+    void validate(size_t initialOffset, uint32_t size) const {
         SkASSERT(fWriter.size() == initialOffset + size);
     }
 #endif
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 15236e4..acf0f28 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -62,16 +62,14 @@
     delete fRects;
 }
 
-static void adjust_for_offset(GrIPoint16* loc, const GrIPoint16& offset) {
+static inline void adjust_for_offset(GrIPoint16* loc, const GrIPoint16& offset) {
     loc->fX += offset.fX * GR_ATLAS_WIDTH;
     loc->fY += offset.fY * GR_ATLAS_HEIGHT;
 }
 
-static uint8_t* zero_fill(uint8_t* ptr, int count) {
-    while (--count >= 0) {
-        *ptr++ = 0;
-    }
-    return ptr;
+static inline uint8_t* zero_fill(uint8_t* ptr, size_t count) {
+    sk_bzero(ptr, count);
+    return ptr + count;
 }
 
 bool GrPlot::addSubImage(int width, int height, const void* image,
@@ -128,7 +126,7 @@
     fTexture = NULL;
 
     // set up allocated plots
-    int bpp = GrBytesPerPixel(fPixelConfig);
+    size_t bpp = GrBytesPerPixel(fPixelConfig);
     fPlots = SkNEW_ARRAY(GrPlot, (GR_PLOT_WIDTH*GR_PLOT_HEIGHT));
     fFreePlots = NULL;
     GrPlot* currPlot = fPlots;
diff --git a/src/gpu/GrAtlas.h b/src/gpu/GrAtlas.h
index d3deba5..3d68698 100644
--- a/src/gpu/GrAtlas.h
+++ b/src/gpu/GrAtlas.h
@@ -54,7 +54,7 @@
     GrRectanizer*           fRects;
     GrAtlasMgr*             fAtlasMgr;
     GrIPoint16              fOffset;
-    int                     fBytesPerPixel;
+    size_t                  fBytesPerPixel;
 
     friend class GrAtlasMgr;
 };
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 7ded54d..dca5874 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -286,18 +286,18 @@
                          void* src,
                          int srcW,
                          int srcH,
-                         int bpp) {
+                         size_t bpp) {
     GrFixed dx = (srcW << 16) / dstW;
     GrFixed dy = (srcH << 16) / dstH;
 
     GrFixed y = dy >> 1;
 
-    int dstXLimit = dstW*bpp;
+    size_t dstXLimit = dstW*bpp;
     for (int j = 0; j < dstH; ++j) {
         GrFixed x = dx >> 1;
         void* srcRow = (uint8_t*)src + (y>>16)*srcW*bpp;
         void* dstRow = (uint8_t*)dst + j*dstW*bpp;
-        for (int i = 0; i < dstXLimit; i += bpp) {
+        for (size_t i = 0; i < dstXLimit; i += bpp) {
             memcpy((uint8_t*) dstRow + i,
                    (uint8_t*) srcRow + (x>>16)*bpp,
                    bpp);
@@ -374,7 +374,7 @@
         // no longer need to clamp at min RT size.
         rtDesc.fWidth  = GrNextPow2(desc.fWidth);
         rtDesc.fHeight = GrNextPow2(desc.fHeight);
-        int bpp = GrBytesPerPixel(desc.fConfig);
+        size_t bpp = GrBytesPerPixel(desc.fConfig);
         SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fHeight);
         stretchImage(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight,
                      srcData, desc.fWidth, desc.fHeight, bpp);
diff --git a/src/gpu/GrTextStrike_impl.h b/src/gpu/GrTextStrike_impl.h
index 466e448..7f087fe 100644
--- a/src/gpu/GrTextStrike_impl.h
+++ b/src/gpu/GrTextStrike_impl.h
@@ -17,7 +17,7 @@
         fFontScalerKey = scaler->getKey();
     }
 
-    uint32_t getHash() const { return fFontScalerKey->getHash(); }
+    intptr_t getHash() const { return fFontScalerKey->getHash(); }
 
     static bool LT(const GrTextStrike& strike, const Key& key) {
         return *strike.getFontScalerKey() < *key.fFontScalerKey;
diff --git a/src/gpu/gr_unittests.cpp b/src/gpu/gr_unittests.cpp
index cf298cc..ae9f67f 100644
--- a/src/gpu/gr_unittests.cpp
+++ b/src/gpu/gr_unittests.cpp
@@ -31,8 +31,8 @@
         1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99
     };
 
-    for (size_t n = 0; n < GR_ARRAY_COUNT(array); n++) {
-        for (size_t i = 0; i < n; i++) {
+    for (int n = 0; n < static_cast<int>(GR_ARRAY_COUNT(array)); ++n) {
+        for (int i = 0; i < n; i++) {
             int index = GrTBSearch<int, int>(array, n, array[i]);
             SkASSERT(index == (int) i);
             index = GrTBSearch<int, int>(array, n, -array[i]);
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 625e96e..8bb716b 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -242,7 +242,7 @@
 
     config->output.colorspace = mode;
     config->output.u.RGBA.rgba = (uint8_t*)decodedBitmap->getPixels();
-    config->output.u.RGBA.stride = decodedBitmap->rowBytes();
+    config->output.u.RGBA.stride = (int) decodedBitmap->rowBytes();
     config->output.u.RGBA.size = decodedBitmap->getSize();
     config->output.is_external_memory = 1;
 
diff --git a/src/images/SkJpegUtility.cpp b/src/images/SkJpegUtility.cpp
index bb499e8..e17b55b 100644
--- a/src/images/SkJpegUtility.cpp
+++ b/src/images/SkJpegUtility.cpp
@@ -69,9 +69,9 @@
     skjpeg_source_mgr*  src = (skjpeg_source_mgr*)cinfo->src;
 
     if (num_bytes > (long)src->bytes_in_buffer) {
-        long bytesToSkip = num_bytes - src->bytes_in_buffer;
+        size_t bytesToSkip = num_bytes - src->bytes_in_buffer;
         while (bytesToSkip > 0) {
-            long bytes = (long)src->fStream->skip(bytesToSkip);
+            size_t bytes = src->fStream->skip(bytesToSkip);
             if (bytes <= 0 || bytes > bytesToSkip) {
 //              SkDebugf("xxxxxxxxxxxxxx failure to skip request %d returned %d\n", bytesToSkip, bytes);
                 cinfo->err->error_exit((j_common_ptr)cinfo);
diff --git a/src/pdf/SkPDFResourceDict.cpp b/src/pdf/SkPDFResourceDict.cpp
index 0102b3c..6f5d167 100644
--- a/src/pdf/SkPDFResourceDict.cpp
+++ b/src/pdf/SkPDFResourceDict.cpp
@@ -65,7 +65,7 @@
 
     // Actual sub-dicts will be lazily added later
     fTypes.setCount(kResourceTypeCount);
-    for (size_t i=0; i < kResourceTypeCount; i++) {
+    for (int i=0; i < kResourceTypeCount; i++) {
         fTypes[i] = NULL;
     }
 }
diff --git a/src/pdf/SkTSet.h b/src/pdf/SkTSet.h
index c2d2785..1609a9d 100644
--- a/src/pdf/SkTSet.h
+++ b/src/pdf/SkTSet.h
@@ -291,12 +291,12 @@
         // A O(n log n) algorithm is necessary as O(n^2) will choke some GMs.
         SkAutoMalloc sortedArray(fOrderedArray->bytes());
         T* sortedBase = reinterpret_cast<T*>(sortedArray.get());
-        size_t count = fOrderedArray->count();
+        int count = fOrderedArray->count();
         fOrderedArray->copyRange(sortedBase, 0, count);
 
         SkTQSort<T>(sortedBase, sortedBase + count - 1);
 
-        for (size_t i = 0; i < count; ++i) {
+        for (int i = 0; i < count; ++i) {
             if (sortedBase[i] != (*fSetArray)[i]) {
                 return false;
             }
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 607c76b..57d4a0f 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -694,7 +694,7 @@
 }
 
 void SkGPipeCanvas::drawPoints(PointMode mode, size_t count,
-                                   const SkPoint pts[], const SkPaint& paint) {
+                               const SkPoint pts[], const SkPaint& paint) {
     if (count) {
         NOTIFY_SETUP(this);
         this->writePaint(paint);
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 6f381e1..17aa0e6 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -2154,10 +2154,10 @@
     if (NULL == data) {
         length = 0;
     }
-    DWORD bufferSize = GetFontData(hdc, tag, offset, data, length);
+    DWORD bufferSize = GetFontData(hdc, tag, (DWORD) offset, data, (DWORD) length);
     if (bufferSize == GDI_ERROR) {
         call_ensure_accessible(lf);
-        bufferSize = GetFontData(hdc, tag, offset, data, length);
+        bufferSize = GetFontData(hdc, tag, (DWORD) offset, data, (DWORD) length);
     }
 
     SelectObject(hdc, savefont);
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index 5a94b2d..c3666ac 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -231,7 +231,7 @@
     if (SUCCEEDED(hr)) {
         SkAutoLockPixels alp(*bm);
         bm->eraseColor(SK_ColorTRANSPARENT);
-        const UINT stride = bm->rowBytes();
+        const UINT stride = (UINT) bm->rowBytes();
         hr = piBitmapSourceConverted->CopyPixels(
             NULL,                             //Get all the pixels
             stride,
@@ -414,7 +414,7 @@
     //Write the pixels into the frame.
     if (SUCCEEDED(hr)) {
         SkAutoLockPixels alp(*bitmap);
-        const UINT stride = bitmap->rowBytes();
+        const UINT stride = (UINT) bitmap->rowBytes();
         hr = piBitmapFrameEncode->WritePixels(
             height
             , stride
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 0cc42c5c..c62bc04 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -60,7 +60,7 @@
     union {
         struct {
             RasterConfig config; // pixel format: a value from RasterConfigs.
-            uint32_t rowBytes;   // Number of bytes from start of one line to next.
+            size_t rowBytes;     // Number of bytes from start of one line to next.
             void* pixels;        // The pixels, all (height * rowBytes) of them.
         } raster;
         struct {
diff --git a/src/utils/SkNinePatch.cpp b/src/utils/SkNinePatch.cpp
index 9dc8bd2..4e0d1d1 100644
--- a/src/utils/SkNinePatch.cpp
+++ b/src/utils/SkNinePatch.cpp
@@ -43,7 +43,7 @@
         }
         n += 1;
     }
-    return indices - startIndices;
+    return static_cast<int>(indices - startIndices);
 }
 
 // Computes the delta between vertices along a single axis
diff --git a/src/views/win/SkOSWindow_win.cpp b/src/views/win/SkOSWindow_win.cpp
index 9aeec6d..6bedd2d 100644
--- a/src/views/win/SkOSWindow_win.cpp
+++ b/src/views/win/SkOSWindow_win.cpp
@@ -124,7 +124,7 @@
             }
         } break;
         case WM_UNICHAR:
-            this->handleChar(wParam);
+            this->handleChar((SkUnichar) wParam);
             return true;
         case WM_CHAR: {
             this->handleChar(SkUTF8_ToUnichar((char*)&wParam));
diff --git a/tools/skdiff_utils.cpp b/tools/skdiff_utils.cpp
index 1f5289b..6f73a08 100644
--- a/tools/skdiff_utils.cpp
+++ b/tools/skdiff_utils.cpp
@@ -115,7 +115,7 @@
 static SkString filename_to_derived_filename(const SkString& filename, const char *suffix) {
     SkString diffName (filename);
     const char* cstring = diffName.c_str();
-    int dotOffset = strrchr(cstring, '.') - cstring;
+    size_t dotOffset = strrchr(cstring, '.') - cstring;
     diffName.remove(dotOffset, diffName.size() - dotOffset);
     diffName.append(suffix);
 
