OSDN Git Service

Add missing save/restore calls to GraphicsContext::fillRect
authorBen Murdoch <benm@google.com>
Wed, 26 Oct 2011 14:14:51 +0000 (15:14 +0100)
committerBen Murdoch <benm@google.com>
Thu, 27 Oct 2011 12:49:10 +0000 (13:49 +0100)
Android is missing some calls to GraphicsContext::save/restore
inside our GraphicsContext::fillRect implementations. The calls
were added to the Skia GraphicsContext in http://trac.webkit.org/changeset/63102

Bug: 5361502
Change-Id: Ifcbc116d997473e3a184561102dc5cb74f5aa5ec

Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp

index 86e1f63..f647673 100644 (file)
@@ -782,6 +782,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
 
 void GraphicsContext::fillRect(const FloatRect& rect)
 {
+    save();
     SkPaint paint;
 
     m_data->setupPaintFill(&paint);
@@ -791,6 +792,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
                  m_state.fillGradient.get());
 
     GC2CANVAS(this)->drawRect(rect, paint);
+    restore();
 }
 
 void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorSpace)
@@ -799,6 +801,7 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS
         return;
 
     if (color.rgb() & 0xFF000000) {
+        save();
         SkPaint paint;
 
         m_data->setupPaintCommon(&paint);
@@ -828,6 +831,7 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS
         paint.setAntiAlias(false);
 
         GC2CANVAS(this)->drawRect(rect, paint);
+        restore();
     }
 }