summaryrefslogtreecommitdiff
path: root/core/fxge/cfx_renderdevice.cpp
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/cfx_renderdevice.cpp
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/cfx_renderdevice.cpp')
-rw-r--r--core/fxge/cfx_renderdevice.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 8fe1f6b3b0..e1bea7d611 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -774,14 +774,14 @@ bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
int top,
int dest_width,
int dest_height,
- uint32_t flags,
+ const FXDIB_ResampleOptions& options,
BlendMode blend_mode) {
FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
FX_RECT clip_box = m_ClipBox;
clip_box.Intersect(dest_rect);
return clip_box.IsEmpty() || m_pDeviceDriver->StretchDIBits(
pBitmap, 0, left, top, dest_width,
- dest_height, &clip_box, flags, blend_mode);
+ dest_height, &clip_box, options, blend_mode);
}
bool CFX_RenderDevice::SetBitMask(const RetainPtr<CFX_DIBBase>& pBitmap,
@@ -800,7 +800,7 @@ bool CFX_RenderDevice::StretchBitMask(const RetainPtr<CFX_DIBBase>& pBitmap,
int dest_height,
uint32_t color) {
return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height,
- color, 0);
+ color, FXDIB_ResampleOptions());
}
bool CFX_RenderDevice::StretchBitMaskWithFlags(
@@ -810,12 +810,12 @@ bool CFX_RenderDevice::StretchBitMaskWithFlags(
int dest_width,
int dest_height,
uint32_t argb,
- uint32_t flags) {
+ const FXDIB_ResampleOptions& options) {
FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
FX_RECT clip_box = m_ClipBox;
clip_box.Intersect(dest_rect);
return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width,
- dest_height, &clip_box, flags,
+ dest_height, &clip_box, options,
BlendMode::kNormal);
}
@@ -824,11 +824,11 @@ bool CFX_RenderDevice::StartDIBitsWithBlend(
int bitmap_alpha,
uint32_t argb,
const CFX_Matrix& matrix,
- uint32_t flags,
+ const FXDIB_ResampleOptions& options,
std::unique_ptr<CFX_ImageRenderer>* handle,
BlendMode blend_mode) {
return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, matrix,
- flags, handle, blend_mode);
+ options, handle, blend_mode);
}
bool CFX_RenderDevice::ContinueDIBits(CFX_ImageRenderer* handle,