diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-26 22:52:48 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-26 22:52:48 +0000 |
commit | 5883300439287ab46559231ce8aed11e92bbc97c (patch) | |
tree | 2c3499da9df5a2c4e2fb9d13f99bde13b7bebb42 /core/fxge/dib/cfx_imagetransformer.h | |
parent | 9590dee526c514d87dc1f47569d1136ffcf539ad (diff) | |
download | pdfium-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_imagetransformer.h')
-rw-r--r-- | core/fxge/dib/cfx_imagetransformer.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h index 052df941d4..b0b854c333 100644 --- a/core/fxge/dib/cfx_imagetransformer.h +++ b/core/fxge/dib/cfx_imagetransformer.h @@ -23,7 +23,7 @@ class CFX_ImageTransformer { public: CFX_ImageTransformer(const RetainPtr<CFX_DIBBase>& pSrc, const CFX_Matrix& matrix, - uint32_t flags, + const FXDIB_ResampleOptions& options, const FX_RECT* pClip); ~CFX_ImageTransformer(); @@ -73,10 +73,8 @@ class CFX_ImageTransformer { void CalcMono(const CalcData& cdata, FXDIB_Format format); void CalcColor(const CalcData& cdata, FXDIB_Format format, int Bpp); - bool IsBilinear() const { - return !(m_Flags & FXDIB_DOWNSAMPLE) && !IsBiCubic(); - } - bool IsBiCubic() const { return !!(m_Flags & FXDIB_BICUBIC_INTERPOL); } + bool IsBilinear() const; + bool IsBiCubic() const; int stretch_width() const { return m_StretchClip.Width(); } int stretch_height() const { return m_StretchClip.Height(); } @@ -106,7 +104,7 @@ class CFX_ImageTransformer { CFX_Matrix m_dest2stretch; std::unique_ptr<CFX_ImageStretcher> m_Stretcher; CFX_BitmapStorer m_Storer; - const uint32_t m_Flags; + const FXDIB_ResampleOptions m_ResampleOptions; int m_Status = 0; }; |