[scenes/qpainter] Draw decoration shadows
ClosedPublic

Authored by zzag on Mar 1 2018, 2:25 PM.

Details

Summary

QPainter doesn't render decoration shadows. It renders only
shadows provided through ShadowInterface.

With this change, painting of shadows is done in similar way OpenGL backend is
currently doing.

Before

After

Depends on D10811 (dummy decoration with shadows in autotests)

Test Plan
  • start kwin with QPainter backend enabled:
KWIN_COMPOSE=Q kwin_wayland --xwayland --windowed
  • open konsole and kate:
DISPLAY=:1 konsole
DISPLAY=:1 kate

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Mar 1 2018, 2:25 PM
Restricted Application added a project: KWin. · View Herald TranscriptMar 1 2018, 2:25 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Mar 1 2018, 2:25 PM
zzag edited the summary of this revision. (Show Details)Mar 1 2018, 2:26 PM
zzag edited the test plan for this revision. (Show Details)
zzag edited the test plan for this revision. (Show Details)Mar 1 2018, 2:29 PM
zzag updated this revision to Diff 28636.Mar 4 2018, 9:04 PM

use ">=" instead of ">" when checking for shadow tile overlaps

zzag updated this revision to Diff 29615.Mar 15 2018, 5:01 PM

tests: rename test helpers

davidedmundson accepted this revision.Mar 23 2018, 12:51 PM
This revision is now accepted and ready to land.Mar 23 2018, 12:51 PM
zzag added a comment.EditedMar 23 2018, 2:24 PM

@davidedmundson can you shed light on texture coordinates in WindowQuads? According to its API it supports several spaces:

  • image space (textureX(), textureY())
  • uv space (u(), v())

Is it correct?


By image space I mean the following:

Let say there is an image that is 128 pixels wide and 42 pixels high.

  • in image space, textureX could range from 0 to 127 and textureY could range from 0 to 41
  • in uv space, u could range from 0 to 1 and v could range from 0 to 1
In D10943#232262, @zzag wrote:

@davidedmundson can you shed light on texture coordinates in WindowQuads? According to its API it supports several spaces:

  • image space (textureX(), textureY())
  • uv space (u(), v())

    Is it correct?

    ---

    By image space I mean the following:

    Let say there is an image that is 128 pixel wide and 42 pixel high.
  • in image space, textureX could range from 0 to 127 and textureY could range from 0 to 41
  • in uv space, u could range from 0 to 1 and v could range from 0 to 1

In general, yes.
QPainter API is typically unnormalised, GL texture stuff is normalised.

You can do painter.setViewport() to create a create a normalised space for qpainter space too.

zzag added a comment.EditedMar 23 2018, 3:09 PM

In general, yes.
QPainter API is typically unnormalised, GL texture stuff is normalised.

OK, that's good.

You can do painter.setViewport() to create a create a normalised space for qpainter space too.

Yeah, I'd been thinking about it before. I'm afraid doing scaling and window-viewport magic could cause some artifacts because of floating point number errors. It is okay if two quads(triangles) share an edge in OpenGL, but with QPainter, as far as I know, it would cause visual problems.

In D10943#232310, @zzag wrote:

In general, yes.
QPainter API is typically unnormalised, GL texture stuff is normalised.

OK, that's good.

You can do painter.setViewport() to create a create a normalised space for qpainter space too.

Yeah, I'd been thinking about it before. I'm afraid doing scaling and window-viewport magic could cause some artifacts because of floating point number errors. It is okay if two quads(triangles) share an edge in OpenGL, but with QPainter, as far as I know, it would cause visual problems.

QPainter is surprisingly smart. QPainter is all float based internally, I use it a lot (mostly implicitly) in all the high DPI stuff, and I've never had any issues with that area.

zzag added a comment.Mar 23 2018, 3:31 PM

QPainter is surprisingly smart. QPainter is all float based internally, I use it a lot (mostly implicitly) in all the high DPI stuff, and I've never had any issues with that area.

Maybe, I should try to convert texture coordinates to UV space but I don't have much time. :(
I'd like to leave it as it is, if you don't mind.

zzag planned changes to this revision.May 20 2018, 8:47 PM
zzag updated this revision to Diff 34588.May 21 2018, 4:32 PM

Delete WindowQuadListWrapper in tests

This revision is now accepted and ready to land.May 21 2018, 4:32 PM
zzag retitled this revision from [scenes/qpainter] draw decoration shadows to [scenes/qpainter] Draw decoration shadows.May 21 2018, 4:33 PM
This revision was automatically updated to reflect the committed changes.