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 --- xfa/fxfa/cxfa_imagerenderer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_imagerenderer.cpp b/xfa/fxfa/cxfa_imagerenderer.cpp index 164d056f00..6baa2eb418 100644 --- a/xfa/fxfa/cxfa_imagerenderer.cpp +++ b/xfa/fxfa/cxfa_imagerenderer.cpp @@ -22,7 +22,7 @@ CXFA_ImageRenderer::~CXFA_ImageRenderer() {} bool CXFA_ImageRenderer::Start() { if (m_pDevice->StartDIBitsWithBlend(m_pDIBBase, 255, 0, m_ImageMatrix, - FXDIB_INTERPOL, &m_DeviceHandle, + kBilinearInterpolation, &m_DeviceHandle, BlendMode::kNormal)) { if (m_DeviceHandle) { m_Status = 3; @@ -50,7 +50,7 @@ bool CXFA_ImageRenderer::Start() { clip_box.Intersect(image_rect); m_Status = 2; m_pTransformer = pdfium::MakeUnique( - pDib, m_ImageMatrix, FXDIB_INTERPOL, &clip_box); + pDib, m_ImageMatrix, kBilinearInterpolation, &clip_box); return true; } if (m_ImageMatrix.a < 0) @@ -63,14 +63,14 @@ bool CXFA_ImageRenderer::Start() { if (m_pDIBBase->IsOpaqueImage()) { if (m_pDevice->StretchDIBitsWithFlagsAndBlend( m_pDIBBase, dest_left, dest_top, dest_width, dest_height, - FXDIB_INTERPOL, BlendMode::kNormal)) { + kBilinearInterpolation, BlendMode::kNormal)) { return false; } } if (m_pDIBBase->IsAlphaMask()) { if (m_pDevice->StretchBitMaskWithFlags(m_pDIBBase, dest_left, dest_top, dest_width, dest_height, 0, - FXDIB_INTERPOL)) { + kBilinearInterpolation)) { return false; } } @@ -82,7 +82,7 @@ bool CXFA_ImageRenderer::Start() { dest_rect.left - image_rect.left, dest_rect.top - image_rect.top, dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); RetainPtr pStretched = m_pDIBBase->StretchTo( - dest_width, dest_height, FXDIB_INTERPOL, &dest_clip); + dest_width, dest_height, kBilinearInterpolation, &dest_clip); if (pStretched) CompositeDIBitmap(pStretched, dest_rect.left, dest_rect.top); -- cgit v1.2.3