summaryrefslogtreecommitdiff
path: root/core/fxge/agg
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-26 22:52:48 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-26 22:52:48 +0000
commit5883300439287ab46559231ce8aed11e92bbc97c (patch)
tree2c3499da9df5a2c4e2fb9d13f99bde13b7bebb42 /core/fxge/agg
parent9590dee526c514d87dc1f47569d1136ffcf539ad (diff)
downloadpdfium-5883300439287ab46559231ce8aed11e92bbc97c.tar.xz
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 <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/agg')
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp10
-rw-r--r--core/fxge/agg/fx_agg_driver.h4
2 files changed, 7 insertions, 7 deletions
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<CFX_DIBBase>& 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<CFX_DIBBase>& 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<CFX_ImageRenderer>* handle,
BlendMode blend_type) {
if (!m_pBitmap->GetBuffer())
return true;
*handle = pdfium::MakeUnique<CFX_ImageRenderer>(
- 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<CFX_DIBBase>& pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix& matrix,
- uint32_t flags,
+ const FXDIB_ResampleOptions& options,
std::unique_ptr<CFX_ImageRenderer>* handle,
BlendMode blend_type) override;
bool ContinueDIBits(CFX_ImageRenderer* handle,