Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix drop-shadows and remove last use of hardware_composite shader. #2588

Merged
merged 2 commits into from Apr 3, 2018

Commits on Apr 2, 2018

  1. Fix drop-shadows and remove last use of hardware_composite shader.

    This commit reworks how drop-shadows are handled. We now add two
    primitives, each one referencing the same Picture.
    
    The first primitive draws the drop shadow by blurring the alpha
    channel of the picture, and generating screen-space UVs after
    applying a local offset.
    
    The second primitive draws the main image with a normal
    brush_image shader blit.
    
    There are a couple of hacky bits of code to make this work, but
    it's such an improvement on the current state of drop-shadows
    that I think it's worth getting this merged and tidying those
    up later (mentioned as TODO comments in the patch).
    
    Also, finally remove the hardware composite shader, since this
    removes the last use of it.
    
    Fixes #2584.
    Fixes #2374.
    gw3583 committed Apr 2, 2018

Commits on Apr 3, 2018

  1. Fix a couple of regressions caused by the previous commit.

    1) In picture.rs, the wrong GPU cache handle was being invalidated.
       This was causing visual glitches when scrolling pages with
       drop-shadows present.
    
    2) Fix an edge case that was occurring when the visual content of
       a drop-shadow was scrolled off-screen, but the bounding rect of
       the drop-shadow itself was still partially visible. In this case
       the picture would not get prepare_prim_for_render() called, but
       the drop-shadow brush image would still attempt to draw, which
       would reference an invalid render task in the render task tree.
       Correctly drawing enough of the off-screen visual contents to
       allow correct drawing of the partial shadow will be done as a
       follow up - for now, we will just stop drawing the shadow if
       the main visual contents becomes invisible, which can result
       in a noticeable pop of the shadow in some cases, but is still
       a big improvement on current drop-shadow support. To do this,
       the logic in batch.rs is inverted. Instead of checking for
       an intermediate surface, and then the filter mode, the code
       now checks the filter mode first, followed by the surface. This
       means that in the case above, we can detect that the visual
       contents of the drop shadow were off-screen, and skip trying
       to draw the alpha mask of that as a shadow.
    gw3583 committed Apr 3, 2018
You can’t perform that action at this time.