- Revision
- 102385
- Author
- [email protected]
- Date
- 2011-12-08 14:29:39 -0800 (Thu, 08 Dec 2011)
Log Message
Use Skia's implementation of Gaussian blur when accelerated filters
are enabled.
https://bugs.webkit.org/show_bug.cgi?id=73949
Reviewed by Zoltan Herczeg.
In the future, this will be covered by the SVG tests run in GPU mode.
* WebCore.gypi:
Add FEGaussianBlurSkia.cpp to the build.
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::platformApplySoftware):
Call out to platformApplySkia() when USE_SKIA is enabled.
* platform/graphics/filters/FEGaussianBlur.h:
platformApplySkia() declaration.
* platform/graphics/filters/skia: Added.
* platform/graphics/filters/skia/FEGaussianBlurSkia.cpp: Added.
(WebCore::FEGaussianBlur::platformApplySkia):
On the Skia port, use SkBlurImageFilter for drawing
Gaussian blurs in accelerated mode.
* platform/graphics/skia/ImageBufferSkia.cpp:
(WebCore::ImageBuffer::copyImage):
Implement ImageBuffer::copyImage() with DontCopyBackingStore semantics.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (102384 => 102385)
--- trunk/Source/WebCore/ChangeLog 2011-12-08 22:20:09 UTC (rev 102384)
+++ trunk/Source/WebCore/ChangeLog 2011-12-08 22:29:39 UTC (rev 102385)
@@ -1,3 +1,29 @@
+2011-12-08 Stephen White <[email protected]>
+
+ Use Skia's implementation of Gaussian blur when accelerated filters
+ are enabled.
+ https://bugs.webkit.org/show_bug.cgi?id=73949
+
+ Reviewed by Zoltan Herczeg.
+
+ In the future, this will be covered by the SVG tests run in GPU mode.
+
+ * WebCore.gypi:
+ Add FEGaussianBlurSkia.cpp to the build.
+ * platform/graphics/filters/FEGaussianBlur.cpp:
+ (WebCore::FEGaussianBlur::platformApplySoftware):
+ Call out to platformApplySkia() when USE_SKIA is enabled.
+ * platform/graphics/filters/FEGaussianBlur.h:
+ platformApplySkia() declaration.
+ * platform/graphics/filters/skia: Added.
+ * platform/graphics/filters/skia/FEGaussianBlurSkia.cpp: Added.
+ (WebCore::FEGaussianBlur::platformApplySkia):
+ On the Skia port, use SkBlurImageFilter for drawing
+ Gaussian blurs in accelerated mode.
+ * platform/graphics/skia/ImageBufferSkia.cpp:
+ (WebCore::ImageBuffer::copyImage):
+ Implement ImageBuffer::copyImage() with DontCopyBackingStore semantics.
+
2011-12-08 Erik Arvidsson <[email protected]>
CodeGeneratorV8: Fix issue with overloaded static conditional methods
Modified: trunk/Source/WebCore/WebCore.gypi (102384 => 102385)
--- trunk/Source/WebCore/WebCore.gypi 2011-12-08 22:20:09 UTC (rev 102384)
+++ trunk/Source/WebCore/WebCore.gypi 2011-12-08 22:29:39 UTC (rev 102385)
@@ -3701,6 +3701,7 @@
'platform/graphics/filters/arm/FEGaussianBlurNEON.h',
'platform/graphics/filters/arm/FELightingNEON.cpp',
'platform/graphics/filters/arm/FELightingNEON.h',
+ 'platform/graphics/filters/skia/FEGaussianBlurSkia.cpp',
'platform/graphics/freetype/FontCacheFreeType.cpp',
'platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp',
'platform/graphics/freetype/FontPlatformData.h',
Modified: trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp (102384 => 102385)
--- trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp 2011-12-08 22:20:09 UTC (rev 102384)
+++ trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp 2011-12-08 22:29:39 UTC (rev 102385)
@@ -265,6 +265,13 @@
void FEGaussianBlur::platformApplySoftware()
{
+#if USE(SKIA)
+ if (filter()->renderingMode() == Accelerated) {
+ platformApplySkia();
+ return;
+ }
+#endif
+
FilterEffect* in = inputEffect(0);
ByteArray* srcPixelArray = createPremultipliedImageResult();
Modified: trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h (102384 => 102385)
--- trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h 2011-12-08 22:20:09 UTC (rev 102384)
+++ trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h 2011-12-08 22:29:39 UTC (rev 102385)
@@ -73,6 +73,7 @@
inline void platformApplyGeneric(ByteArray* srcPixelArray, ByteArray* tmpPixelArray, unsigned kernelSizeX, unsigned kernelSizeY, IntSize& paintSize);
inline void platformApplyNeon(ByteArray* srcPixelArray, ByteArray* tmpPixelArray, unsigned kernelSizeX, unsigned kernelSizeY, IntSize& paintSize);
+ void platformApplySkia();
float m_stdX;
float m_stdY;
Added: trunk/Source/WebCore/platform/graphics/filters/skia/FEGaussianBlurSkia.cpp (0 => 102385)
--- trunk/Source/WebCore/platform/graphics/filters/skia/FEGaussianBlurSkia.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/filters/skia/FEGaussianBlurSkia.cpp 2011-12-08 22:29:39 UTC (rev 102385)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#if USE(SKIA)
+#include "FEGaussianBlur.h"
+
+#include "BitmapImageSingleFrameSkia.h"
+#include "SkBlurImageFilter.h"
+
+namespace WebCore {
+
+void FEGaussianBlur::platformApplySkia()
+{
+ ImageBuffer* resultImage = createImageBufferResult();
+ if (!resultImage)
+ return;
+
+ FilterEffect* in = inputEffect(0);
+
+ IntRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect());
+
+ setIsAlphaImage(in->isAlphaImage());
+
+ float stdX = filter()->applyHorizontalScale(m_stdX);
+ float stdY = filter()->applyVerticalScale(m_stdY);
+
+ RefPtr<Image> image = in->asImageBuffer()->copyImage(DontCopyBackingStore);
+
+ SkPaint paint;
+ GraphicsContext* dstContext = resultImage->context();
+ SkCanvas* canvas = dstContext->platformContext()->canvas();
+ paint.setImageFilter(new SkBlurImageFilter(stdX, stdY))->unref();
+ canvas->saveLayer(0, &paint);
+ paint.setColor(0xFFFFFFFF);
+ dstContext->drawImage(image.get(), ColorSpaceDeviceRGB, drawingRegion.location(), CompositeCopy);
+ canvas->restore();
+ return;
+}
+
+};
+#endif
Modified: trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (102384 => 102385)
--- trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp 2011-12-08 22:20:09 UTC (rev 102384)
+++ trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp 2011-12-08 22:29:39 UTC (rev 102385)
@@ -143,8 +143,7 @@
PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior) const
{
- ASSERT(copyBehavior == CopyBackingStore);
- return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), true);
+ return BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), copyBehavior == CopyBackingStore);
}
PlatformLayer* ImageBuffer::platformLayer() const