From e5f48243bdbed2662be7a31be0888abc273b09e8 Mon Sep 17 00:00:00 2001 From: "scroggo@google.com" Date: Mon, 25 Feb 2013 21:47:41 +0000 Subject: 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 --- src/core/SkBitmap.cpp | 32 ++++++++++++++++--------------- src/core/SkBitmapProcState_sample.h | 8 ++++---- src/core/SkBitmapProcState_shaderproc.h | 2 +- src/core/SkBitmap_scroll.cpp | 2 +- src/core/SkBlitBWMaskTemplate.h | 2 +- src/core/SkBlitter_4444.cpp | 4 ++-- src/core/SkBlitter_A8.cpp | 2 +- src/core/SkBlitter_ARGB32.cpp | 2 +- src/core/SkBlitter_RGB16.cpp | 14 +++++++------- src/core/SkDraw.cpp | 6 +++--- src/core/SkOrderedReadBuffer.cpp | 2 +- src/core/SkSpriteBlitterTemplate.h | 4 ++-- src/core/SkSpriteBlitter_ARGB32.cpp | 16 ++++++++-------- src/core/SkSpriteBlitter_RGB16.cpp | 8 ++++---- src/images/SkScaledBitmapSampler.h | 2 +- src/lazy/SkLazyPixelRef.cpp | 2 +- src/opts/SkBitmapProcState_opts_SSE2.cpp | 6 +++--- src/opts/SkBitmapProcState_opts_SSSE3.cpp | 4 ++-- src/pipe/utils/SamplePipeControllers.cpp | 2 +- 19 files changed, 61 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 7db65271bd..fe4255d9b5 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -47,7 +47,7 @@ struct SkBitmap::MipMap : SkNoncopyable { 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 @@ size_t SkBitmap::ComputeRowBytes(Config c, int width) { 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 SkBitmap::ComputeSafeSize64(Config config, 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 @@ void SkBitmap::setConfig(Config c, int width, int height, size_t rowBytes) { fConfig = SkToU8(c); fWidth = width; fHeight = height; - fRowBytes = rowBytes; + fRowBytes = SkToU32(rowBytes); fBytesPerPixel = (uint8_t)ComputeBytesPerPixel(c); @@ -496,7 +498,7 @@ bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize, 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(getPixels()); uint8_t* dstP = reinterpret_cast(dst); @@ -864,7 +866,7 @@ static size_t getSubOffset(const SkBitmap& bm, int x, int y) { * 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 @@ static bool getUpperLeftFromOffset(const SkBitmap& bm, int* x, int* y) { 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 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const { 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 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst, Config dstConfig) const { } 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 @@ void SkBitmap::buildMipMap(bool forceRebuild) { 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 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha, 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 @@ void SkBitmap::flatten(SkFlattenableWriteBuffer& buffer) const { 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 b38eb779b3..ea377f2368 100644 --- a/src/core/SkBitmapProcState_sample.h +++ b/src/core/SkBitmapProcState_sample.h @@ -49,12 +49,12 @@ void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s, 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 @@ void MAKENAME(_filter_DX)(const SkBitmapProcState& s, 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 @@ void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s, 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 cf15a50598..6b8f74aedd 100644 --- a/src/core/SkBitmapProcState_shaderproc.h +++ b/src/core/SkBitmapProcState_shaderproc.h @@ -44,7 +44,7 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, int x, int y, 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 36e5f051e1..e9c886f4a0 100644 --- a/src/core/SkBitmap_scroll.cpp +++ b/src/core/SkBitmap_scroll.cpp @@ -82,7 +82,7 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy, 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 15ed54e7c4..fa25274427 100644 --- a/src/core/SkBlitBWMaskTemplate.h +++ b/src/core/SkBlitBWMaskTemplate.h @@ -31,7 +31,7 @@ static void SK_BLITBWMASK_NAME(const SkBitmap& bitmap, const SkMask& srcMask, co 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 3844b768aa..0d81f8ddb6 100644 --- a/src/core/SkBlitter_4444.cpp +++ b/src/core/SkBlitter_4444.cpp @@ -156,7 +156,7 @@ void SkARGB4444_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { 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(color, other); @@ -337,7 +337,7 @@ void SkARGB4444_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) { 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 4213c6b4dc..02554643d2 100644 --- a/src/core/SkBlitter_A8.cpp +++ b/src/core/SkBlitter_A8.cpp @@ -180,7 +180,7 @@ void SkA8_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { 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 16487ad2f4..d4bec1bc08 100644 --- a/src/core/SkBlitter_ARGB32.cpp +++ b/src/core/SkBlitter_ARGB32.cpp @@ -196,7 +196,7 @@ void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { } 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 175409ce29..4eead2b735 100644 --- a/src/core/SkBlitter_RGB16.cpp +++ b/src/core/SkBlitter_RGB16.cpp @@ -211,7 +211,7 @@ void SkRGB16_Black_Blitter::blitMask(const SkMask& mask, 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 @@ void SkRGB16_Opaque_Blitter::blitMask(const SkMask& mask, 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::blitMask(const SkMask& mask, 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::blitV(int x, int y, int height, SkAlpha alpha) { 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 @@ void SkRGB16_Blitter::blitMask(const SkMask& mask, 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::blitMask(const SkMask& mask, 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::blitV(int x, int y, int height, SkAlpha alpha) { 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 92bd32c638..3b44895dd0 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -354,7 +354,7 @@ static void bw_pt_rect_16_hair_proc(const PtProcRec& rec, 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 @@ static void bw_pt_rect_32_hair_proc(const PtProcRec& rec, 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 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap, 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 990de4574f..2c83ce0ac5 100644 --- a/src/core/SkOrderedReadBuffer.cpp +++ b/src/core/SkOrderedReadBuffer.cpp @@ -89,7 +89,7 @@ int32_t SkOrderedReadBuffer::read32() { 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 c43e582975..0243e4f28a 100644 --- a/src/core/SkSpriteBlitterTemplate.h +++ b/src/core/SkSpriteBlitterTemplate.h @@ -22,8 +22,8 @@ public: 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 80d3225b07..255ef26d40 100644 --- a/src/core/SkSpriteBlitter_ARGB32.cpp +++ b/src/core/SkSpriteBlitter_ARGB32.cpp @@ -127,8 +127,8 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: 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 1a8404f066..9936867f36 100644 --- a/src/core/SkSpriteBlitter_RGB16.cpp +++ b/src/core/SkSpriteBlitter_RGB16.cpp @@ -58,8 +58,8 @@ public: 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 @@ public: 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 f6de4ccc10..1466309a77 100644 --- a/src/images/SkScaledBitmapSampler.h +++ b/src/images/SkScaledBitmapSampler.h @@ -57,7 +57,7 @@ private: // 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 c0d5d9055b..c262884561 100644 --- a/src/lazy/SkLazyPixelRef.cpp +++ b/src/lazy/SkLazyPixelRef.cpp @@ -49,7 +49,7 @@ static size_t ComputeMinRowBytesAndSize(const SkImage::Info& info, size_t* rowBy 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 c2de2591d4..4bba8c3298 100644 --- a/src/opts/SkBitmapProcState_opts_SSE2.cpp +++ b/src/opts/SkBitmapProcState_opts_SSE2.cpp @@ -20,7 +20,7 @@ void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s, SkASSERT(s.fAlphaScale == 256); const char* srcAddr = static_cast(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(srcAddr + (y0 >> 4) * rb); @@ -126,7 +126,7 @@ void S32_alpha_D32_filter_DX_SSE2(const SkBitmapProcState& s, SkASSERT(s.fAlphaScale < 256); const char* srcAddr = static_cast(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(srcAddr + (y0 >> 4) * rb); @@ -647,7 +647,7 @@ void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s, SkPMColor dstColor; const char* srcAddr = static_cast(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(srcAddr + (y0 >> 4) * rb); diff --git a/src/opts/SkBitmapProcState_opts_SSSE3.cpp b/src/opts/SkBitmapProcState_opts_SSSE3.cpp index 59b23861c7..1246b953f4 100644 --- a/src/opts/SkBitmapProcState_opts_SSSE3.cpp +++ b/src/opts/SkBitmapProcState_opts_SSSE3.cpp @@ -395,7 +395,7 @@ void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s, const uint8_t* src_addr = static_cast(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 @@ void S32_generic_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, const uint8_t* src_addr = static_cast(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 98fdff31d6..10e4ea0f0a 100644 --- a/src/pipe/utils/SamplePipeControllers.cpp +++ b/src/pipe/utils/SamplePipeControllers.cpp @@ -92,7 +92,7 @@ void* ThreadSafePipeController::requestBlock(size_t minRequest, size_t *actual) 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; -- cgit v1.2.3