summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffwidget.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-21 14:11:26 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-21 21:42:11 +0000
commit1629f609d3722f25491bbbb53b2cce97a03a5867 (patch)
tree20aad3c57a05c85d378a04e6e89897e35819c3a0 /xfa/fxfa/cxfa_ffwidget.cpp
parent0748d3cb67926bfd38d3d67901fdda87109c6895 (diff)
downloadpdfium-1629f609d3722f25491bbbb53b2cce97a03a5867.tar.xz
Add CFX_RenderDevice::AutoRestorer()chromium/3078
Avoid cleanup on every return path. Change-Id: I6978adb6f31020d812ac88c5d46c703d1461d373 Reviewed-on: https://pdfium-review.googlesource.com/4435 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffwidget.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 06de436e09..b74e1dcaf7 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -886,8 +886,7 @@ void XFA_DrawImage(CFX_Graphics* pGS,
rtFit.top = rtImage.bottom() - rtImage.height;
}
CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice();
- pRenderDevice->SaveState();
-
+ CFX_RenderDevice::StateRestorer restorer(pRenderDevice);
CFX_PathData path;
path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top);
pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING);
@@ -898,12 +897,12 @@ void XFA_DrawImage(CFX_Graphics* pGS,
mtImage.Concat(*pMatrix);
CXFA_ImageRenderer imageRender;
- bool bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage,
- FXDIB_INTERPOL);
- while (bRet)
- bRet = imageRender.Continue(nullptr);
-
- pRenderDevice->RestoreState(false);
+ if (!imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage,
+ FXDIB_INTERPOL)) {
+ return;
+ }
+ while (imageRender.Continue(nullptr))
+ continue;
}
static const uint8_t g_inv_base64[128] = {