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/agg/fx_agg_driver.cpp | 10 +++++----- core/fxge/agg/fx_agg_driver.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'core/fxge/agg') diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 10293d865c..ff2b387d46 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -1519,7 +1519,7 @@ bool CFX_AggDeviceDriver::StretchDIBits(const RetainPtr& pSource, int dest_width, int dest_height, const FX_RECT* pClipRect, - uint32_t flags, + const FXDIB_ResampleOptions& options, BlendMode blend_type) { if (!m_pBitmap->GetBuffer()) return true; @@ -1539,7 +1539,7 @@ bool CFX_AggDeviceDriver::StretchDIBits(const RetainPtr& pSource, false, false, m_bRgbByteOrder, 0, blend_type); dest_clip.Offset(-dest_rect.left, -dest_rect.top); CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height, - dest_clip, flags); + dest_clip, options); if (stretcher.Start()) stretcher.Continue(nullptr); return true; @@ -1550,15 +1550,15 @@ bool CFX_AggDeviceDriver::StartDIBits( int bitmap_alpha, uint32_t argb, const CFX_Matrix& matrix, - uint32_t render_flags, + const FXDIB_ResampleOptions& options, std::unique_ptr* handle, BlendMode blend_type) { if (!m_pBitmap->GetBuffer()) return true; *handle = pdfium::MakeUnique( - m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, matrix, - render_flags, m_bRgbByteOrder); + m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, matrix, options, + m_bRgbByteOrder); return true; } diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index 00cae08be6..4983dc07d5 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -80,13 +80,13 @@ class CFX_AggDeviceDriver final : public RenderDeviceDriverIface { int dest_width, int dest_height, const FX_RECT* pClipRect, - uint32_t flags, + const FXDIB_ResampleOptions& options, BlendMode blend_type) override; 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, BlendMode blend_type) override; bool ContinueDIBits(CFX_ImageRenderer* handle, -- cgit v1.2.3