From 5883300439287ab46559231ce8aed11e92bbc97c Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 26 Oct 2018 22:52:48 +0000 Subject: Replace int flags with struct FXDIB_ResampleOptions. Using bit values in an int may not be reliable, since different parts of the code can interpret the bits differently. e.g. FXDIB_DOWNSAMPLE and RENDER_FORCE_DOWNSAMPLE are defined in different places, but can be used interchangeably because they just happen to have the same value. It works but is rather fragile. Instead, use a struct of bools to explicitly define what different bits mean. Remove FXDIB_DOWNSAMPLE and friends. Change-Id: I9cf0c8f94d1ed27edf8dba22b0ab0ee67f2722cc Reviewed-on: https://pdfium-review.googlesource.com/c/44650 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- core/fxge/cfx_renderdevice.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'core/fxge/cfx_renderdevice.h') diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index 4f802af3d7..d16188b611 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -171,14 +171,15 @@ class CFX_RenderDevice { int dest_width, int dest_height) { return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width, - dest_height, 0, BlendMode::kNormal); + dest_height, FXDIB_ResampleOptions(), + BlendMode::kNormal); } bool StretchDIBitsWithFlagsAndBlend(const RetainPtr& pBitmap, int left, int top, int dest_width, int dest_height, - uint32_t flags, + const FXDIB_ResampleOptions& options, BlendMode blend_type); bool SetBitMask(const RetainPtr& pBitmap, int left, @@ -196,21 +197,21 @@ class CFX_RenderDevice { int dest_width, int dest_height, uint32_t color, - uint32_t flags); + const FXDIB_ResampleOptions& options); bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix& matrix, - uint32_t flags, + const FXDIB_ResampleOptions& options, std::unique_ptr* handle) { - return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, matrix, flags, + return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, matrix, options, handle, BlendMode::kNormal); } bool StartDIBitsWithBlend(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix& matrix, - uint32_t flags, + const FXDIB_ResampleOptions& options, std::unique_ptr* handle, BlendMode blend_type); bool ContinueDIBits(CFX_ImageRenderer* handle, PauseIndicatorIface* pPause); -- cgit v1.2.3