Skip to content

[wf-background] [FIXED with PR] Looks blurry #499

Description

@make-your-soft-better

When the picture is cropped, it looks terribly blurry compared to how it should look. It's like it's blurring or JPEG-ing.

I compared wf-background and awww, and the result is very noticeable on wallpapers, especially those that do not match the screen size. However, awww cannot be used normally, because when you click on the desktop, the wf-background wallpaper appears again.

If you are worried that solving the problem will make the wf-shell more heavy on weak computers and laptops, then it would be better to make a separate "optimization" setting with true on default.

Example on the same wallpaper file, with very "high" (height > width) image:

awww:
Image

wf-background:

Image

UPD 1

static GLuint create_texture()
{
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
return tex;
}

I've read the code, and so far I have suspicions about GL_LINEAR, but I don't think GL_NEAREST will make it better, and maybe the pictures will be very pixelated and "ladder" (It can be fixed with antialiasing but it will be slow and hard for laptops)... I'm not even sure if GL_LINEAR is the problem - it shouldn't spoil the pictures SO badly...

UPD 2

I have a very strong suspicion that integer division by float is happening somewhere, which is why the result becomes an integer, not a float, although it should have been a float. And because of this, the picture becomes much more pixelated than it was before (this effect is observed)

There is a type conversion here:

double source_width = (double)source->get_width();
double source_height = (double)source->get_height();

But... There is not? I'm not sure, but maybe auto is the problem?

auto width_difference = screen_width - source_width;
auto height_difference = screen_height - source_height;

And there is errors may accumulate due to a large number of operations with loss of accuracy:

adjustments->scale_x = 1.0;
adjustments->scale_y = (screen_height / screen_width) * (source_width / source_height);
adjustments->x = 0.0;
adjustments->y = (screen_height - source_height * (screen_width / source_width)) *
adjustments->scale_y * 0.5 * (1.0 / screen_height);
} else
{
adjustments->scale_x = (screen_width / screen_height) * (source_height / source_width);
adjustments->scale_y = 1.0;
adjustments->x = (screen_width - source_width * (screen_height / source_height)) *
adjustments->scale_x * 0.5 * (1.0 / screen_width);
adjustments->y = 0.0;
}
} else /* "preserve_aspect" */
{
auto width_difference = screen_width / source_width;
auto height_difference = screen_height / source_height;
if (width_difference > height_difference)
{
adjustments->scale_x = (screen_width / screen_height) * (source_height / source_width);
adjustments->scale_y = 1.0;
adjustments->x = (screen_width - source_width * (screen_height / source_height)) *
adjustments->scale_x * 0.5 * (1.0 / screen_width);
adjustments->y = 0.0;
} else
{
adjustments->scale_x = 1.0;
adjustments->scale_y = (screen_height / screen_width) * (source_width / source_height);
adjustments->x = 0.0;
adjustments->y = (screen_height - source_height * (screen_width / source_width)) *
adjustments->scale_y * 0.5 * (1.0 / screen_height);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions