Closed Bug 1355570 Opened 8 years ago Closed 8 years ago

Update nsCSSRenderingGradients for changes in WebRender

Categories

(Core :: Graphics: WebRender, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: rhunt, Assigned: rhunt)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(4 files)

There have been a number of upstream changes in WebRender that affect the display item generation. 1. Normalization and other fixes for degenerate gradients is now handled 2. Support was added for tiling in single display item 3. Premultiplied alpha is now done with a blend mode Additionally, the original patch for building display items didn't use aSrc which is an error.
(In reply to Ryan Hunt [:rhunt] from comment #3) > Created attachment 8857095 [details] > Bug 1355570 - Simplify nsCSSRenderingGradients > > In nsCSSRenderingGradients the logic for handling many error conditions > and normalizing the gradient stops is shared between the paint path and > the WebRender path. WebRender now normalizes gradients and handles any > error conditions that it needs to. There are some conditions that are not > problems for it, like repeating radial gradients with stops below zero. > > This commit undoes the work done in bug 1341101 to share this logic. Some > conditions were moved around in bug 1341101 to make things simpler, and > that has been undone. Now the paint path is identical to how it was > originally. > > There is one exception, which is ResolveMidpoints which is kept between > both code paths. This should be safe. > > Review commit: https://reviewboard.mozilla.org/r/128998/diff/#index_header > See other reviews: https://reviewboard.mozilla.org/r/128998/ I forgot to add that ResolvePremultipliedAlpha used to be shared by both code paths, but is now only done for the Paint path. WebRender handles this internally, and shouldn't need to create a bunch of intermediate colors stops to blend premultiplied. ResolveMidpoints is similar to ResolvePremultipliedAlpha (creating extra color stops to fake nonlinear interpolation), and this could maybe some day be handled in WebRender.
Comment on attachment 8857094 [details] Bug 1355570 - Premultiply WebRender gradient stop colors https://reviewboard.mozilla.org/r/128996/#review131670 ::: layout/painting/nsCSSRenderingGradients.cpp:1027 (Diff revision 1) > 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; > + float alpha = mStops[i].mColor.a * aOpacity; Probably should use 'Float' here since that's what type ColorStops uses.
Attachment #8857094 - Flags: review?(matt.woodrow) → review+
Attachment #8857095 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8857096 [details] Bug 1355570 - Respect aSrc when building WebRender gradients https://reviewboard.mozilla.org/r/129000/#review131676 ::: layout/painting/nsCSSRenderingGradients.cpp:1077 (Diff revision 1) > + aDest.width / ((float)mPresContext->CSSPixelsToAppUnits(aSrc.width)), > + aDest.height / ((float)mPresContext->CSSPixelsToAppUnits(aSrc.height))); > + > if (mGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR) { > + lineStart.x = (lineStart.x - srcTransform.x) * srcTransform.width; > + lineStart.y = (lineStart.y - srcTransform.y) * srcTransform.height; These first two lines could be moved outside of the if.
Attachment #8857096 - Flags: review?(matt.woodrow) → review+
Attachment #8857093 - Flags: review?(matt.woodrow) → review?(jmuizelaar)
Comment on attachment 8857093 [details] Bug 1355570 - Update bindings and WebRender display list building for gradient tiling https://reviewboard.mozilla.org/r/128994/#review132102
Attachment #8857093 - Flags: review?(jmuizelaar) → review+
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/projects/graphics/rev/9d9628ffe7a0 Update bindings and WebRender display list building for gradient tiling r=jrmuizel https://hg.mozilla.org/projects/graphics/rev/940396cc2852 Premultiply WebRender gradient stop colors r=mattwoodrow https://hg.mozilla.org/projects/graphics/rev/30005fc4bb99 Simplify nsCSSRenderingGradients r=mattwoodrow https://hg.mozilla.org/projects/graphics/rev/1732ef63e9c8 Respect aSrc when building WebRender gradients r=mattwoodrow
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: