Skip to content

Pixels no longer handles scaling factors correctly. #330

@Cthutu

Description

@Cthutu

I used to be able to set the surface and buffer physical sizes to the same and it would work. I would have a pixel buffer that filled my current window (who's surface matched the window's inner size). Now pixels asserts when resizing the surface and buffer to the same sizes when scale factor is not 1. This assertion happens inside the clamp function.

Even the examples do not correctly function with a scale factor other than 1. For example in minimal-winit you get a thick black border around the rendered area.

Right now, I can't see any method where I can get the buffer and the window the same size when scale factor is not equal to 1. And therefore, I am unable to update to a newer pixels version.

What I would expect:

  1. Get the logical size of the window (this takes into account scale factor)
  2. call resize_surface with the new logical size (maybe physical size?)
  3. call resize_buffer with the new logical size
  4. Have pixels not panic with an assert.
  5. See the pixel buffer fully cover the window.

This is the minimal winit example with scale factor of 125%

image

This is the minimal winit example with scale factor of 100%

image

Consequently, switching scale factor while the minimal winit example is running causes a crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionUsability question

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions