Skip to content

Conversation

@jcupitt
Copy link
Member

@jcupitt jcupitt commented Jul 29, 2025

Experiment with our own tile snapping.

Seem to work on linux, needs testing elsewhere, ep. on win with non-100% desktop scaling.

@jcupitt
Copy link
Member Author

jcupitt commented Jul 29, 2025

Referring issue libvips/build-win64-mxe#77

@jcupitt
Copy link
Member Author

jcupitt commented Jul 29, 2025

It should be 1.0 / scale, oops. It's working on linux now with hardware desktop scaling, including fractional scaling!

Edge tiles are not being snapped to image edges, so you get annoying strips of background appearing around the sides if the image is smaller than the window. I'm not sure how to fix that.

@jcupitt
Copy link
Member Author

jcupitt commented Jul 29, 2025

I made a test release of this branch to make builds for other platforms simpler: https://github.com/jcupitt/vipsdisp/releases/tag/v4.1.0-tile-snap

There's a win binary on that page.

@jcupitt
Copy link
Member Author

jcupitt commented Jul 29, 2025

Edge tiles are not being snapped to image edges, so you get annoying strips of background appearing around the sides if the image is smaller than the window.

Ah of course, edge tiles ARE being snapped to image edges, it's the rendering of the background that isn't. I'll snap that as well.

@jcupitt
Copy link
Member Author

jcupitt commented Jul 29, 2025

It's working on windows and linux! But there's a problem with test images like this (1024 x 1024 pixels of a 1 pixel checkerboard):

checkerboard

At 200% desktop scaling and 100% vipsdisp magnification, 256x256 image pixel tiles are being drawn as 256x256 "virtual" pixel tiles. These get stretched by gtk scaling and become 512x512 display pixels, with (I think?) trilinear interpolation. You get a blurry mess!

image

The 0 / 255 checkerboard becomes mostly 96 / 159, but with brighter bits at tile edges.

I think we need to draw tiles smaller by the surface scale factor to get 1 image pixel == 1 display hardware pixel. I'll have a go.

@jcupitt
Copy link
Member Author

jcupitt commented Jul 29, 2025

There's also a slight "jelly" effect if you load a large image, select 1:1, and pan sideways by holding a cursor key. Maybe rendering to the display hardware pixel size would fix this too.

but the checkerboard PNG still fails to render correctly
@jcupitt
Copy link
Member Author

jcupitt commented Jul 29, 2025

I scaled tiles quickly, but I don't get 1:1 image pixels to display pixels. Maybe GskScalingFilter isn't considering the desktop scale factor?

@jcupitt
Copy link
Member Author

jcupitt commented Jul 30, 2025

I moved the high-dpi experiment to another branch: https://github.com/jcupitt/vipsdisp/tree/add-high-dpi

I'll merge this, it's much better than the simple +1 we had before.

@jcupitt jcupitt merged commit 23a8e65 into master Jul 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants