From 4b18f5767ab1df7fedf0ff2e3a9eac7f7c500c36 Mon Sep 17 00:00:00 2001 From: "bungeman@google.com" Date: Mon, 22 Jul 2013 15:21:23 +0000 Subject: [PATCH] Clean up a few warnings on Windows x64. git-svn-id: http://skia.googlecode.com/svn/trunk@10233 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/device/xps/SkXPSDevice.cpp | 2 +- src/ports/SkFontHost_win.cpp | 9 ++++----- src/ports/SkImageDecoder_WIC.cpp | 7 ++++--- src/utils/SkThreadUtils_win.cpp | 2 +- src/utils/win/SkIStream.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp index bfae6de..30e81bf 100644 --- a/src/device/xps/SkXPSDevice.cpp +++ b/src/device/xps/SkXPSDevice.cpp @@ -2245,7 +2245,7 @@ static void text_draw_init(const SkPaint& paint, SkBitSet& glyphsUsed, SkDraw& myDraw, SkXPSDrawProcs& procs) { procs.fD1GProc = xps_draw_1_glyph; - int numGlyphGuess; + size_t numGlyphGuess; switch (paint.getTextEncoding()) { case SkPaint::kUTF8_TextEncoding: numGlyphGuess = SkUTF8_CountUnichars( diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 2238593..31ecdff 100755 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -1075,7 +1075,7 @@ static int is_not_black_or_white(SkGdiRGB c) { return (c + (c & 1)) & 0x00FFFFFF; } -static bool is_rgb_really_bw(const SkGdiRGB* src, int width, int height, int srcRB) { +static bool is_rgb_really_bw(const SkGdiRGB* src, int width, int height, size_t srcRB) { for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { if (is_not_black_or_white(src[x])) { @@ -1634,7 +1634,7 @@ static HANDLE activate_font(SkData* fontData) { DWORD numFonts = 0; //AddFontMemResourceEx just copies the data, but does not specify const. HANDLE fontHandle = AddFontMemResourceEx(const_cast(fontData->data()), - fontData->size(), + static_cast(fontData->size()), 0, &numFonts); @@ -1692,15 +1692,14 @@ SkStream* LogFontTypeface::onOpenStream(int* ttcIndex) const { SkMemoryStream* stream = NULL; DWORD tables[2] = {kTTCTag, 0}; for (int i = 0; i < SK_ARRAY_COUNT(tables); i++) { - size_t bufferSize = GetFontData(hdc, tables[i], 0, NULL, 0); + DWORD bufferSize = GetFontData(hdc, tables[i], 0, NULL, 0); if (bufferSize == GDI_ERROR) { call_ensure_accessible(lf); bufferSize = GetFontData(hdc, tables[i], 0, NULL, 0); } if (bufferSize != GDI_ERROR) { stream = new SkMemoryStream(bufferSize); - if (GetFontData(hdc, tables[i], 0, (void*)stream->getMemoryBase(), - bufferSize)) { + if (GetFontData(hdc, tables[i], 0, (void*)stream->getMemoryBase(), bufferSize)) { break; } else { delete stream; diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp index e02ac31..77f4b95 100644 --- a/src/ports/SkImageDecoder_WIC.cpp +++ b/src/ports/SkImageDecoder_WIC.cpp @@ -213,7 +213,7 @@ bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes w if (SUCCEEDED(hr)) { SkAutoLockPixels alp(*bm); bm->eraseColor(SK_ColorTRANSPARENT); - const int stride = bm->rowBytes(); + const UINT stride = bm->rowBytes(); hr = piBitmapSourceConverted->CopyPixels( NULL, //Get all the pixels stride, @@ -396,10 +396,11 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream //Write the pixels into the frame. if (SUCCEEDED(hr)) { SkAutoLockPixels alp(*bitmap); + const UINT stride = bitmap->rowBytes(); hr = piBitmapFrameEncode->WritePixels( height - , bitmap->rowBytes() - , bitmap->rowBytes()*height + , stride + , stride * height , reinterpret_cast(bitmap->getPixels())); } diff --git a/src/utils/SkThreadUtils_win.cpp b/src/utils/SkThreadUtils_win.cpp index 208ffde..a064d3b 100644 --- a/src/utils/SkThreadUtils_win.cpp +++ b/src/utils/SkThreadUtils_win.cpp @@ -108,7 +108,7 @@ static unsigned int num_bits_set(DWORD_PTR mask) { static unsigned int nth_set_bit(unsigned int n, DWORD_PTR mask) { n %= num_bits_set(mask); for (unsigned int setBitsSeen = 0, currentBit = 0; true; ++currentBit) { - if (mask & (1 << currentBit)) { + if (mask & (static_cast(1) << currentBit)) { ++setBitsSeen; if (setBitsSeen > n) { return currentBit; diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp index 1d00611..7880fa0 100644 --- a/src/utils/win/SkIStream.cpp +++ b/src/utils/win/SkIStream.cpp @@ -128,7 +128,7 @@ HRESULT SkIStream::CreateFromSkStream(SkStream* stream // ISequentialStream Interface HRESULT STDMETHODCALLTYPE SkIStream::Read(void* pv, ULONG cb, ULONG* pcbRead) { - *pcbRead = this->fSkStream->read(pv, cb); + *pcbRead = static_cast(this->fSkStream->read(pv, cb)); this->fLocation.QuadPart += *pcbRead; return (*pcbRead == cb) ? S_OK : S_FALSE; } -- 2.7.4