Title: [114580] trunk/Source
Revision
114580
Author
[email protected]
Date
2012-04-18 16:32:44 -0700 (Wed, 18 Apr 2012)

Log Message

[Chromium] Solid color layers should respect opacity value.
https://bugs.webkit.org/show_bug.cgi?id=84197

Patch by David Reveman <[email protected]> on 2012-04-18
Reviewed by Adrienne Walker.

Source/WebCore:

Fold opacity into shader color for solid color layers.

Test: CCSolidColorLayerImplTest.verifyCorrectOpacityInQuad

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawSolidColorQuad):

Source/WebKit/chromium:

* tests/CCSolidColorLayerImplTest.cpp:
(CCLayerTestCommon::TEST):
(CCLayerTestCommon):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114579 => 114580)


--- trunk/Source/WebCore/ChangeLog	2012-04-18 23:29:33 UTC (rev 114579)
+++ trunk/Source/WebCore/ChangeLog	2012-04-18 23:32:44 UTC (rev 114580)
@@ -1,3 +1,17 @@
+2012-04-18  David Reveman  <[email protected]>
+
+        [Chromium] Solid color layers should respect opacity value.
+        https://bugs.webkit.org/show_bug.cgi?id=84197
+
+        Reviewed by Adrienne Walker.
+
+        Fold opacity into shader color for solid color layers.
+
+        Test: CCSolidColorLayerImplTest.verifyCorrectOpacityInQuad
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::drawSolidColorQuad):
+
 2012-04-18  Mark Pilgrim  <[email protected]>
 
         [Chromium] Call prefetchDNS directly

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (114579 => 114580)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-04-18 23:29:33 UTC (rev 114579)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-04-18 23:32:44 UTC (rev 114580)
@@ -627,13 +627,13 @@
     tileTransform.translate(tileRect.x() + tileRect.width() / 2.0, tileRect.y() + tileRect.height() / 2.0);
 
     const Color& color = quad->color();
-    float alpha = color.alpha() / 255.0;
+    float opacity = quad->opacity();
+    float alpha = (color.alpha() / 255.0) * opacity;
 
     GLC(context(), context()->uniform4f(solidColorProgram->fragmentShader().colorLocation(), (color.red() / 255.0) * alpha, (color.green() / 255.0) * alpha, (color.blue() / 255.0) * alpha, alpha));
 
-    float opacity = quad->opacity();
     drawTexturedQuad(tileTransform,
-                     tileRect.width(), tileRect.height(), opacity, FloatQuad(),
+                     tileRect.width(), tileRect.height(), 1.0, FloatQuad(),
                      solidColorProgram->vertexShader().matrixLocation(),
                      -1, -1);
 }

Modified: trunk/Source/WebKit/chromium/ChangeLog (114579 => 114580)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-04-18 23:29:33 UTC (rev 114579)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-04-18 23:32:44 UTC (rev 114580)
@@ -1,3 +1,14 @@
+2012-04-18  David Reveman  <[email protected]>
+
+        [Chromium] Solid color layers should respect opacity value.
+        https://bugs.webkit.org/show_bug.cgi?id=84197
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCSolidColorLayerImplTest.cpp:
+        (CCLayerTestCommon::TEST):
+        (CCLayerTestCommon):
+
 2012-04-18  Mark Pilgrim  <[email protected]>
 
         [Chromium] Call prefetchDNS directly

Modified: trunk/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp (114579 => 114580)


--- trunk/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp	2012-04-18 23:29:33 UTC (rev 114579)
+++ trunk/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp	2012-04-18 23:32:44 UTC (rev 114580)
@@ -81,4 +81,27 @@
     EXPECT_EQ(quadCuller.quadList()[0]->toSolidColorDrawQuad()->color(), testColor);
 }
 
+TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad)
+{
+    DebugScopedSetImplThread scopedImplThread;
+
+    const float opacity = 0.5f;
+
+    MockCCQuadCuller quadCuller;
+    IntSize layerSize = IntSize(100, 100);
+    IntRect visibleLayerRect = IntRect(IntPoint(), layerSize);
+
+    OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(0);
+    layer->setVisibleLayerRect(visibleLayerRect);
+    layer->setBounds(layerSize);
+    layer->setDrawOpacity(opacity);
+
+    OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState();
+    bool hadMissingTiles = false;
+    layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles);
+
+    ASSERT_EQ(quadCuller.quadList().size(), 1U);
+    EXPECT_EQ(opacity, quadCuller.quadList()[0]->toSolidColorDrawQuad()->opacity());
+}
+
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to