Fix a bunch of warnings, mainly around rowBytes.

My recent change changed the way SkBitmap::fRowBytes is stored,
and parameter/return values referring to rowBytes were changed
to type size_t. Change the storage back, and eliminate warnings
resulting from returning a size_t.

Review URL: https://codereview.appspot.com/7396059

git-svn-id: http://skia.googlecode.com/svn/trunk@7855 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 6fdde40..9347bd9 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -645,7 +645,7 @@
         kImageIsImmutable_Flag  = 0x04
     };
 
-    size_t      fRowBytes;
+    uint32_t    fRowBytes;
     uint32_t    fWidth;
     uint32_t    fHeight;
     uint8_t     fConfig;
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 7db6527..fe4255d 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -47,7 +47,7 @@
         Sk64 size;
         size.setMul(levelCount + 1, sizeof(MipLevel));
         size.add(sizeof(MipMap));
-        size.add(pixelSize);
+        size.add(SkToS32(pixelSize));
         if (!isPos32Bits(size)) {
             return NULL;
         }
@@ -220,7 +220,7 @@
 
 Sk64 SkBitmap::ComputeSize64(Config c, int width, int height) {
     Sk64 size;
-    size.setMul(SkBitmap::ComputeRowBytes(c, width), height);
+    size.setMul(SkToS32(SkBitmap::ComputeRowBytes(c, width)), height);
     return size;
 }
 
@@ -236,9 +236,11 @@
     Sk64 safeSize;
     safeSize.setZero();
     if (height > 0) {
-        safeSize.set(ComputeRowBytes(config, width));
+        // TODO: Handle the case where the return value from
+        // ComputeRowBytes is more than 31 bits.
+        safeSize.set(SkToS32(ComputeRowBytes(config, width)));
         Sk64 sizeAllButLastRow;
-        sizeAllButLastRow.setMul(height - 1, rowBytes);
+        sizeAllButLastRow.setMul(height - 1, SkToS32(rowBytes));
         safeSize.add(sizeAllButLastRow);
     }
     SkASSERT(!safeSize.isNeg());
@@ -283,7 +285,7 @@
     fConfig     = SkToU8(c);
     fWidth      = width;
     fHeight     = height;
-    fRowBytes   = rowBytes;
+    fRowBytes   = SkToU32(rowBytes);
 
     fBytesPerPixel = (uint8_t)ComputeBytesPerPixel(c);
 
