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/dib/cstretchengine_unittest.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'core/fxge/dib/cstretchengine_unittest.cpp') diff --git a/core/fxge/dib/cstretchengine_unittest.cpp b/core/fxge/dib/cstretchengine_unittest.cpp index 8169cae328..a79945c67d 100644 --- a/core/fxge/dib/cstretchengine_unittest.cpp +++ b/core/fxge/dib/cstretchengine_unittest.cpp @@ -27,6 +27,11 @@ TEST(CStretchEngine, OverflowInCtor) { auto dib_source = pdfium::MakeRetain(); dib_source->Load(nullptr, stream.get()); CStretchEngine engine(nullptr, FXDIB_8bppRgb, 500, 500, clip_rect, dib_source, - 0); - EXPECT_EQ(FXDIB_INTERPOL, engine.m_Flags); + FXDIB_ResampleOptions()); + EXPECT_FALSE(engine.m_ResampleOptions.bInterpolateDownsample); + EXPECT_TRUE(engine.m_ResampleOptions.bInterpolateBilinear); + EXPECT_FALSE(engine.m_ResampleOptions.bInterpolateBicubic); + EXPECT_FALSE(engine.m_ResampleOptions.bHalftone); + EXPECT_FALSE(engine.m_ResampleOptions.bNoSmoothing); + EXPECT_FALSE(engine.m_ResampleOptions.bLossy); } -- cgit v1.2.3