D14783: [scenes/opengl] Correctly draw shadows when corner tiles are missing

Vlad Zagorodniy <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
zzag created this revision.
zzag added a reviewer: KWin.
Restricted Application added a project: KWin.
Restricted Application added a subscriber: kwin.
zzag requested review of this revision.

REVISION SUMMARY
  Current implementation of buildQuads assumes that corner shadow tiles
  are always present:
  
    const QRectF leftRect(
        topLeftRect.bottomLeft(),
        bottomLeftRect.topRight());
  
  but that assumption is wrong. For example, if the default panel is on
  the bottom screen edge, then the calendar popup won't have the
  bottom-left shadow tile(at least on Wayland). Which means that the left
  shadow tile won't be visible because
  topLeftRect.left() == bottomLeftRect.right().
  
  Corner rectangles only have to influence height of the left/right tile
  and width of the top/bottom tile. Width of the left/right tile and
  height of the top/bottom tile should not be controlled by corner tiles.
  
  Overall, this is how shadow quads are computed:
  
  - Compute the outer rectangle;
  - Compute target rectangle for each corner tile. If some corner tile is missing, move the target rectangle to the corresponding corner of the inner shadow rect and set its width and height to 0. We need to do that to prevent top/right/bottom/left tiles from spanning over corners:
  
  F6190219: Screenshot_20180813_114219.png <https://phabricator.kde.org/F6190219>
  
  We would rather prefer something like this if the top-left tile is
  missing:
  F6190233: Screenshot_20180813_113915.png <https://phabricator.kde.org/F6190233>
  
  - Fix overlaps between corner tiles;
  - Compute target rectangles for top, right, bottom, and left tiles;
  - Fix overlaps between left/right and top/bottom shadow tiles.

TEST PLAN
  - Ran tests;
  - Resized Konsole to its minimimum size(on X11 and Wayland);
  - Opened the calendar popup(on X11 and Wayland):
  
  Before:
  F6190344: Screenshot_20180813_123136.png <https://phabricator.kde.org/F6190344>
  
  After:
  F6190346: Screenshot_20180813_122954.png <https://phabricator.kde.org/F6190346>

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D14783

AFFECTED FILES
  autotests/integration/scene_opengl_shadow_test.cpp
  plugins/scenes/opengl/scene_opengl.cpp

To: zzag, #kwin
Cc: kwin, mkulinski, ragreen, jackyalcine, Pitel, iodelay, bwowk, ZrenBot, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.