Bug 1355570 - Premultiply WebRender gradient stop colors r?mattwoodrow
MozReview-Commit-ID: 7zdxaJR5yS4
--- 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);
}