fixed fail cases on intelTC
authorKyungjin Kim <gen.kim@samsung.com>
Fri, 19 Apr 2013 01:12:43 +0000 (10:12 +0900)
committerKyungjin Kim <gen.kim@samsung.com>
Fri, 19 Apr 2013 05:13:04 +0000 (14:13 +0900)
[Title] fixed fail cases on intelTC
[Issue#] N/A
[Problem] intelTC fails in shadow cases and drawimage.self
[Cause] shadowBlur shares the context, it fails because of the shared image cache
[Solution] fixed not to cache shadow context and self context for the gl surface

Change-Id: I123242c77b71d8b4a792b5d854e0bcd3189c9348

Source/WebCore/platform/graphics/ShadowBlur.cpp
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp [changed mode: 0755->0644]
Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp
Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h

index 1e75e18..6d7c4c5 100644 (file)
@@ -902,6 +902,9 @@ GraphicsContext* ShadowBlur::beginShadowLayer(GraphicsContext *context, const Fl
     m_layerImage = ScratchBuffer::shared().getScratchBuffer(layerRect.size());
 
     GraphicsContext* shadowContext = m_layerImage->context();
+#if ENABLE(TIZEN_CAIROGLES_IMAGE_CACHE)
+    context->platformContext()->setIsShadowContext(true);
+#endif
     shadowContext->save();
 
     // Add a pixel to avoid later edge aliasing when rotated.
@@ -920,6 +923,9 @@ void ShadowBlur::endShadowLayer(GraphicsContext* context)
 
     context->clearShadow();
     context->drawImageBuffer(m_layerImage, ColorSpaceDeviceRGB, roundedIntPoint(m_layerOrigin), IntRect(0, 0, m_layerSize.width(), m_layerSize.height()), context->compositeOperation());
+#if ENABLE(TIZEN_CAIROGLES_IMAGE_CACHE)
+    context->platformContext()->setIsShadowContext(false);
+#endif
 
     m_layerImage = 0;
     ScratchBuffer::shared().scheduleScratchBufferPurge();
old mode 100755 (executable)
new mode 100644 (file)
index 0103a96..556f168
@@ -488,7 +488,15 @@ void ImageBuffer::draw(GraphicsContext* destinationContext, ColorSpace styleColo
 {
     BackingStoreCopy copyMode = destinationContext == context() ? CopyBackingStore : DontCopyBackingStore;
     RefPtr<Image> image = copyImage(copyMode);
+#if ENABLE(TIZEN_CAIROGLES_IMAGE_CACHE)
+    if (cairo_surface_get_type(m_data.m_surface) == CAIRO_SURFACE_TYPE_GL && copyMode == CopyBackingStore)
+        destinationContext->platformContext()->setIsDrawSelfContext(true);
+#endif
     destinationContext->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, DoNotRespectImageOrientation, useLowQualityScale);
+#if ENABLE(TIZEN_CAIROGLES_IMAGE_CACHE)
+    if (cairo_surface_get_type(m_data.m_surface) == CAIRO_SURFACE_TYPE_GL && copyMode == CopyBackingStore)
+        destinationContext->platformContext()->setIsDrawSelfContext(false);
+#endif
 }
 
 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
index a38e292..bff8c29 100644 (file)
@@ -89,6 +89,10 @@ public:
 
 PlatformContextCairo::PlatformContextCairo(cairo_t* cr)
     : m_cr(cr)
+#if ENABLE(TIZEN_CAIROGLES_IMAGE_CACHE)
+    , m_shadowContext(false)
+    , m_selfContext(false)
+#endif
 {
     m_stateStack.append(State());
     m_state = &m_stateStack.last();
@@ -197,7 +201,7 @@ void PlatformContextCairo::drawSurfaceToContext(cairo_surface_t* surface, const
             snapshot = 0;
         }
 
-        if (!snapshot) {
+        if (!snapshot && !isShadowContext() && !isDrawSelfContext()) {
             int w = cairo_image_surface_get_width(surface);
             int h = cairo_image_surface_get_height(surface);
 #if ENABLE(TIZEN_CAIROGLES_IMAGE_AUTOSCALE)
index d7f1205..df0f322 100644 (file)
@@ -67,6 +67,14 @@ public:
     enum AlphaPreservation { DoNotPreserveAlpha, PreserveAlpha };
     void prepareForStroking(const GraphicsContextState&, AlphaPreservation = PreserveAlpha);
 
+#if ENABLE(TIZEN_CAIROGLES_IMAGE_CACHE)
+    void setIsShadowContext(bool isShadowContext) { m_shadowContext = isShadowContext; }
+    bool isShadowContext() const { return m_shadowContext; }
+
+    void setIsDrawSelfContext(bool isDrawSelfContext) { m_selfContext = isDrawSelfContext; }
+    bool isDrawSelfContext() const { return m_selfContext; }
+#endif
+
 private:
     void clipForPatternFilling(const GraphicsContextState&);
 
@@ -79,6 +87,10 @@ private:
     // GraphicsContext is responsible for managing the state of the ShadowBlur,
     // so it does not need to be on the state stack.
     ShadowBlur m_shadowBlur;
+#if ENABLE(TIZEN_CAIROGLES_IMAGE_CACHE)
+    bool m_shadowContext;
+    bool m_selfContext;
+#endif
 
 };