This might be useful for debugging: diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h index 1c366d51cbd74d0bcedec5790df2ed71aacc7a96..964598b4a414ca808bdcac7b019cae8b32a35ee8 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.h +++ b/Source/WebCore/platform/graphics/GraphicsContext.h @@ -348,6 +348,8 @@ public: WEBCORE_EXPORT void save(); WEBCORE_EXPORT void restore(); + + unsigned stackSize() const { return m_stack.size(); } // These draw methods will do both stroking and filling. // FIXME: ...except drawRect(), which fills properly but always strokes @@ -686,6 +688,27 @@ private: bool m_saveAndRestore; }; + +class GraphicsContextStateStackChecker { +public: + GraphicsContextStateStackChecker(GraphicsContext& context) + : m_context(context) + , m_stackSize(context.stackSize()) + { } + + ~GraphicsContextStateStackChecker() + { + if (m_context.stackSize() != m_stackSize) + WTFLogAlways("GraphicsContext %p stack changed by %d", this, (int)m_context.stackSize() - (int)m_stackSize); + } + +private: + GraphicsContext& m_context; + unsigned m_stackSize; +}; + + + class InterpolationQualityMaintainer { public: explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, InterpolationQuality interpolationQualityToUse)