From ab99c380bfeb5bf2007c0928f816c737f733250f Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 8 Jul 2014 16:56:13 -0700 Subject: Revert commit 95c018e2d15ecc3a5bd2a9aab18638316a6d3d46 Fixes for re-enabling more MSVC level 4 warnings: pdfium/ edition BUG=81439 TBR=pkasting@chromium.org Review URL: https://codereview.chromium.org/376043003 --- core/include/fxcrt/fx_ucd.h | 14 ++++++++++++++ fpdfsdk/include/fpdfview.h | 9 +++++++-- fpdfsdk/src/fpdfview.cpp | 7 ++++--- samples/pdfium_test.cc | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/core/include/fxcrt/fx_ucd.h b/core/include/fxcrt/fx_ucd.h index 9e1862aa80..447d555a4b 100644 --- a/core/include/fxcrt/fx_ucd.h +++ b/core/include/fxcrt/fx_ucd.h @@ -88,6 +88,20 @@ enum FX_CHARTYPE { FX_CHARTYPE_ArabicForm = (11 << FX_CHARTYPEBITS), FX_CHARTYPE_Arabic = (12 << FX_CHARTYPEBITS), }; +typedef struct _FX_CHARPROPERTIES { + union { + struct { + FX_DWORD dwBreakType : 6; + FX_DWORD dwBidiClass : 5; + FX_DWORD dwCharType : 4; + FX_DWORD dwRotation : 1; + FX_DWORD dwCJKSpecial : 1; + FX_DWORD dwVertIndex : 6; + FX_DWORD dwBidiIndex : 9; + }; + FX_DWORD dwCharProps; + }; +} FX_CHARPROPERTIES; FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch); FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); FX_BOOL FX_IsRotationCode(FX_WCHAR ch); diff --git a/fpdfsdk/include/fpdfview.h b/fpdfsdk/include/fpdfview.h index f4f13750bc..a563762613 100644 --- a/fpdfsdk/include/fpdfview.h +++ b/fpdfsdk/include/fpdfview.h @@ -487,7 +487,11 @@ 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. -// color - A 32-bit value specifing the color, in 8888 ARGB format. +// 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. // Return value: // None. // Comments: @@ -496,7 +500,8 @@ 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, FPDF_DWORD color); +DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, + int red, int green, int blue, int alpha); // Function: FPDFBitmap_GetBuffer // Get data buffer of an FXDIB diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index a9aa9a8ff2..10eaf5d980 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -725,7 +725,8 @@ 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, FPDF_DWORD color) +DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, + int red, int green, int blue, int alpha) { if (bitmap == NULL) return; #ifdef _SKIA_SUPPORT_ @@ -734,9 +735,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()) color |= 0xFF000000; + if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) alpha = 255; FX_RECT rect(left, top, left+width, top+height); - device.FillRect(&rect, color); + device.FillRect(&rect, FXARGB_MAKE(alpha, red, green, blue)); } DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap) diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index f8e567349b..c504bf4823 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -230,7 +230,7 @@ void RenderPdf(const char* name, const char* pBuf, size_t len, int width = static_cast(FPDF_GetPageWidth(page)); int height = static_cast(FPDF_GetPageHeight(page)); FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); - FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF); + FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 255, 255, 255, 255); FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0); -- cgit v1.2.3