mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
render/pixman: half-pixel shift to match GPUs
Add a half-pixel shift in the pixman renderer to match the results given by GPU-based renderers when scaling.
This commit is contained in:
parent
e08d52bbc6
commit
77006e5565
1 changed files with 7 additions and 0 deletions
|
|
@ -155,6 +155,13 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
|
||||||
pixman_transform_translate(&transform, NULL,
|
pixman_transform_translate(&transform, NULL,
|
||||||
pixman_int_to_fixed(src_box.x), pixman_int_to_fixed(src_box.y));
|
pixman_int_to_fixed(src_box.x), pixman_int_to_fixed(src_box.y));
|
||||||
|
|
||||||
|
// GPUs have a half pixel shift compared to pixman because GPU coordinates refer
|
||||||
|
// to the centre of each pixel rather than its top-left. This makes no difference
|
||||||
|
// when there's no transforms as we still copy the correct pixel across. But when
|
||||||
|
// we do scaling it does make a visible difference, so account for it here.
|
||||||
|
pixman_transform_translate(&transform, NULL,
|
||||||
|
-pixman_double_to_fixed(0.5), -pixman_double_to_fixed(0.5));
|
||||||
|
|
||||||
pixman_image_set_transform(texture->image, &transform);
|
pixman_image_set_transform(texture->image, &transform);
|
||||||
|
|
||||||
switch (options->filter_mode) {
|
switch (options->filter_mode) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue