wayfire icon indicating copy to clipboard operation
wayfire copied to clipboard

Fractional scaling creates black lines in the decoration

Open AhoyISki opened this issue 2 years ago • 4 comments

Describe the bug Fractional scaling creates black the decoration.

To Reproduce Steps to reproduce the behavior:

  1. Enable plugin decoration.
  2. Change the scale to a non whole value (may not happen on some values, I'm not sure).
  3. Black lines show up just under the title bar (1 pixel wide): image

Expected behavior Them not showing up.

Speculation I suspect this is being caused by "incorrect layout assignment". What I mean by this is that wayfire, when scaling, applies a simple approximate "size up" to all geometries in the layout.

Dumb solution proposal Maybe the problem is that, when setting the size for scaled geometries, wayfire is using a simple int casting of width and height times the (double)scale to get the pixel size. Perhaps it would be wiser to use something like ceil()? I don't know if this would have any side effects, or if wayfire even does it that way, but this is what came to mind.

Wayfire version 0.7.2-1, git.

AhoyISki avatar Apr 09 '22 01:04 AhoyISki

Wayfire is supposed to expand the damaged area, do you have a particular place in the code where we simply cast to int? That would likely be a bug.

ammen99 avatar Apr 09 '22 12:04 ammen99

Maybe here...? https://github.com/WayfireWM/wayfire/blob/master/src/core/output-layout.cpp#L1163-1183 I'm gonna be honest though, I'm not familiar with the code at all, so this probably isn't it

AhoyISki avatar Apr 09 '22 15:04 AhoyISki

Now that I think about it, floor() might be a better solution than ceil().

AhoyISki avatar Apr 09 '22 18:04 AhoyISki

Solution for this issue: first transform the damaged region to physical coordinates, and then render that (i.e do not use logic_scissor() in the code, but the barebones scissor()). The problem is that when we have a damage region consisting of multiple rectangles, when we scale them to physical coordinates (and round) there are often times overlaps.

ammen99 avatar Apr 16 '24 14:04 ammen99