summaryrefslogtreecommitdiff
path: root/core/fxge/dib/cfx_dibbase.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/dib/cfx_dibbase.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/dib/cfx_dibbase.cpp')
-rw-r--r--core/fxge/dib/cfx_dibbase.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/fxge/dib/cfx_dibbase.cpp b/core/fxge/dib/cfx_dibbase.cpp
index 7fc9bef9cb..1dcbcf9e17 100644
--- a/core/fxge/dib/cfx_dibbase.cpp
+++ b/core/fxge/dib/cfx_dibbase.cpp
@@ -1171,17 +1171,19 @@ RetainPtr<CFX_DIBitmap> CFX_DIBBase::TransformTo(const CFX_Matrix& mtDest,
int* result_left,
int* result_top) {
RetainPtr<CFX_DIBBase> holder(this);
- CFX_ImageTransformer transformer(holder, mtDest, 0, nullptr);
+ CFX_ImageTransformer transformer(holder, mtDest, FXDIB_ResampleOptions(),
+ nullptr);
transformer.Continue(nullptr);
*result_left = transformer.result().left;
*result_top = transformer.result().top;
return transformer.DetachBitmap();
}
-RetainPtr<CFX_DIBitmap> CFX_DIBBase::StretchTo(int dest_width,
- int dest_height,
- uint32_t flags,
- const FX_RECT* pClip) {
+RetainPtr<CFX_DIBitmap> CFX_DIBBase::StretchTo(
+ int dest_width,
+ int dest_height,
+ const FXDIB_ResampleOptions& options,
+ const FX_RECT* pClip) {
RetainPtr<CFX_DIBBase> holder(this);
FX_RECT clip_rect(0, 0, abs(dest_width), abs(dest_height));
if (pClip)
@@ -1195,7 +1197,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBBase::StretchTo(int dest_width,
CFX_BitmapStorer storer;
CFX_ImageStretcher stretcher(&storer, holder, dest_width, dest_height,
- clip_rect, flags);
+ clip_rect, options);
if (stretcher.Start())
stretcher.Continue(nullptr);