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
This commit is contained in:
scroggo@google.com 2013-02-25 21:47:41 +00:00
parent 10863051df
commit e5f48243bd
20 changed files with 62 additions and 60 deletions

View File

@ -645,7 +645,7 @@ private:
kImageIsImmutable_Flag = 0x04 kImageIsImmutable_Flag = 0x04
}; };
size_t fRowBytes; uint32_t fRowBytes;
uint32_t fWidth; uint32_t fWidth;
uint32_t fHeight; uint32_t fHeight;
uint8_t fConfig; uint8_t fConfig;

View File

@ -47,7 +47,7 @@ struct SkBitmap::MipMap : SkNoncopyable {
Sk64 size; Sk64 size;
size.setMul(levelCount + 1, sizeof(MipLevel)); size.setMul(levelCount + 1, sizeof(MipLevel));
size.add(sizeof(MipMap)); size.add(sizeof(MipMap));
size.add(pixelSize); size.add(SkToS32(pixelSize));
if (!isPos32Bits(size)) { if (!isPos32Bits(size)) {
return NULL; return NULL;
} }
@ -220,7 +220,7 @@ size_t SkBitmap::ComputeRowBytes(Config c, int width) {
Sk64 SkBitmap::ComputeSize64(Config c, int width, int height) { Sk64 SkBitmap::ComputeSize64(Config c, int width, int height) {
Sk64 size; Sk64 size;
size.setMul(SkBitmap::ComputeRowBytes(c, width), height); size.setMul(SkToS32(SkBitmap::ComputeRowBytes(c, width)), height);
return size; return size;
} }
@ -236,9 +236,11 @@ Sk64 SkBitmap::ComputeSafeSize64(Config config,
Sk64 safeSize; Sk64 safeSize;
safeSize.setZero(); safeSize.setZero();
if (height > 0) { 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; Sk64 sizeAllButLastRow;
sizeAllButLastRow.setMul(height - 1, rowBytes); sizeAllButLastRow.setMul(height - 1, SkToS32(rowBytes));
safeSize.add(sizeAllButLastRow); safeSize.add(sizeAllButLastRow);
} }
SkASSERT(!safeSize.isNeg()); SkASSERT(!safeSize.isNeg());
@ -283,7 +285,7 @@ void SkBitmap::setConfig(Config c, int width, int height, size_t rowBytes) {
fConfig = SkToU8(c); fConfig = SkToU8(c);
fWidth = width; fWidth = width;
fHeight = height; fHeight = height;
fRowBytes = rowBytes; fRowBytes = SkToU32(rowBytes);
fBytesPerPixel = (uint8_t)ComputeBytesPerPixel(c); fBytesPerPixel = (uint8_t)ComputeBytesPerPixel(c);
@ -496,7 +498,7 @@ bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize,
return false; return false;
else { else {
// Just copy what we need on each line. // Just copy what we need on each line.
uint32_t rowBytes = ComputeRowBytes(getConfig(), fWidth); size_t rowBytes = ComputeRowBytes(getConfig(), fWidth);
SkAutoLockPixels lock(*this); SkAutoLockPixels lock(*this);
const uint8_t* srcP = reinterpret_cast<const uint8_t*>(getPixels()); const uint8_t* srcP = reinterpret_cast<const uint8_t*>(getPixels());
uint8_t* dstP = reinterpret_cast<uint8_t*>(dst); uint8_t* dstP = reinterpret_cast<uint8_t*>(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. * upper left corner of bm relative to its SkPixelRef.
* x and y must be non-NULL. * 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); SkASSERT(x != NULL && y != NULL);
const size_t offset = bm.pixelRefOffset(); const size_t offset = bm.pixelRefOffset();
if (0 == offset) { if (0 == offset) {
@ -872,9 +874,9 @@ static bool getUpperLeftFromOffset(const SkBitmap& bm, int* x, int* y) {
return true; return true;
} }
// Use integer division to find the correct y position. // 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. // The remainder will be the x position, after we reverse getSubOffset.
*x = offset % bm.rowBytes(); *x = SkToS32(offset % bm.rowBytes());
switch (bm.getConfig()) { switch (bm.getConfig()) {
case SkBitmap::kA8_Config: case SkBitmap::kA8_Config:
// Fall through. // Fall through.
@ -948,7 +950,7 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const {
const RLEPixels* rle = (const RLEPixels*)this->getPixels(); const RLEPixels* rle = (const RLEPixels*)this->getPixels();
uint8_t* dst = bm.getAddr8(0, 0); uint8_t* dst = bm.getAddr8(0, 0);
const int width = bm.width(); 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++) { for (int y = r.fTop; y < r.fBottom; y++) {
SkPackBits::Unpack8(dst, r.fLeft, width, rle->packedAtY(y)); SkPackBits::Unpack8(dst, r.fLeft, width, rle->packedAtY(y));
@ -1141,7 +1143,7 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst, Config dstConfig) const {
} else { } else {
// Find the correct offset in the new config. This needs to be done after calling // 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. // setConfig so dst's fConfig and fRowBytes have been set properly.
int x, y; int32_t x, y;
if (!getUpperLeftFromOffset(*this, &x, &y)) { if (!getUpperLeftFromOffset(*this, &x, &y)) {
return false; return false;
} }
@ -1335,13 +1337,13 @@ void SkBitmap::buildMipMap(bool forceRebuild) {
uint8_t* addr = (uint8_t*)mm->pixels(); uint8_t* addr = (uint8_t*)mm->pixels();
int width = this->width(); int width = this->width();
int height = this->height(); int height = this->height();
unsigned rowBytes; uint32_t rowBytes;
SkBitmap dstBM; SkBitmap dstBM;
for (int i = 0; i < maxLevels; i++) { for (int i = 0; i < maxLevels; i++) {
width >>= 1; width >>= 1;
height >>= 1; height >>= 1;
rowBytes = ComputeRowBytes(config, width); rowBytes = SkToU32(ComputeRowBytes(config, width));
level[i].fPixels = addr; level[i].fPixels = addr;
level[i].fWidth = width; level[i].fWidth = width;
@ -1417,7 +1419,7 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha,
SkBitmap::Config config = src.getConfig(); SkBitmap::Config config = src.getConfig();
int w = src.width(); int w = src.width();
int h = src.height(); int h = src.height();
int rb = src.rowBytes(); size_t rb = src.rowBytes();
SkAutoLockPixels alp(src); SkAutoLockPixels alp(src);
if (!src.readyToDraw()) { if (!src.readyToDraw()) {
@ -1561,7 +1563,7 @@ void SkBitmap::flatten(SkFlattenableWriteBuffer& buffer) const {
if (fPixelRef) { if (fPixelRef) {
if (fPixelRef->getFactory()) { if (fPixelRef->getFactory()) {
buffer.writeInt(SERIALIZE_PIXELTYPE_REF_DATA); buffer.writeInt(SERIALIZE_PIXELTYPE_REF_DATA);
buffer.writeUInt(fPixelRefOffset); buffer.writeUInt(SkToU32(fPixelRefOffset));
buffer.writeFlattenable(fPixelRef); buffer.writeFlattenable(fPixelRef);
return; return;
} }

View File

@ -49,12 +49,12 @@ void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
PREAMBLE(s); PREAMBLE(s);
#endif #endif
const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels(); 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; uint32_t XY;
SRCTYPE src; SRCTYPE src;
for (i = (count >> 1); i > 0; --i) { for (int i = (count >> 1); i > 0; --i) {
XY = *xy++; XY = *xy++;
SkASSERT((XY >> 16) < (unsigned)s.fBitmap->height() && SkASSERT((XY >> 16) < (unsigned)s.fBitmap->height() &&
(XY & 0xFFFF) < (unsigned)s.fBitmap->width()); (XY & 0xFFFF) < (unsigned)s.fBitmap->width());
@ -146,7 +146,7 @@ void MAKENAME(_filter_DX)(const SkBitmapProcState& s,
PREAMBLE(s); PREAMBLE(s);
#endif #endif
const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels(); const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels();
unsigned rb = s.fBitmap->rowBytes(); size_t rb = s.fBitmap->rowBytes();
unsigned subY; unsigned subY;
const SRCTYPE* SK_RESTRICT row0; const SRCTYPE* SK_RESTRICT row0;
const SRCTYPE* SK_RESTRICT row1; const SRCTYPE* SK_RESTRICT row1;
@ -192,7 +192,7 @@ void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s,
PREAMBLE(s); PREAMBLE(s);
#endif #endif
const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels(); const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels();
int rb = s.fBitmap->rowBytes(); size_t rb = s.fBitmap->rowBytes();
do { do {
uint32_t data = *xy++; uint32_t data = *xy++;

View File

@ -44,7 +44,7 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s, int x, int y,
int y1 = TILEY_PROCF((fy + s.fFilterOneY), maxY); int y1 = TILEY_PROCF((fy + s.fFilterOneY), maxY);
const char* SK_RESTRICT srcAddr = (const char*)s.fBitmap->getPixels(); 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); row0 = (const SRCTYPE*)(srcAddr + y0 * rb);
row1 = (const SRCTYPE*)(srcAddr + y1 * rb); row1 = (const SRCTYPE*)(srcAddr + y1 * rb);
// now initialize fx // now initialize fx

View File

@ -82,7 +82,7 @@ bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy,
char* dst = (char*)this->getPixels(); char* dst = (char*)this->getPixels();
const char* src = dst; 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) { if (dy <= 0) {
src -= dy * rowBytes; src -= dy * rowBytes;

View File

@ -31,7 +31,7 @@ static void SK_BLITBWMASK_NAME(const SkBitmap& bitmap, const SkMask& srcMask, co
int cy = clip.fTop; int cy = clip.fTop;
int maskLeft = srcMask.fBounds.fLeft; int maskLeft = srcMask.fBounds.fLeft;
unsigned mask_rowBytes = srcMask.fRowBytes; unsigned mask_rowBytes = srcMask.fRowBytes;
unsigned bitmap_rowBytes = bitmap.rowBytes(); size_t bitmap_rowBytes = bitmap.rowBytes();
unsigned height = clip.height(); unsigned height = clip.height();
SkASSERT(mask_rowBytes != 0); SkASSERT(mask_rowBytes != 0);

View File

@ -156,7 +156,7 @@ void SkARGB4444_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
SkPMColor16* device = fDevice.getAddr16(x, y); SkPMColor16* device = fDevice.getAddr16(x, y);
SkPMColor16 color = fPMColor16; SkPMColor16 color = fPMColor16;
SkPMColor16 other = fPMColor16Other; SkPMColor16 other = fPMColor16Other;
unsigned rb = fDevice.rowBytes(); size_t rb = fDevice.rowBytes();
if ((x ^ y) & 1) { if ((x ^ y) & 1) {
SkTSwap<SkPMColor16>(color, other); SkTSwap<SkPMColor16>(color, other);
@ -337,7 +337,7 @@ void SkARGB4444_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
SkPMColor16* device = fDevice.getAddr16(x, y); SkPMColor16* device = fDevice.getAddr16(x, y);
const uint8_t* alpha = mask.getAddr8(x, y); const uint8_t* alpha = mask.getAddr8(x, y);
SkPMColor16 srcColor = fPMColor16; SkPMColor16 srcColor = fPMColor16;
unsigned devRB = fDevice.rowBytes() - (width << 1); size_t devRB = fDevice.rowBytes() - (width << 1);
unsigned maskRB = mask.fRowBytes - width; unsigned maskRB = mask.fRowBytes - width;
do { do {

View File

@ -180,7 +180,7 @@ void SkA8_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
unsigned sa = SkAlphaMul(fSrcA, SkAlpha255To256(alpha)); unsigned sa = SkAlphaMul(fSrcA, SkAlpha255To256(alpha));
uint8_t* device = fDevice.getAddr8(x, y); uint8_t* device = fDevice.getAddr8(x, y);
int rowBytes = fDevice.rowBytes(); size_t rowBytes = fDevice.rowBytes();
if (sa == 0xFF) { if (sa == 0xFF) {
for (int i = 0; i < height; i++) { for (int i = 0; i < height; i++) {

View File

@ -196,7 +196,7 @@ void SkARGB32_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
} }
unsigned dst_scale = 255 - SkGetPackedA32(color); unsigned dst_scale = 255 - SkGetPackedA32(color);
uint32_t rowBytes = fDevice.rowBytes(); size_t rowBytes = fDevice.rowBytes();
while (--height >= 0) { while (--height >= 0) {
device[0] = color + SkAlphaMulQ(device[0], dst_scale); device[0] = color + SkAlphaMulQ(device[0], dst_scale);
device = (uint32_t*)((char*)device + rowBytes); device = (uint32_t*)((char*)device + rowBytes);

View File

@ -211,7 +211,7 @@ void SkRGB16_Black_Blitter::blitMask(const SkMask& mask,
const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop); const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop);
unsigned width = clip.width(); unsigned width = clip.width();
unsigned height = clip.height(); unsigned height = clip.height();
unsigned deviceRB = fDevice.rowBytes() - (width << 1); size_t deviceRB = fDevice.rowBytes() - (width << 1);
unsigned maskRB = mask.fRowBytes - width; unsigned maskRB = mask.fRowBytes - width;
SkASSERT((int)height > 0); 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); const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop);
int width = clip.width(); int width = clip.width();
int height = clip.height(); int height = clip.height();
unsigned deviceRB = fDevice.rowBytes() - (width << 1); size_t deviceRB = fDevice.rowBytes() - (width << 1);
unsigned maskRB = mask.fRowBytes - width; unsigned maskRB = mask.fRowBytes - width;
uint32_t expanded32 = fExpandedRaw16; 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) { void SkRGB16_Opaque_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
unsigned deviceRB = fDevice.rowBytes(); size_t deviceRB = fDevice.rowBytes();
// TODO: respect fDoDither // TODO: respect fDoDither
unsigned scale5 = SkAlpha255To256(alpha) >> 3; 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) { void SkRGB16_Opaque_Blitter::blitRect(int x, int y, int width, int height) {
SkASSERT(x + width <= fDevice.width() && y + height <= fDevice.height()); SkASSERT(x + width <= fDevice.width() && y + height <= fDevice.height());
uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
unsigned deviceRB = fDevice.rowBytes(); size_t deviceRB = fDevice.rowBytes();
uint16_t color16 = fColor16; uint16_t color16 = fColor16;
if (fDoDither) { 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); const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop);
int width = clip.width(); int width = clip.width();
int height = clip.height(); int height = clip.height();
unsigned deviceRB = fDevice.rowBytes() - (width << 1); size_t deviceRB = fDevice.rowBytes() - (width << 1);
unsigned maskRB = mask.fRowBytes - width; unsigned maskRB = mask.fRowBytes - width;
uint32_t color32 = fExpandedRaw16; 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) { void SkRGB16_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
unsigned deviceRB = fDevice.rowBytes(); size_t deviceRB = fDevice.rowBytes();
// TODO: respect fDoDither // TODO: respect fDoDither
unsigned scale5 = SkAlpha255To256(alpha) * fScale >> (8 + 3); 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) { void SkRGB16_Blitter::blitRect(int x, int y, int width, int height) {
SkASSERT(x + width <= fDevice.width() && y + height <= fDevice.height()); SkASSERT(x + width <= fDevice.width() && y + height <= fDevice.height());
uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y); uint16_t* SK_RESTRICT device = fDevice.getAddr16(x, y);
unsigned deviceRB = fDevice.rowBytes(); size_t deviceRB = fDevice.rowBytes();
SkPMColor src32 = fSrcColor32; SkPMColor src32 = fSrcColor32;
while (--height >= 0) { while (--height >= 0) {

View File

@ -354,7 +354,7 @@ static void bw_pt_rect_16_hair_proc(const PtProcRec& rec,
SkASSERT(bitmap); SkASSERT(bitmap);
uint16_t* addr = bitmap->getAddr16(0, 0); uint16_t* addr = bitmap->getAddr16(0, 0);
int rb = bitmap->rowBytes(); size_t rb = bitmap->rowBytes();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
int x = SkScalarFloorToInt(devPts[i].fX); int x = SkScalarFloorToInt(devPts[i].fX);
@ -375,7 +375,7 @@ static void bw_pt_rect_32_hair_proc(const PtProcRec& rec,
SkASSERT(bitmap); SkASSERT(bitmap);
SkPMColor* addr = bitmap->getAddr32(0, 0); SkPMColor* addr = bitmap->getAddr32(0, 0);
int rb = bitmap->rowBytes(); size_t rb = bitmap->rowBytes();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
int x = SkScalarFloorToInt(devPts[i].fX); int x = SkScalarFloorToInt(devPts[i].fX);
@ -1161,7 +1161,7 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
SkMask mask; SkMask mask;
mask.fBounds.set(ix, iy, ix + bitmap.width(), iy + bitmap.height()); mask.fBounds.set(ix, iy, ix + bitmap.width(), iy + bitmap.height());
mask.fFormat = SkMask::kA8_Format; mask.fFormat = SkMask::kA8_Format;
mask.fRowBytes = bitmap.rowBytes(); mask.fRowBytes = SkToU32(bitmap.rowBytes());
mask.fImage = bitmap.getAddr8(0, 0); mask.fImage = bitmap.getAddr8(0, 0);
this->drawDevMask(mask, paint); this->drawDevMask(mask, paint);

View File

@ -89,7 +89,7 @@ int32_t SkOrderedReadBuffer::read32() {
char* SkOrderedReadBuffer::readString() { char* SkOrderedReadBuffer::readString() {
const char* string = fReader.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); char* value = (char*)sk_malloc_throw(length + 1);
strcpy(value, string); strcpy(value, string);
return value; return value;

View File

@ -22,8 +22,8 @@ public:
SkSPRITE_DST_TYPE* SK_RESTRICT dst =fDevice->SkSPRITE_DST_GETADDR(x, y); SkSPRITE_DST_TYPE* SK_RESTRICT dst =fDevice->SkSPRITE_DST_GETADDR(x, y);
const SkSPRITE_SRC_TYPE* SK_RESTRICT src = const SkSPRITE_SRC_TYPE* SK_RESTRICT src =
fSource->SkSPRITE_SRC_GETADDR(srcX, srcY); fSource->SkSPRITE_SRC_GETADDR(srcX, srcY);
unsigned dstRB = fDevice->rowBytes(); size_t dstRB = fDevice->rowBytes();
unsigned srcRB = fSource->rowBytes(); size_t srcRB = fSource->rowBytes();
SkDEBUGCODE((void)fDevice->SkSPRITE_DST_GETADDR(x + width - 1, y + height - 1);) SkDEBUGCODE((void)fDevice->SkSPRITE_DST_GETADDR(x + width - 1, y + height - 1);)
SkDEBUGCODE((void)fSource->SkSPRITE_SRC_GETADDR(srcX + width - 1, srcY + height - 1);) SkDEBUGCODE((void)fSource->SkSPRITE_SRC_GETADDR(srcX + width - 1, srcY + height - 1);)

View File

@ -127,8 +127,8 @@ public:
uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y); uint32_t* SK_RESTRICT dst = fDevice->getAddr32(x, y);
const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft, const uint32_t* SK_RESTRICT src = fSource->getAddr32(x - fLeft,
y - fTop); y - fTop);
unsigned dstRB = fDevice->rowBytes(); size_t dstRB = fDevice->rowBytes();
unsigned srcRB = fSource->rowBytes(); size_t srcRB = fSource->rowBytes();
SkColorFilter* colorFilter = fColorFilter; SkColorFilter* colorFilter = fColorFilter;
SkXfermode* xfermode = fXfermode; SkXfermode* xfermode = fXfermode;
@ -174,8 +174,8 @@ public:
SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y); SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft, const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
y - fTop); y - fTop);
unsigned dstRB = fDevice->rowBytes(); size_t dstRB = fDevice->rowBytes();
unsigned srcRB = fSource->rowBytes(); size_t srcRB = fSource->rowBytes();
SkPMColor* SK_RESTRICT buffer = fBuffer; SkPMColor* SK_RESTRICT buffer = fBuffer;
SkColorFilter* colorFilter = fColorFilter; SkColorFilter* colorFilter = fColorFilter;
SkXfermode* xfermode = fXfermode; SkXfermode* xfermode = fXfermode;
@ -221,8 +221,8 @@ public:
SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y); SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft, const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
y - fTop); y - fTop);
unsigned dstRB = fDevice->rowBytes(); size_t dstRB = fDevice->rowBytes();
unsigned srcRB = fSource->rowBytes(); size_t srcRB = fSource->rowBytes();
do { do {
src_row(dst, src, width); src_row(dst, src, width);
@ -250,8 +250,8 @@ public:
SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y); SkPMColor* SK_RESTRICT dst = fDevice->getAddr32(x, y);
const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft, const SkPMColor16* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
y - fTop); y - fTop);
unsigned dstRB = fDevice->rowBytes(); size_t dstRB = fDevice->rowBytes();
unsigned srcRB = fSource->rowBytes(); size_t srcRB = fSource->rowBytes();
do { do {
srcover_row(dst, src, width); srcover_row(dst, src, width);

View File

@ -58,8 +58,8 @@ public:
uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y); uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y);
const uint16_t* SK_RESTRICT src = fSource->getAddr16(x - fLeft, const uint16_t* SK_RESTRICT src = fSource->getAddr16(x - fLeft,
y - fTop); y - fTop);
unsigned dstRB = fDevice->rowBytes(); size_t dstRB = fDevice->rowBytes();
unsigned srcRB = fSource->rowBytes(); size_t srcRB = fSource->rowBytes();
while (--height >= 0) { while (--height >= 0) {
memcpy(dst, src, width << 1); memcpy(dst, src, width << 1);
@ -285,8 +285,8 @@ public:
uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y); uint16_t* SK_RESTRICT dst = fDevice->getAddr16(x, y);
const SkPMColor* SK_RESTRICT src = fSource->getAddr32(x - fLeft, const SkPMColor* SK_RESTRICT src = fSource->getAddr32(x - fLeft,
y - fTop); y - fTop);
unsigned dstRB = fDevice->rowBytes(); size_t dstRB = fDevice->rowBytes();
unsigned srcRB = fSource->rowBytes(); size_t srcRB = fSource->rowBytes();
SkBlitRow::Proc proc = fProc; SkBlitRow::Proc proc = fProc;
U8CPU alpha = fPaint->getAlpha(); U8CPU alpha = fPaint->getAlpha();

View File

@ -57,7 +57,7 @@ private:
// setup state // setup state
char* fDstRow; // points into bitmap's pixels char* fDstRow; // points into bitmap's pixels
int fDstRowBytes; size_t fDstRowBytes;
int fCurrY; // used for dithering int fCurrY; // used for dithering
int fSrcPixelSize; // 1, 3, 4 int fSrcPixelSize; // 1, 3, 4
RowProc fRowProc; RowProc fRowProc;

View File

@ -49,7 +49,7 @@ static size_t ComputeMinRowBytesAndSize(const SkImage::Info& info, size_t* rowBy
Sk64 safeSize; Sk64 safeSize;
safeSize.setZero(); safeSize.setZero();
if (info.fHeight > 0) { if (info.fHeight > 0) {
safeSize.setMul(info.fHeight, *rowBytes); safeSize.setMul(info.fHeight, SkToS32(*rowBytes));
} }
SkASSERT(!safeSize.isNeg()); SkASSERT(!safeSize.isNeg());
return safeSize.is32() ? safeSize.get32() : 0; return safeSize.is32() ? safeSize.get32() : 0;

View File

@ -20,7 +20,7 @@ void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s,
SkASSERT(s.fAlphaScale == 256); SkASSERT(s.fAlphaScale == 256);
const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); 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++; uint32_t XY = *xy++;
unsigned y0 = XY >> 14; unsigned y0 = XY >> 14;
const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb); const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb);
@ -126,7 +126,7 @@ void S32_alpha_D32_filter_DX_SSE2(const SkBitmapProcState& s,
SkASSERT(s.fAlphaScale < 256); SkASSERT(s.fAlphaScale < 256);
const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); 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++; uint32_t XY = *xy++;
unsigned y0 = XY >> 14; unsigned y0 = XY >> 14;
const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb); const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb);
@ -647,7 +647,7 @@ void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s,
SkPMColor dstColor; SkPMColor dstColor;
const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); 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++; uint32_t XY = *xy++;
unsigned y0 = XY >> 14; unsigned y0 = XY >> 14;
const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb); const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4) * rb);

View File

@ -395,7 +395,7 @@ void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s,
const uint8_t* src_addr = const uint8_t* src_addr =
static_cast<const uint8_t*>(s.fBitmap->getPixels()); 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 uint32_t XY = *xy++;
const unsigned y0 = XY >> 14; const unsigned y0 = XY >> 14;
const uint32_t* row0 = const uint32_t* row0 =
@ -586,7 +586,7 @@ void S32_generic_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s,
const uint8_t* src_addr = const uint8_t* src_addr =
static_cast<const uint8_t*>(s.fBitmap->getPixels()); static_cast<const uint8_t*>(s.fBitmap->getPixels());
const unsigned rb = s.fBitmap->rowBytes(); const size_t rb = s.fBitmap->rowBytes();
// vector constants // vector constants
const __m128i mask_dist_select = _mm_set_epi8(12, 12, 12, 12, const __m128i mask_dist_select = _mm_set_epi8(12, 12, 12, 12,

View File

@ -92,7 +92,7 @@ void* ThreadSafePipeController::requestBlock(size_t minRequest, size_t *actual)
PipeBlock previousBloc(fBlock, fBytesWritten); PipeBlock previousBloc(fBlock, fBytesWritten);
fBlockList.push(previousBloc); fBlockList.push(previousBloc);
} }
int32_t blockSize = SkMax32(minRequest, kMinBlockSize); int32_t blockSize = SkMax32(SkToS32(minRequest), kMinBlockSize);
fBlock = fAllocator.allocThrow(blockSize); fBlock = fAllocator.allocThrow(blockSize);
fBytesWritten = 0; fBytesWritten = 0;
*actual = blockSize; *actual = blockSize;