From 532a6a7ece21ca4ea253a196bb5c61a1861d12a0 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 9 Jul 2014 11:47:15 -0700 Subject: Fixes for re-enabling more MSVC level 4 warnings: pdfium/ edition (try 2) This contains fixes for the following sorts of issues: * Nonstandard extension: unnamed struct/union This also changes the signature of FPDF_FillRect() to enable the cleanest possible changes in https://codereview.chromium.org/372273005 . BUG=81439 TEST=none Original patch by Peter Kasting Original code review: https://codereview.chromium.org/376003003/ R=pkasting@chromium.org Review URL: https://codereview.chromium.org/377353002 --- fpdfsdk/include/fpdfview.h | 9 ++------- fpdfsdk/src/fpdfview.cpp | 7 +++---- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/include/fpdfview.h b/fpdfsdk/include/fpdfview.h index a563762613..f4f13750bc 100644 --- a/fpdfsdk/include/fpdfview.h +++ b/fpdfsdk/include/fpdfview.h @@ -487,11 +487,7 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int for // top - The top side position. Starting from 0 at the top-most scan line. // width - Number of pixels to be filled in each scan line. // height - Number of scan lines to be filled. -// red - A number from 0 to 255, identifying the red intensity. -// green - A number from 0 to 255, identifying the green intensity. -// blue - A number from 0 to 255, identifying the blue intensity. -// alpha - (Only if the alpha channeled is used when bitmap created) A number from 0 to 255, -// identifying the alpha value. +// color - A 32-bit value specifing the color, in 8888 ARGB format. // Return value: // None. // Comments: @@ -500,8 +496,7 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int for // instead the background will be replaced by the source color and alpha. // If alpha channel is not used, the "alpha" parameter is ignored. // -DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, - int red, int green, int blue, int alpha); +DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, FPDF_DWORD color); // Function: FPDFBitmap_GetBuffer // Get data buffer of an FXDIB diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 10eaf5d980..a9aa9a8ff2 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -725,8 +725,7 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int for return pBitmap; } -DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, - int red, int green, int blue, int alpha) +DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, FPDF_DWORD color) { if (bitmap == NULL) return; #ifdef _SKIA_SUPPORT_ @@ -735,9 +734,9 @@ DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top CFX_FxgeDevice device; #endif device.Attach((CFX_DIBitmap*)bitmap); - if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) alpha = 255; + if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) color |= 0xFF000000; FX_RECT rect(left, top, left+width, top+height); - device.FillRect(&rect, FXARGB_MAKE(alpha, red, green, blue)); + device.FillRect(&rect, color); } DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap) -- cgit v1.2.3