diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-21 14:11:26 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-21 21:42:11 +0000 |
commit | 1629f609d3722f25491bbbb53b2cce97a03a5867 (patch) | |
tree | 20aad3c57a05c85d378a04e6e89897e35819c3a0 /xfa/fxgraphics/cfx_graphics.cpp | |
parent | 0748d3cb67926bfd38d3d67901fdda87109c6895 (diff) | |
download | pdfium-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/fxgraphics/cfx_graphics.cpp')
-rw-r--r-- | xfa/fxgraphics/cfx_graphics.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp index a3821dd067..b7595eea8d 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cfx_graphics.cpp @@ -375,11 +375,9 @@ void CFX_Graphics::FillPathWithPattern(CFX_Path* path, m_info.fillColor->m_info.pattern->m_foreArgb); } } - - m_renderDevice->SaveState(); + CFX_RenderDevice::StateRestorer restorer(m_renderDevice); m_renderDevice->SetClip_PathFill(path->GetPathData(), matrix, fillMode); SetDIBitsWithMatrix(bmp, &pattern->m_matrix); - m_renderDevice->RestoreState(false); } void CFX_Graphics::FillPathWithShading(CFX_Path* path, @@ -494,10 +492,9 @@ void CFX_Graphics::FillPathWithShading(CFX_Path* path, } } if (result) { - m_renderDevice->SaveState(); + CFX_RenderDevice::StateRestorer restorer(m_renderDevice); m_renderDevice->SetClip_PathFill(path->GetPathData(), matrix, fillMode); SetDIBitsWithMatrix(bmp, matrix); - m_renderDevice->RestoreState(false); } } |