diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 15 | ||||
-rw-r--r-- | xfa/fxgraphics/cfx_graphics.cpp | 7 |
2 files changed, 9 insertions, 13 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] = { 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); } } |