@@ -496,7 +498,7 @@
             return false;
         else {
             // Just copy what we need on each line.
-            uint32_t rowBytes = ComputeRowBytes(getConfig(), fWidth);
+            size_t rowBytes = ComputeRowBytes(getConfig(), fWidth);
             SkAutoLockPixels lock(*this);
             const uint8_t* srcP = reinterpret_cast<const uint8_t*>(getPixels());
             uint8_t* dstP = reinterpret_cast<uint8_t*>(dst);
@@ -864,7 +866,7 @@
  *  upper left corner of bm relative to its SkPixelRef.
  *  x and y must be non-NULL.
  */
-static bool getUpperLeftFromOffset(const SkBitmap& bm, int* x, int* y) {
+static bool getUpperLeftFromOffset(const SkBitmap& bm, int32_t* x, int32_t* y) {
     SkASSERT(x != NULL && y != NULL);
     const size_t offset = bm.pixelRefOffset();
     if (0 == offset) {
@@ -872,9 +874,9 @@
         return true;
     }
     // Use integer division to find the correct y position.
-    *y = offset / bm.rowBytes();
+    *y = SkToS32(offset / bm.rowBytes());
     // The remainder will be the x position, after we reverse getSubOffset.
-    *x = offset % bm.rowBytes();
+    *x = SkToS32(offset % bm.rowBytes());
     switch (bm.getConfig()) {
         case SkBitmap::kA8_Config:
             // Fall through.
@@ -948,7 +950,7 @@
         const RLEPixels* rle = (const RLEPixels*)this->getPixels();
         uint8_t* dst = bm.getAddr8(0, 0);
         const int width = bm.width();
-        const int rowBytes = bm.rowBytes();
+        const size_t rowBytes = bm.rowBytes();
 
         for (int y = r.fTop; y < r.fBottom; y++) {
             SkPackBits::Unpack8(dst, r.fLeft, width, rle->packedAtY(y));
@@ -1141,7 +1143,7 @@
             } else {
                 // Find the correct offset in the new config. This needs to be done after calling
                 // setConfig so dst's fConfig and fRowBytes have been set properly.
-                int x, y;
+                int32_t x, y;
                 if (!getUpperLeftFromOffset(*this, &x, &y)) {
                     return false;
                 }
@@ -1335,13 +1337,13 @@
     uint8_t*    addr = (uint8_t*)mm->pixels();
     int         width = this->width();
     int         height = this->height();
-    unsigned    rowBytes;
+    uint32_t    rowBytes;
     SkBitmap    dstBM;
 
     for (int i = 0; i < maxLevels; i++) {
         width >>= 1;
         height >>= 1;
-        rowBytes = ComputeRowBytes(config, width);
+        rowBytes = SkToU32(ComputeRowBytes(config, width));
 
         level[i].fPixels   = addr;
         level[i].fWidth    = width;
@@ -1417,7 +1419,7 @@
     SkBitmap::Config config = src.getConfig();
     int              w = src.width();
     int              h = src.height();
-    int              rb = src.rowBytes();
+    size_t           rb = src.rowBytes();
 
     SkAutoLockPixels alp(src);
     if (!src.readyToDraw()) {
@@ -1561,7 +1563,7 @@
     if (fPixelRef) {
         if (fPixelRef->getFactory()) {
             buffer.writeInt(SERIALIZE_PIXELTYPE_REF_DATA);
-            buffer.writeUInt(fPixelRefOffset);
+            buffer.writeUInt(SkToU32(fPixelRefOffset));
             buffer.writeFlattenable(fPixelRef);
             return;
         }
diff --git a/src/core/SkBitmapProcState_sample.h b/src/core/SkBitmapProcState_sample.h
index b38eb77..ea377f2 100644
--- a/src/core/SkBitmapProcState_sample.h
+++ b/src/core/SkBitmapProcState_sample.h
@@ -49,12 +49,12 @@
     PREAMBLE(s);
 #endif
     const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels();
-    int i, rb = s.fBitmap->rowBytes();
+    size_t rb = s.fBitmap->rowBytes();
 
     uint32_t XY;
     SRCTYPE src;
 
-    for (i = (count >> 1); i > 0; --i) {
+    for (int i = (count >> 1); i > 0; --i) {
         XY = *xy++;
         SkASSERT((XY >> 16) < (unsigned)s.fBitmap->height() &&
                  (XY & 0xFFFF) < (unsigned)s.fBitmap->width());
@@ -146,7 +146,7 @@
     PREAMBLE(s);
 #endif
     const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels();
-    unsigned rb = s.fBitmap->rowBytes();
+    size_t rb = s.fBitmap->rowBytes();
     unsigned subY;
     const SRCTYPE* SK_RESTRICT row0;
     const SRCTYPE* SK_RESTRICT row1;
@@ -192,7 +192,7 @@
         PREAMBLE(s);
 #endif
     const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels();
-    int rb = s.fBitmap->rowBytes();
+    size_t rb = s.fBitmap->rowBytes();
 
     do {
         uint32_t data = *xy++;
diff --git a/src/core/SkBitmapProcState_shaderproc.h b/src/core/SkBitmapProcState_shaderproc.h
index cf15a50..6b8f74a 100644
--- a/src/core/SkBitmapProcState_shaderproc.h
+++ b/src/core/SkBitmapProcState_shaderproc.h
@@ -44,7 +44,7 @@
         int y1 = TILEY_PROCF((fy + s.fFilterOneY), maxY);
 
         const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels();
-        unsigned rb = s.fBitmap->rowBytes();
+        size_t rb = s.fBitmap->rowBytes();
         row0 = (const SRCTYPE*)(srcAddr + y0 * rb);
         row1 = (const SRCTYPE*)(srcAddr + y1 * rb);
         // now initialize fx
diff --git a/src/core/SkBitmap_scroll.cpp b/src/core/SkBitmap_scroll.cpp
index 36e5f05..e9c886f 100644
--- a/src/core/SkBitmap_scroll.cpp
+++ b/src/core/SkBitmap_scroll.cpp
@@ -82,7 +82,7 @@
 
     char*       dst = (char*)this->getPixels();
     const char* src = dst;
-    int         rowBytes = this->rowBytes();    // need rowBytes to be signed
+    int         rowBytes = (int)this->rowBytes();    // need rowBytes to be signed
 
     if (dy <= 0) {
         src -= dy * rowBytes;
diff --git a/src/core/SkBlitBWMaskTemplate.h b/src/core/SkBlitBWMaskTemplate.h
index 15ed54e..fa25274 100644
--- a/src/core/SkBlitBWMaskTemplate.h
+++ b/src/core/SkBlitBWMaskTemplate.h
@@ -31,7 +31,7 @@
     int cy = clip.fTop;
     int maskLeft = srcMask.fBounds.fLeft;
     unsigned mask_rowBytes = srcMask.fRowBytes;
-    unsigned bitmap_rowBytes = bitmap.rowBytes();
+    size_t bitmap_rowBytes = bitmap.rowBytes();
     unsigned height = clip.height();
 
     SkASSERT(mask_rowBytes != 0);
diff --git a/src/core/SkBlitter_4444.cpp b/src/core/SkBlitter_4444.cpp
index 3844b76..0d81f8d 100644
--- a/src/core/SkBlitter_4444.cpp
+++ b/src/core/SkBlitter_4444.cpp
@@ -156,7 +156,7 @@
     SkPMColor16* device = fDevice.getAddr16(x, y);
     SkPMColor16  color = fPMColor16;
     SkPMColor16  other = fPMColor16Other;
-    unsigned     rb = fDevice.rowBytes();
+    size_t       rb = fDevice.rowBytes();
 
     if ((x ^ y) & 1) {
         SkTSwap<SkPMColor16>(color, other);
@@ -337,7 +337,7 @@
     SkPMColor16*    device = fDevice.getAddr16(x, y);
     const uint8_t*  alpha = mask.getAddr8(x, y);
     SkPMColor16     srcColor = fPMColor16;
-    unsigned        devRB = fDevice.rowBytes() - (width << 1);
+    size_t          devRB = fDevice.rowBytes() - (width << 1);
     unsigned        maskRB = mask.fRowBytes - width;
 
     do {
diff --git a/src/core/SkBlitter_A8.cpp b/src/core/SkBlitter_A8.cpp
index 4213c6b..0255464 100644
--- a/src/core/SkBlitter_A8.cpp
+++ b/src/core/SkBlitter_A8.cpp
@@ -180,7 +180,7 @@
 
     unsigned sa = SkAlphaMul(fSrcA, SkAlpha255To256(alpha));
     uint8_t* device = fDevice.getAddr8(x, y);
-    int      rowBytes = fDevice.rowBytes();
+    size_t   rowBytes = fDevice.rowBytes();
 
     if (sa == 0xFF) {
         for (int i = 0; i < height; i++) {
diff --git a/src/core/SkBlitter_ARGB32.cpp b/src/core/SkBlitter_ARGB32.cpp
index 16487ad..d4bec1b 100644
--- a/src/core/SkBlitter_ARGB32.cpp
+++ b/src/core/SkBlitter_ARGB32.cpp
@@ -196,7 +196,7 @@
     }
 
     unsigned dst_scale = 255 - SkGetPackedA32(color);
-    uint32_t rowBytes = fDevice.rowBytes();
+    size_t rowBytes = fDevice.rowBytes();
     while (--height >= 0) {
         device[0] = color + SkAlphaMulQ(device[0], dst_scale);
         device = (uint32_t*)((char*)device + rowBytes);
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp
index 175409c..4eead2b 100644
--- a/src/core/SkBlitter_RGB16.cpp
+++ b/src/core/SkBlitter_RGB16.cpp
@@ -211,7 +211,7 @@
         const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop);
         unsigned width = clip.width();
         unsigned height = clip.height();
-        unsigned deviceRB = fDevice.rowBytes() - (width << 1);
+        size_t deviceRB = fDevice.rowBytes() - (width << 1);
         unsigned maskRB = mask.fRowBytes - width;
 
         SkASSERT((int)height > 0);
@@ -381,7 +381,7 @@
     const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop);
     int width = clip.width();
     int height = clip.height();
-    unsigned    deviceRB = fDevice.rowBytes() - (width << 1);
+    size_t      deviceRB = fDevice.rowBytes() - (width << 1);
     unsigned    maskRB = mask.fRowBytes - width;
     uint32_t    expanded32 = fExpandedRaw16;
 
@@ -481,7 +481,7 @@
 
 void SkRGB16_Opaque_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
     uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
-    unsigned    deviceRB = fDevice.rowBytes();
+    size_t    deviceRB = fDevice.rowBytes();
 
     // TODO: respect fDoDither
     unsigned scale5 = SkAlpha255To256(alpha) >> 3;
@@ -497,7 +497,7 @@
 void SkRGB16_Opaque_Blitter::blitRect(int x, int y, int width, int height) {
     SkASSERT(x + width <= fDevice.width() && y + height <= fDevice.height());
     uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
-    unsigned    deviceRB = fDevice.rowBytes();
+    size_t      deviceRB = fDevice.rowBytes();
     uint16_t    color16 = fColor16;
 
     if (fDoDither) {
@@ -641,7 +641,7 @@
     const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop);
     int width = clip.width();
     int height = clip.height();
-    unsigned    deviceRB = fDevice.rowBytes() - (width << 1);
+    size_t      deviceRB = fDevice.rowBytes() - (width << 1);
     unsigned    maskRB = mask.fRowBytes - width;
     uint32_t    color32 = fExpandedRaw16;
 
@@ -662,7 +662,7 @@
 
 void SkRGB16_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
     uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
-    unsigned    deviceRB = fDevice.rowBytes();
+    size_t    deviceRB = fDevice.rowBytes();
 
     // TODO: respect fDoDither
     unsigned scale5 = SkAlpha255To256(alpha) * fScale >> (8 + 3);
@@ -678,7 +678,7 @@
 void SkRGB16_Blitter::blitRect(int x, int y, int width, int height) {
     SkASSERT(x + width <= fDevice.width() && y + height <= fDevice.height());
     uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
-    unsigned    deviceRB = fDevice.rowBytes();
+    size_t    deviceRB = fDevice.rowBytes();
     SkPMColor src32 = fSrcColor32;
 
     while (--height >= 0) {
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 92bd32c..3b44895 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -354,7 +354,7 @@
     SkASSERT(bitmap);
 
     uint16_t* addr = bitmap->getAddr16(0, 0);
-    int rb = bitmap->rowBytes();
+    size_t    rb = bitmap->rowBytes();
 
     for (int i = 0; i < count; i++) {
         int x = SkScalarFloorToInt(devPts[i].fX);
@@ -375,7 +375,7 @@
     SkASSERT(bitmap);
 
     SkPMColor* addr = bitmap->getAddr32(0, 0);
-    int rb = bitmap->rowBytes();
+    size_t     rb = bitmap->rowBytes();
 
     for (int i = 0; i < count; i++) {
         int x = SkScalarFloorToInt(devPts[i].fX);
@@ -1161,7 +1161,7 @@
         SkMask  mask;
         mask.fBounds.set(ix, iy, ix + bitmap.width(), iy + bitmap.height());
         mask.fFormat = SkMask::kA8_Format;
-        mask.fRowBytes = bitmap.rowBytes();
+        mask.fRowBytes = SkToU32(bitmap.rowBytes());
         mask.fImage = bitmap.getAddr8(0, 0);
 
         this->drawDevMask(mask, paint);
diff --git a/src/core/SkOrderedReadBuffer.cpp b/src/core/SkOrderedReadBuffer.cpp
index 990de45..2c83ce0 100644
--- a/src/core/SkOrderedReadBuffer.cpp
+++ b/src/core/SkOrderedReadBuffer.cpp
@@ -89,7 +89,7 @@
 
 char* SkOrderedReadBuffer::readString() {
     const char* string = fReader.readString();
-    const int32_t length = strlen(string);
+    const size_t length = strlen(string);
     char* value = (char*)sk_malloc_throw(length + 1);
     strcpy(value, string);
     return value;
diff --git a/src/core/SkSpriteBlitterTemplate.h b/src/core/SkSpriteBlitterTemplate.h
index c43e582..0243e4f 100644
--- a/src/core/SkSpriteBlitterTemplate.h
+++ b/src/core/SkSpriteBlitterTemplate.h
@@ -22,8 +22,8 @@
         SkSPRITE_DST_TYPE* SK_RESTRICT dst =fDevice->SkSPRITE_DST_GETADDR(x, y);
         const SkSPRITE_SRC_TYPE* SK_RESTRICT src =
                                       fSource->SkSPRITE_SRC_GETADDR(srcX, srcY);
-        unsigned dstRB = fDevice->rowBytes();
-        unsigned srcRB = fSource->rowBytes();
+        size_t dstRB = fDevice->rowBytes();
+        size_t srcRB = fSource->rowBytes();
 
         SkDEBUGCODE((void)fDevice->SkSPRITE_DST_GETADDR(x + width - 1, y + height - 1);)
         SkDEBUGCODE((void)fSource->SkSPRITE_SRC_GETADDR(srcX + width  - 1, srcY + height - 1);)
diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp
index 80d3225..255ef26 100644
--- a/src/core/SkSpriteBlitter_ARGB32.cpp
+++ b/src/core/SkSpriteBlitter_ARGB32.cpp
@@ -127,8 +127,8 @@
         uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y);
         const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft,
                                                              y - fTop);
-        unsigned dstRB = fDevice->rowBytes();
-        unsigned srcRB = fSource->rowBytes();
+        size_t dstRB = fDevice->rowBytes();
+        size_t srcRB = fSource->rowBytes();
         SkColorFilter* colorFilter = fColorFilter;
         SkXfermode* xfermode = fXfermode;
 
@@ -174,8 +174,8 @@
         SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
         const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
                                                                 y - fTop);
-        unsigned dstRB = fDevice->rowBytes();
-        unsigned srcRB = fSource->rowBytes();
+        size_t dstRB = fDevice->rowBytes();
+        size_t srcRB = fSource->rowBytes();
         SkPMColor* SK_RESTRICT buffer = fBuffer;
         SkColorFilter* colorFilter = fColorFilter;
         SkXfermode* xfermode = fXfermode;
@@ -221,8 +221,8 @@
         SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
         const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
                                                                 y - fTop);
-        unsigned dstRB = fDevice->rowBytes();
-        unsigned srcRB = fSource->rowBytes();
+        size_t dstRB = fDevice->rowBytes();
+        size_t srcRB = fSource->rowBytes();
 
         do {
             src_row(dst, src, width);
@@ -250,8 +250,8 @@
         SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
         const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
                                                                 y - fTop);
-        unsigned dstRB = fDevice->rowBytes();
-        unsigned srcRB = fSource->rowBytes();
+        size_t dstRB = fDevice->rowBytes();
+        size_t srcRB = fSource->rowBytes();
 
         do {
             srcover_row(dst, src, width);
diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp
index 1a8404f..9936867 100644
--- a/src/core/SkSpriteBlitter_RGB16.cpp
+++ b/src/core/SkSpriteBlitter_RGB16.cpp
@@ -58,8 +58,8 @@
         uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y);
         const uint16_t* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
                                                              y - fTop);
-        unsigned dstRB = fDevice->rowBytes();
-        unsigned srcRB = fSource->rowBytes();
+        size_t dstRB = fDevice->rowBytes();
+        size_t srcRB = fSource->rowBytes();
 
         while (--height >= 0) {
             memcpy(dst, src, width << 1);
@@ -285,8 +285,8 @@
         uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y);
         const SkPMColor* SK_RESTRICT src = fSource->getAddr32(x - fLeft,
                                                               y - fTop);
-        unsigned dstRB = fDevice->rowBytes();
-        unsigned srcRB = fSource->rowBytes();
+        size_t dstRB = fDevice->rowBytes();
+        size_t srcRB = fSource->rowBytes();
         SkBlitRow::Proc proc = fProc;
         U8CPU alpha = fPaint->getAlpha();
 
diff --git a/src/images/SkScaledBitmapSampler.h b/src/images/SkScaledBitmapSampler.h
index f6de4cc..1466309 100644
--- a/src/images/SkScaledBitmapSampler.h
+++ b/src/images/SkScaledBitmapSampler.h
@@ -57,7 +57,7 @@
 
     // setup state
     char*   fDstRow; // points into bitmap's pixels
-    int     fDstRowBytes;
+    size_t  fDstRowBytes;
     int     fCurrY; // used for dithering
     int     fSrcPixelSize;  // 1, 3, 4
     RowProc fRowProc;
diff --git a/src/lazy/SkLazyPixelRef.cpp b/src/lazy/SkLazyPixelRef.cpp
index c0d5d90..c262884 100644
--- a/src/lazy/SkLazyPixelRef.cpp
+++ b/src/lazy/SkLazyPixelRef.cpp
@@ -49,7 +49,7 @@
     Sk64 safeSize;
     safeSize.setZero();
     if (info.fHeight > 0) {
-        safeSize.setMul(info.fHeight, *rowBytes);
+        safeSize.setMul(info.fHeight, SkToS32(*rowBytes));
     }
     SkASSERT(!safeSize.isNeg());
     return safeSize.is32() ? safeSize.get32() : 0;
diff --git a/src/opts/SkBitmapProcState_opts_SSE2.cpp b/src/opts/SkBitmapProcState_opts_SSE2.cpp
index c2de259..4bba8c3 100644
--- a/src/opts/SkBitmapProcState_opts_SSE2.cpp
+++ b/src/opts/SkBitmapProcState_opts_SSE2.cpp
@@ -20,7 +20,7 @@
     SkASSERT(s.fAlphaScale == 256);
 
     const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels());
-    unsigned rb = s.fBitmap->rowBytes();
+    size_t rb = s.fBitmap->rowBytes();
     uint32_t XY = *xy++;
     unsigned y0 = XY >> 14;
     const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb);
@@ -126,7 +126,7 @@
     SkASSERT(s.fAlphaScale < 256);
 
     const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels());
-    unsigned rb = s.fBitmap->rowBytes();
+    size_t rb = s.fBitmap->rowBytes();
     uint32_t XY = *xy++;
     unsigned y0 = XY >> 14;
     const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb);
@@ -647,7 +647,7 @@
 
     SkPMColor dstColor;
     const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels());
-    unsigned rb = s.fBitmap->rowBytes();
+    size_t rb = s.fBitmap->rowBytes();
     uint32_t XY = *xy++;
     unsigned y0 = XY >> 14;
     const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb);
diff --git a/src/opts/SkBitmapProcState_opts_SSSE3.cpp b/src/opts/SkBitmapProcState_opts_SSSE3.cpp
index 59b2386..1246b95 100644
--- a/src/opts/SkBitmapProcState_opts_SSSE3.cpp
+++ b/src/opts/SkBitmapProcState_opts_SSSE3.cpp
@@ -395,7 +395,7 @@
 
     const uint8_t* src_addr =
             static_cast<const uint8_t*>(s.fBitmap->getPixels());
-    const unsigned rb = s.fBitmap->rowBytes();
+    const size_t rb = s.fBitmap->rowBytes();
     const uint32_t XY = *xy++;
     const unsigned y0 = XY >> 14;
     const uint32_t* row0 =
@@ -586,7 +586,7 @@
 
     const uint8_t* src_addr =
                         static_cast<const uint8_t*>(s.fBitmap->getPixels());
-    const unsigned rb = s.fBitmap->rowBytes();
+    const size_t rb = s.fBitmap->rowBytes();
 
     // vector constants
     const __m128i mask_dist_select = _mm_set_epi8(12, 12, 12, 12,
diff --git a/src/pipe/utils/SamplePipeControllers.cpp b/src/pipe/utils/SamplePipeControllers.cpp
index 98fdff3..10e4ea0 100644
--- a/src/pipe/utils/SamplePipeControllers.cpp
+++ b/src/pipe/utils/SamplePipeControllers.cpp
@@ -92,7 +92,7 @@
         PipeBlock previousBloc(fBlock, fBytesWritten);
         fBlockList.push(previousBloc);
     }
-    int32_t blockSize = SkMax32(minRequest, kMinBlockSize);
+    int32_t blockSize = SkMax32(SkToS32(minRequest), kMinBlockSize);
     fBlock = fAllocator.allocThrow(blockSize);
     fBytesWritten = 0;
     *actual = blockSize;