Second wave of Win64 warning cleanup

https://codereview.chromium.org/27343002/



git-svn-id: http://skia.googlecode.com/svn/trunk/src@11778 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkPictureRecord.cpp b/core/SkPictureRecord.cpp
index 92a1448..f7a7633 100644
--- a/core/SkPictureRecord.cpp
+++ b/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/core/SkPictureRecord.h b/core/SkPictureRecord.h
index a1eb40a..d80182c 100644
--- a/core/SkPictureRecord.h
+++ b/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/gpu/GrAtlas.cpp b/gpu/GrAtlas.cpp
index 15236e4..acf0f28 100644
--- a/gpu/GrAtlas.cpp
+++ b/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/gpu/GrAtlas.h b/gpu/GrAtlas.h
index d3deba5..3d68698 100644
--- a/gpu/GrAtlas.h
+++ b/gpu/GrAtlas.h
@@ -54,7 +54,7 @@
     GrRectanizer*           fRects;
     GrAtlasMgr*             fAtlasMgr;
     GrIPoint16              fOffset;
-    int                     fBytesPerPixel;
+    size_t                  fBytesPerPixel;
 
     friend class GrAtlasMgr;
 };
diff --git a/gpu/GrContext.cpp b/gpu/GrContext.cpp
index 7ded54d..dca5874 100644
--- a/gpu/GrContext.cpp
+++ b/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/gpu/GrTextStrike_impl.h b/gpu/GrTextStrike_impl.h
index 466e448..7f087fe 100644
--- a/gpu/GrTextStrike_impl.h
+++ b/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/gpu/gr_unittests.cpp b/gpu/gr_unittests.cpp
index cf298cc..ae9f67f 100644
--- a/gpu/gr_unittests.cpp
+++ b/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/images/SkImageDecoder_libwebp.cpp b/images/SkImageDecoder_libwebp.cpp
index 625e96e..8bb716b 100644
--- a/images/SkImageDecoder_libwebp.cpp
+++ b/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/images/SkJpegUtility.cpp b/images/SkJpegUtility.cpp
index bb499e8..e17b55b 100644
--- a/images/SkJpegUtility.cpp
+++ b/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/pdf/SkPDFResourceDict.cpp b/pdf/SkPDFResourceDict.cpp
index 0102b3c..6f5d167 100644
--- a/pdf/SkPDFResourceDict.cpp
+++ b/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/pdf/SkTSet.h b/pdf/SkTSet.h
index c2d2785..1609a9d 100644
--- a/pdf/SkTSet.h
+++ b/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/pipe/SkGPipeWrite.cpp b/pipe/SkGPipeWrite.cpp
index 607c76b..57d4a0f 100644
--- a/pipe/SkGPipeWrite.cpp
+++ b/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/ports/SkFontHost_win.cpp b/ports/SkFontHost_win.cpp
index 6f381e1..17aa0e6 100755
--- a/ports/SkFontHost_win.cpp
+++ b/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/ports/SkImageDecoder_WIC.cpp b/ports/SkImageDecoder_WIC.cpp
index 5a94b2d..c3666ac 100644
--- a/ports/SkImageDecoder_WIC.cpp
+++ b/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/utils/SkCanvasStateUtils.cpp b/utils/SkCanvasStateUtils.cpp
index 0cc42c5..c62bc04 100644
--- a/utils/SkCanvasStateUtils.cpp
+++ b/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/utils/SkNinePatch.cpp b/utils/SkNinePatch.cpp
index 9dc8bd2..4e0d1d1 100644
--- a/utils/SkNinePatch.cpp
+++ b/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/views/win/SkOSWindow_win.cpp b/views/win/SkOSWindow_win.cpp
index 9aeec6d..6bedd2d 100644
--- a/views/win/SkOSWindow_win.cpp
+++ b/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));