Bug 1355570 - Premultiply WebRender gradient stop colors r=mattwoodrow
authorRyan Hunt <rhunt@eqrion.net>
Tue, 11 Apr 2017 12:22:24 -0400
changeset 352792 940396cc2852fa3b5f460b5925d89cc8d910d57b
parent 352791 9d9628ffe7a05f7e626d962422fbbf50706ccaa5
child 352793 30005fc4bb990f6ca0d97445494654eea51f1ac5
push id31651
push userkwierso@gmail.com
push dateThu, 13 Apr 2017 17:42:52 +0000
treeherdermozilla-central@8dd662ed3387 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1355570
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1355570 - Premultiply WebRender gradient stop colors r=mattwoodrow MozReview-Commit-ID: 7zdxaJR5yS4
layout/painting/nsCSSRenderingGradients.cpp
--- a/layout/painting/nsCSSRenderingGradients.cpp
+++ b/layout/painting/nsCSSRenderingGradients.cpp
@@ -1019,20 +1019,21 @@ nsCSSGradientRenderer::BuildWebRenderPar
                                                 LayoutDevicePoint& aLineEnd,
                                                 LayoutDeviceSize& aGradientRadius)
 {
   bool isRepeat = mGradient->mRepeating || mForceRepeatToCoverTiles;
   aMode = isRepeat ? WrGradientExtendMode::Repeat : WrGradientExtendMode::Clamp;
 
   aStops.SetLength(mStops.Length());
   for(uint32_t i = 0; i < mStops.Length(); i++) {
-    aStops[i].color.r = mStops[i].mColor.r;
-    aStops[i].color.g = mStops[i].mColor.g;
-    aStops[i].color.b = mStops[i].mColor.b;
-    aStops[i].color.a = mStops[i].mColor.a * aOpacity;
+    Float alpha = mStops[i].mColor.a * aOpacity;
+    aStops[i].color.r = mStops[i].mColor.r * alpha;
+    aStops[i].color.g = mStops[i].mColor.g * alpha;
+    aStops[i].color.b = mStops[i].mColor.b * alpha;
+    aStops[i].color.a = alpha;
     aStops[i].offset = mStops[i].mPosition;
   }
 
   aLineStart = LayoutDevicePoint(mLineStart.x, mLineStart.y);
   aLineEnd = LayoutDevicePoint(mLineEnd.x, mLineEnd.y);
   aGradientRadius = LayoutDeviceSize(mRadiusX, mRadiusY);
 }