summaryrefslogtreecommitdiff
path: root/xfa
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 /xfa
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 'xfa')
-rw-r--r--xfa/fxfa/cxfa_imagerenderer.cpp10
1 files changed, 5 insertions, 5 deletions
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<CFX_ImageTransformer>(
- 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<CFX_DIBitmap> 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);