diff options
-rw-r--r-- | bench/benchmain.cpp | 6 | ||||
-rw-r--r-- | include/core/SkUtils.h | 5 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgramDesc.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL_program.cpp | 2 | ||||
-rw-r--r-- | src/images/bmpdecoderhelper.cpp | 10 | ||||
-rw-r--r-- | src/images/bmpdecoderhelper.h | 6 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 2 | ||||
-rw-r--r-- | src/pdf/SkPDFDeviceFlattener.cpp | 2 | ||||
-rw-r--r-- | src/pdf/SkPDFImage.cpp | 2 | ||||
-rw-r--r-- | src/utils/debugger/SkObjectParser.cpp | 6 | ||||
-rw-r--r-- | src/views/win/SkOSWindow_win.cpp | 7 |
12 files changed, 28 insertions, 24 deletions
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp index de38cc9eb5..697f4fb6cc 100644 --- a/bench/benchmain.cpp +++ b/bench/benchmain.cpp @@ -443,13 +443,13 @@ int tool_main(int argc, char** argv) { // Find the longest name of the benches we're going to run to make the output pretty. Iter names; SkBenchmark* bench; - int longestName = 0; + size_t longestName = 0; while ((bench = names.next()) != NULL) { SkAutoTUnref<SkBenchmark> benchUnref(bench); if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { continue; } - const int length = strlen(bench->getName()); + const size_t length = strlen(bench->getName()); longestName = length > longestName ? length : longestName; } @@ -539,7 +539,7 @@ int tool_main(int argc, char** argv) { loggedBenchName = true; SkString str; str.printf("running bench [%3d %3d] %*s ", - dim.fX, dim.fY, longestName, bench->getName()); + dim.fX, dim.fY, (int)longestName, bench->getName()); logger.logProgress(str); } diff --git a/include/core/SkUtils.h b/include/core/SkUtils.h index c2dcad950f..d6bf8dd3ee 100644 --- a/include/core/SkUtils.h +++ b/include/core/SkUtils.h @@ -71,8 +71,7 @@ size_t SkUTF8_FromUnichar(SkUnichar uni, char utf8[] = NULL); #define SkUTF16_IsLowSurrogate(c) (((c) & 0xFC00) == 0xDC00) int SkUTF16_CountUnichars(const uint16_t utf16[]); -int SkUTF16_CountUnichars(const uint16_t utf16[], - int numberOf16BitValues); +int SkUTF16_CountUnichars(const uint16_t utf16[], int numberOf16BitValues); // returns the current unichar and then moves past it (*p++) SkUnichar SkUTF16_NextUnichar(const uint16_t**); // this guy backs up to the previus unichar value, and returns it (*--p) @@ -80,7 +79,7 @@ SkUnichar SkUTF16_PrevUnichar(const uint16_t**); size_t SkUTF16_FromUnichar(SkUnichar uni, uint16_t utf16[] = NULL); size_t SkUTF16_ToUTF8(const uint16_t utf16[], int numberOf16BitValues, - char utf8[] = NULL); + char utf8[] = NULL); inline bool SkUnichar_IsVariationSelector(SkUnichar uni) { /* The 'true' ranges are: diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 747688ed8b..afdc7e92df 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -571,7 +571,7 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, fContext->drawVertices(grPaint, gPointMode2PrimtiveType[mode], - count, + SkToS32(count), (GrPoint*)pts, NULL, NULL, diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp index d95874252e..e655210a45 100644 --- a/src/gpu/gl/GrGLProgramDesc.cpp +++ b/src/gpu/gl/GrGLProgramDesc.cpp @@ -105,7 +105,7 @@ void GrGLProgramDesc::Build(const GrDrawState& drawState, memset(desc->header(), 0, kHeaderSize); } // write the key length - *desc->atOffset<uint32_t, kLengthOffset>() = newKeyLength; + *desc->atOffset<uint32_t, kLengthOffset>() = SkToU32(newKeyLength); KeyHeader* header = desc->header(); EffectKey* effectKeys = desc->effectKeys(); diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index 4f9adb727d..a777e8f3ba 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -291,7 +291,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) { - GrGLsizei stride = this->getDrawState().getVertexSize(); + GrGLsizei stride = static_cast<GrGLsizei>(this->getDrawState().getVertexSize()); size_t vertexOffsetInBytes = stride * info.startVertex(); diff --git a/src/images/bmpdecoderhelper.cpp b/src/images/bmpdecoderhelper.cpp index 77496649c2..5a1b39ac90 100644 --- a/src/images/bmpdecoderhelper.cpp +++ b/src/images/bmpdecoderhelper.cpp @@ -18,7 +18,7 @@ static const int kBmpOS2InfoSize = 12; static const int kMaxDim = SHRT_MAX / 2; bool BmpDecoderHelper::DecodeImage(const char* p, - int len, + size_t len, int max_pixels, BmpDecoderCallback* callback) { data_ = reinterpret_cast<const uint8*>(p); @@ -153,7 +153,7 @@ bool BmpDecoderHelper::DecodeImage(const char* p, rowLen += rowPad_; } - if (offset > 0 && offset > pos_ && offset < len_) { + if (offset > 0 && (size_t)offset > pos_ && (size_t)offset < len_) { pos_ = offset; } // Deliberately off-by-one; a load of BMPs seem to have their last byte @@ -182,7 +182,7 @@ void BmpDecoderHelper::DoRLEDecode() { static const uint8 RLE_DELTA = 2; int x = 0; int y = height_ - 1; - while (pos_ < len_ - 1) { + while (pos_ + 1 < len_) { uint8 cmd = GetByte(); if (cmd != RLE_ESCAPE) { uint8 pixels = GetByte(); @@ -210,7 +210,7 @@ void BmpDecoderHelper::DoRLEDecode() { return; } } else if (cmd == RLE_DELTA) { - if (pos_ < len_ - 1) { + if (pos_ + 1 < len_) { uint8 dx = GetByte(); uint8 dy = GetByte(); x += dx; @@ -336,7 +336,7 @@ int BmpDecoderHelper::GetShort() { } uint8 BmpDecoderHelper::GetByte() { - CHECK(pos_ >= 0 && pos_ <= len_); + CHECK(pos_ <= len_); // We deliberately allow this off-by-one access to cater for BMPs with their // last byte missing. if (pos_ == len_) { diff --git a/src/images/bmpdecoderhelper.h b/src/images/bmpdecoderhelper.h index f2f410941e..a0116de833 100644 --- a/src/images/bmpdecoderhelper.h +++ b/src/images/bmpdecoderhelper.h @@ -72,7 +72,7 @@ class BmpDecoderHelper { BmpDecoderHelper() { } ~BmpDecoderHelper() { } bool DecodeImage(const char* data, - int len, + size_t len, int max_pixels, BmpDecoderCallback* callback); @@ -90,8 +90,8 @@ class BmpDecoderHelper { int CalcShiftLeft(uint32 mask); const uint8* data_; - int pos_; - int len_; + size_t pos_; + size_t len_; int width_; int height_; int bpp_; diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 0b15d6ab43..804dc41074 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -123,7 +123,7 @@ static void align_text(SkDrawCacheProc glyphCacheProc, const SkPaint& paint, *y = *y - yAdj; } -static size_t max_glyphid_for_typeface(SkTypeface* typeface) { +static int max_glyphid_for_typeface(SkTypeface* typeface) { SkAutoResolveDefaultTypeface autoResolve(typeface); typeface = autoResolve.get(); return typeface->countGlyphs() - 1; diff --git a/src/pdf/SkPDFDeviceFlattener.cpp b/src/pdf/SkPDFDeviceFlattener.cpp index 9c0bf41db2..91c9803c32 100644 --- a/src/pdf/SkPDFDeviceFlattener.cpp +++ b/src/pdf/SkPDFDeviceFlattener.cpp @@ -43,7 +43,7 @@ void SkPDFDeviceFlattener::drawPoints(const SkDraw& d, SkCanvas::PointMode mode, flattenPaint(d, &paintFlatten); SkPoint* flattenedPoints = SkNEW_ARRAY(SkPoint, count); - d.fMatrix->mapPoints(flattenedPoints, points, count); + d.fMatrix->mapPoints(flattenedPoints, points, SkToS32(count)); SkDraw draw(d); SkMatrix identity = SkMatrix::I(); draw.fMatrix = &identity; diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp index c3dc396fc4..f2b105d473 100644 --- a/src/pdf/SkPDFImage.cpp +++ b/src/pdf/SkPDFImage.cpp @@ -426,7 +426,7 @@ static SkBitmap unpremultiply_bitmap(const SkBitmap& bitmap, SkBitmap outBitmap; outBitmap.setConfig(bitmap.config(), srcRect.width(), srcRect.height()); outBitmap.allocPixels(); - size_t dstRow = 0; + int dstRow = 0; outBitmap.lockPixels(); bitmap.lockPixels(); diff --git a/src/utils/debugger/SkObjectParser.cpp b/src/utils/debugger/SkObjectParser.cpp index 107e04a258..35cf1b9f84 100644 --- a/src/utils/debugger/SkObjectParser.cpp +++ b/src/utils/debugger/SkObjectParser.cpp @@ -335,9 +335,11 @@ SkString* SkObjectParser::TextToString(const void* text, size_t byteLength, } case SkPaint::kUTF16_TextEncoding: { decodedText->append("UTF-16: "); - size_t sizeNeeded = SkUTF16_ToUTF8((uint16_t*)text, byteLength / 2, NULL); + size_t sizeNeeded = SkUTF16_ToUTF8((uint16_t*)text, + SkToS32(byteLength / 2), + NULL); SkAutoSTMalloc<0x100, char> utf8(sizeNeeded); - SkUTF16_ToUTF8((uint16_t*)text, byteLength / 2, utf8); + SkUTF16_ToUTF8((uint16_t*)text, SkToS32(byteLength / 2), utf8); decodedText->append(utf8, sizeNeeded); break; } diff --git a/src/views/win/SkOSWindow_win.cpp b/src/views/win/SkOSWindow_win.cpp index 6bedd2dd8e..7549ea21da 100644 --- a/src/views/win/SkOSWindow_win.cpp +++ b/src/views/win/SkOSWindow_win.cpp @@ -130,9 +130,12 @@ bool SkOSWindow::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) this->handleChar(SkUTF8_ToUnichar((char*)&wParam)); return true; } break; - case WM_SIZE: - this->resize(lParam & 0xFFFF, lParam >> 16); + case WM_SIZE: { + INT width = LOWORD(lParam); + INT height = HIWORD(lParam); + this->resize(width, height); break; + } case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); |