Index: Source/platform/graphics/GraphicsContext.h |
diff --git a/Source/platform/graphics/GraphicsContext.h b/Source/platform/graphics/GraphicsContext.h |
index 768d86ee9e383af4110b1ab5e2e11e440292a570..0fee4956284b43d0ce210bb4dfc82fb4b6ca233c 100644 |
--- a/Source/platform/graphics/GraphicsContext.h |
+++ b/Source/platform/graphics/GraphicsContext.h |
@@ -463,11 +463,14 @@ private: |
if (m_paintState->saveCount()) { |
m_paintState->decrementSaveCount(); |
++m_paintStateIndex; |
- if (m_paintStateStack.size() == m_paintStateIndex) |
- m_paintStateStack.append(GraphicsContextState::create()); |
- GraphicsContextState* priorPaintState = m_paintState; |
- m_paintState = m_paintStateStack[m_paintStateIndex].get(); |
- m_paintState->copy(priorPaintState); |
+ if (m_paintStateStack.size() == m_paintStateIndex) { |
+ m_paintStateStack.append(GraphicsContextState::createAndCopy(*m_paintState)); |
+ m_paintState = m_paintStateStack[m_paintStateIndex].get(); |
+ } else { |
+ GraphicsContextState* priorPaintState = m_paintState; |
+ m_paintState = m_paintStateStack[m_paintStateIndex].get(); |
+ m_paintState->copy(*priorPaintState); |
+ } |
} |
} |