summaryrefslogtreecommitdiff
path: root/xfa/fxgraphics/cfx_graphics.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-01-30 14:49:24 -0800
committerChromium commit bot <commit-bot@chromium.org>2017-01-31 00:42:43 +0000
commit51d02b341dd56f8e365444cb9e4af7e0ffe55ae5 (patch)
tree616f11f803bc067eecc2c2c94684b3062a190221 /xfa/fxgraphics/cfx_graphics.cpp
parent02d83e1f963f56f61de670161e12ffb131c56d7b (diff)
downloadpdfium-51d02b341dd56f8e365444cb9e4af7e0ffe55ae5.tar.xz
use std::vector in cfx_graphics.h and xfa_ffwidget.h
Change-Id: I19f2e729b58de42506e8fc2811dd06d406470314 Reviewed-on: https://pdfium-review.googlesource.com/2470 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxgraphics/cfx_graphics.cpp')
-rw-r--r--xfa/fxgraphics/cfx_graphics.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp
index 059872f81c..120634ca51 100644
--- a/xfa/fxgraphics/cfx_graphics.cpp
+++ b/xfa/fxgraphics/cfx_graphics.cpp
@@ -630,30 +630,25 @@ FWL_Error CFX_Graphics::EnableAntialiasing(bool isAntialiasing) {
}
FWL_Error CFX_Graphics::SaveGraphState() {
- if (m_type == FX_CONTEXT_Device && m_renderDevice) {
- m_renderDevice->SaveState();
- m_infoStack.Add(new TInfo(m_info));
- return FWL_Error::Succeeded;
- }
- return FWL_Error::PropertyInvalid;
+ if (m_type != FX_CONTEXT_Device || !m_renderDevice)
+ return FWL_Error::PropertyInvalid;
+
+ m_renderDevice->SaveState();
+ m_infoStack.push_back(pdfium::MakeUnique<TInfo>(m_info));
+ return FWL_Error::Succeeded;
}
FWL_Error CFX_Graphics::RestoreGraphState() {
- if (m_type == FX_CONTEXT_Device && m_renderDevice) {
- m_renderDevice->RestoreState(false);
- int32_t size = m_infoStack.GetSize();
- if (size <= 0) {
- return FWL_Error::IntermediateValueInvalid;
- }
- int32_t topIndex = size - 1;
- std::unique_ptr<TInfo> info(m_infoStack.GetAt(topIndex));
- if (!info)
- return FWL_Error::IntermediateValueInvalid;
- m_info = *info;
- m_infoStack.RemoveAt(topIndex);
- return FWL_Error::Succeeded;
- }
- return FWL_Error::PropertyInvalid;
+ if (m_type != FX_CONTEXT_Device || !m_renderDevice)
+ return FWL_Error::PropertyInvalid;
+
+ m_renderDevice->RestoreState(false);
+ if (m_infoStack.empty() || !m_infoStack.back())
+ return FWL_Error::IntermediateValueInvalid;
+
+ m_info = *m_infoStack.back();
+ m_infoStack.pop_back();
+ return FWL_Error::Succeeded;
}
FWL_Error CFX_Graphics::GetLineCap(CFX_GraphStateData::LineCap& lineCap) const {