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/fpdfapi/render/cpdf_renderstatus.cpp | |
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/fpdfapi/render/cpdf_renderstatus.cpp')
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 3f7b4923dc..9bbd298f18 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -1911,7 +1911,8 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, image_matrix.Concat(matrix); CPDF_ImageRenderer renderer; if (renderer.Start(this, pType3Char->GetBitmap(), fill_argb, 255, - &image_matrix, 0, false, BlendMode::kNormal)) { + &image_matrix, FXDIB_ResampleOptions(), false, + BlendMode::kNormal)) { renderer.Continue(nullptr); } if (!renderer.GetResult()) @@ -2257,7 +2258,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, RetainPtr<CFX_DIBitmap> pEnlargedBitmap = DrawPatternBitmap(m_pContext->GetDocument(), m_pContext->GetPageCache(), pPattern, mtObj2Device, 8, 8, m_Options.GetFlags()); - pPatternBitmap = pEnlargedBitmap->StretchTo(width, height, 0, nullptr); + pPatternBitmap = pEnlargedBitmap->StretchTo( + width, height, FXDIB_ResampleOptions(), nullptr); } else { pPatternBitmap = DrawPatternBitmap( m_pContext->GetDocument(), m_pContext->GetPageCache(), pPattern, @@ -2393,7 +2395,8 @@ void CPDF_RenderStatus::CompositeDIBitmap( std::unique_ptr<CFX_ImageRenderer> dummy; CFX_Matrix m = CFX_RenderDevice::GetFlipMatrix( pDIBitmap->GetWidth(), pDIBitmap->GetHeight(), left, top); - m_pDevice->StartDIBits(pDIBitmap, bitmap_alpha, 0, m, 0, &dummy); + m_pDevice->StartDIBits(pDIBitmap, bitmap_alpha, 0, m, + FXDIB_ResampleOptions(), &dummy); return; #else pDIBitmap->MultiplyAlpha(bitmap_alpha); |