Clean up a few warnings on Windows x64.
authorbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 22 Jul 2013 15:21:23 +0000 (15:21 +0000)
committerbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 22 Jul 2013 15:21:23 +0000 (15:21 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@10233 2bbb7eff-a529-9590-31e7-b0007b416f81

src/device/xps/SkXPSDevice.cpp
src/ports/SkFontHost_win.cpp
src/ports/SkImageDecoder_WIC.cpp
src/utils/SkThreadUtils_win.cpp
src/utils/win/SkIStream.cpp

index bfae6de..30e81bf 100644 (file)
@@ -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(
index 2238593..31ecdff 100755 (executable)
@@ -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<void*>(fontData->data()),
-                                             fontData->size(),
+                                             static_cast<DWORD>(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;
index e02ac31..77f4b95 100644 (file)
@@ -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<BYTE*>(bitmap->getPixels()));
     }
 
index 208ffde..a064d3b 100644 (file)
@@ -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<DWORD_PTR>(1) << currentBit)) {
             ++setBitsSeen;
             if (setBitsSeen > n) {
                 return currentBit;
index 1d00611..7880fa0 100644 (file)
@@ -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<ULONG>(this->fSkStream->read(pv, cb));
     this->fLocation.QuadPart += *pcbRead;
     return (*pcbRead == cb) ? S_OK : S_FALSE;
 }