- Revision
- 101325
- Author
- [email protected]
- Date
- 2011-11-28 21:14:45 -0800 (Mon, 28 Nov 2011)
Log Message
[chromium] Fix SVG filters when running in accelerated drawing mode.
https://bugs.webkit.org/show_bug.cgi?id=73249
Reviewed by Kenneth Russell.
Source/WebCore:
Test: platform/chromium/compositing/accelerated-drawing/svg-filters.html
* platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp:
(WebCore::LayerTextureUpdaterSkPicture::prepareToUpdate):
When doing accelerated drawing, mark the PlatformContextSkia as
deferred.
* platform/graphics/skia/ImageBufferSkia.cpp:
(WebCore::drawNeedsCopy):
When doing a cross-context draw, if the destination context is
deferred, copy the image. Also refactor conditions under which the
image is copied into a new function.
(WebCore::ImageBuffer::draw):
(WebCore::ImageBuffer::drawPattern):
Use the refactored function for conditional copies.
* platform/graphics/skia/PlatformContextSkia.cpp:
(WebCore::PlatformContextSkia::PlatformContextSkia):
* platform/graphics/skia/PlatformContextSkia.h:
(WebCore::PlatformContextSkia::isDeferred):
(WebCore::PlatformContextSkia::setDeferred):
Add m_isDeferred flag, initializer and accessors.
LayoutTests:
* platform/chromium/compositing/accelerated-drawing/svg-filters.html: Added.
New test to check SVG filters in accelerated drawing.
* platform/chromium/test_expectations.txt:
Suppress test failures for new test until we get baselines.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (101324 => 101325)
--- trunk/LayoutTests/ChangeLog 2011-11-29 04:59:15 UTC (rev 101324)
+++ trunk/LayoutTests/ChangeLog 2011-11-29 05:14:45 UTC (rev 101325)
@@ -1,3 +1,15 @@
+2011-11-28 Stephen White <[email protected]>
+
+ [chromium] Fix SVG filters when running in accelerated drawing mode.
+ https://bugs.webkit.org/show_bug.cgi?id=73249
+
+ Reviewed by Kenneth Russell.
+
+ * platform/chromium/compositing/accelerated-drawing/svg-filters.html: Added.
+ New test to check SVG filters in accelerated drawing.
+ * platform/chromium/test_expectations.txt:
+ Suppress test failures for new test until we get baselines.
+
2011-11-29 Roland Steiner <[email protected]>
From @keyframes rules with the same name, the last rule should be used
Added: trunk/LayoutTests/platform/chromium/compositing/accelerated-drawing/svg-filters.html (0 => 101325)
--- trunk/LayoutTests/platform/chromium/compositing/accelerated-drawing/svg-filters.html (rev 0)
+++ trunk/LayoutTests/platform/chromium/compositing/accelerated-drawing/svg-filters.html 2011-11-29 05:14:45 UTC (rev 101325)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/_javascript_">
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText(true); // This is only useful as pixel test.
+
+ if (window.internals)
+ window.internals.setAcceleratedDrawingEnabled(document, true);
+</script>
+</head>
+
+<body>
+<div style="-webkit-transform: translateZ(0);">
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" height=500>
+ <defs>
+ <filter id="f1">
+ <feOffset in="SourceGraphic" x="50"/>
+ </filter>
+ </defs>
+ <rect width="300" height="300" filter="url(#f1)" style="fill:green"/>
+ </svg>
+</div>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (101324 => 101325)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-11-29 04:59:15 UTC (rev 101324)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-11-29 05:14:45 UTC (rev 101325)
@@ -3840,6 +3840,9 @@
BUGCR105025 MAC CPU GPU : fast/canvas/webgl/css-webkit-canvas.html = IMAGE
BUGCR105025 MAC CPU GPU : fast/canvas/webgl/css-webkit-canvas-repaint.html = IMAGE
+// New test; needs new baselines.
+BUG_SENORBLANCO : platform/chromium/compositing/accelerated-drawing/svg-filters.html = MISSING
+
BUGWK73227 : fast/dom/clone-node-style.html = CRASH PASS
BUGWK73250 DEBUG : fast/block/child-not-removed-from-parent-lineboxes-crash.html = CRASH PASS
Modified: trunk/Source/WebCore/ChangeLog (101324 => 101325)
--- trunk/Source/WebCore/ChangeLog 2011-11-29 04:59:15 UTC (rev 101324)
+++ trunk/Source/WebCore/ChangeLog 2011-11-29 05:14:45 UTC (rev 101325)
@@ -1,3 +1,31 @@
+2011-11-28 Stephen White <[email protected]>
+
+ [chromium] Fix SVG filters when running in accelerated drawing mode.
+ https://bugs.webkit.org/show_bug.cgi?id=73249
+
+ Reviewed by Kenneth Russell.
+
+ Test: platform/chromium/compositing/accelerated-drawing/svg-filters.html
+
+ * platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp:
+ (WebCore::LayerTextureUpdaterSkPicture::prepareToUpdate):
+ When doing accelerated drawing, mark the PlatformContextSkia as
+ deferred.
+ * platform/graphics/skia/ImageBufferSkia.cpp:
+ (WebCore::drawNeedsCopy):
+ When doing a cross-context draw, if the destination context is
+ deferred, copy the image. Also refactor conditions under which the
+ image is copied into a new function.
+ (WebCore::ImageBuffer::draw):
+ (WebCore::ImageBuffer::drawPattern):
+ Use the refactored function for conditional copies.
+ * platform/graphics/skia/PlatformContextSkia.cpp:
+ (WebCore::PlatformContextSkia::PlatformContextSkia):
+ * platform/graphics/skia/PlatformContextSkia.h:
+ (WebCore::PlatformContextSkia::isDeferred):
+ (WebCore::PlatformContextSkia::setDeferred):
+ Add m_isDeferred flag, initializer and accessors.
+
2011-11-29 Roland Steiner <[email protected]>
<style scoped>: add ENABLE(STYLE_SCOPED) flag to WebKit
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp (101324 => 101325)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp 2011-11-29 04:59:15 UTC (rev 101324)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp 2011-11-29 05:14:45 UTC (rev 101325)
@@ -201,6 +201,7 @@
{
SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height());
PlatformContextSkia platformContext(canvas);
+ platformContext.setDeferred(true);
GraphicsContext graphicsContext(&platformContext);
paintContents(graphicsContext, contentRect, contentsScale);
m_picture.endRecording();
Modified: trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (101324 => 101325)
--- trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp 2011-11-29 04:59:15 UTC (rev 101324)
+++ trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp 2011-11-29 05:14:45 UTC (rev 101325)
@@ -157,17 +157,22 @@
context->platformContext()->beginLayerClippedToImage(rect, this);
}
+static bool drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst)
+{
+ return dst->platformContext()->isDeferred() || src == dst;
+}
+
void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,
CompositeOperator op, bool useLowQualityScale)
{
- RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
+ RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), drawNeedsCopy(m_context.get(), context));
context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
}
void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
{
- RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
+ RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), drawNeedsCopy(m_context.get(), context));
image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
}
Modified: trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp (101324 => 101325)
--- trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp 2011-11-29 04:59:15 UTC (rev 101324)
+++ trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp 2011-11-29 05:14:45 UTC (rev 101325)
@@ -180,6 +180,7 @@
PlatformContextSkia::PlatformContextSkia(SkCanvas* canvas)
: m_canvas(canvas)
, m_printing(false)
+ , m_deferred(false)
, m_drawingToImageBuffer(false)
, m_gpuContext(0)
{
Modified: trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h (101324 => 101325)
--- trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h 2011-11-29 04:59:15 UTC (rev 101324)
+++ trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h 2011-11-29 05:14:45 UTC (rev 101325)
@@ -181,6 +181,12 @@
bool isAccelerated() const { return m_gpuContext; }
void setGraphicsContext3D(GraphicsContext3D*);
+ // True if this context is deferring draw calls to be executed later.
+ // We need to know this for context-to-context draws, in order to know if
+ // the source bitmap needs to be copied.
+ bool isDeferred() const { return m_deferred; }
+ void setDeferred(bool deferred) { m_deferred = deferred; }
+
private:
// Used when restoring and the state has an image clip. Only shows the pixels in
// m_canvas that are also in imageBuffer.
@@ -208,6 +214,7 @@
IntSize m_imageResamplingHintSrcSize;
FloatSize m_imageResamplingHintDstSize;
bool m_printing;
+ bool m_deferred;
bool m_drawingToImageBuffer;
GraphicsContext3D* m_gpuContext;
};