Source/WebCore: [chromium] Implement drop-shadow() CSS filter on composited layers.
authorsenorblanco@chromium.org <senorblanco@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Feb 2012 22:05:15 +0000 (22:05 +0000)
committersenorblanco@chromium.org <senorblanco@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Feb 2012 22:05:15 +0000 (22:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79386

Reviewed by James Robinson.

Covered by css3/filters/effect-drop-shadow-hw.html

* platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
(WebCore::CCRenderSurfaceFilters::apply):
* platform/graphics/filters/FilterOperation.h:
(WebCore::DropShadowFilterOperation::movesPixels):

LayoutTests: [chromium] Mark drop-shadow() tests as failing, pending a rebaseline.
https://bugs.webkit.org/show_bug.cgi?id=79386

Reviewed by James Robinson.

* platform/chromium/test_expectations.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@108674 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp
Source/WebCore/platform/graphics/filters/FilterOperation.h

index 647e2ac..e939221 100644 (file)
@@ -1,3 +1,12 @@
+2012-02-23  Stephen White  <senorblanco@chromium.org>
+
+        [chromium] Mark drop-shadow() tests as failing, pending a rebaseline.
+        https://bugs.webkit.org/show_bug.cgi?id=79386
+
+        Reviewed by James Robinson.
+
+        * platform/chromium/test_expectations.txt:
+
 2012-02-22  Ryosuke Niwa  <rniwa@webkit.org>
 
         REGRESSION(r99076): WebKit pastes the trailing newline into a single-line text field
index f8823b9..1a4dcc5 100644 (file)
@@ -3063,6 +3063,13 @@ BUGWK71392 : css3/filters/custom-filter-property-computed-style.html = FAIL
 BUGWK71392 : css3/filters/custom-filter-property-parsing.html = FAIL
 BUGWK71392 : css3/filters/custom-filter-shader-cache.html = FAIL
 
+// Need rebaselining after drop-shadows are implemented in compositor.
+BUGWK79386 : css3/filters/effect-drop-shadow-hw.html = FAIL
+BUGWK79386 : css3/filters/filter-animation-from-none-hw.html = FAIL
+BUGWK79386 : css3/filters/filter-animation-from-none-multi-hw.html = FAIL
+BUGWK79386 : css3/filters/filter-animation-hw.html = FAIL
+BUGWK79386 : css3/filters/filter-animation-multi-hw.html = FAIL
+
 // <style scoped> not yet enabled.
 BUGWK49142 SKIP : fast/css/style-scoped = PASS
 
index bc96fc8..80f80fc 100644 (file)
@@ -1,3 +1,17 @@
+2012-02-23  Stephen White  <senorblanco@chromium.org>
+
+        [chromium] Implement drop-shadow() CSS filter on composited layers.
+        https://bugs.webkit.org/show_bug.cgi?id=79386
+
+        Reviewed by James Robinson.
+
+        Covered by css3/filters/effect-drop-shadow-hw.html
+
+        * platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp:
+        (WebCore::CCRenderSurfaceFilters::apply):
+        * platform/graphics/filters/FilterOperation.h:
+        (WebCore::DropShadowFilterOperation::movesPixels):
+
 2012-02-23  Erik Arvidsson  <arv@chromium.org>
 
         Add support for InterfaceName in the bindings
index adb176f..b175d11 100644 (file)
@@ -198,8 +198,8 @@ SkBitmap CCRenderSurfaceFilters::apply(const FilterOperations& filters, unsigned
         const FilterOperation* filterOperation = filters.at(i);
         // Allocate a destination texture.
         GrTextureDesc desc;
-        desc.fFlags = kRenderTarget_GrTextureFlagBit;
-        desc.fAALevel = kNone_GrAALevel;
+        desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
+        desc.fSampleCnt = 0;
         desc.fWidth = size.width();
         desc.fHeight = size.height();
         desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -280,6 +280,20 @@ SkBitmap CCRenderSurfaceFilters::apply(const FilterOperations& filters, unsigned
             canvas.restore();
             break;
         }
+        case FilterOperation::DROP_SHADOW: {
+            const DropShadowFilterOperation* op = static_cast<const DropShadowFilterOperation*>(filterOperation);
+            SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(op->stdDeviation(), op->stdDeviation()));
+            SkAutoTUnref<SkColorFilter> colorFilter(SkColorFilter::CreateModeFilter(op->color().rgb(), SkXfermode::kSrcIn_Mode));
+            SkPaint paint;
+            paint.setImageFilter(blurFilter.get());
+            paint.setColorFilter(colorFilter.get());
+            paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
+            canvas.saveLayer(0, &paint);
+            canvas.drawBitmap(source, op->x(), -op->y());
+            canvas.restore();
+            canvas.drawBitmap(source, 0, 0);
+            break;
+        }
         case FilterOperation::PASSTHROUGH:
         default:
             canvas.drawBitmap(source, 0, 0);
index 9d7ef65..9ee9557 100644 (file)
@@ -311,6 +311,7 @@ public:
     Color color() const { return m_color; }
 
     virtual bool affectsOpacity() const { return true; }
+    virtual bool movesPixels() const { return true; }
 
     virtual PassRefPtr<FilterOperation> blend(const FilterOperation* from, double progress, bool blendToPassthrough = false);