Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renderer: refactor pl_render_target.dst_rect #80

Closed
jojo61 opened this issue Jun 3, 2020 · 1 comment
Closed

renderer: refactor pl_render_target.dst_rect #80

jojo61 opened this issue Jun 3, 2020 · 1 comment

Comments

@jojo61
Copy link

jojo61 commented Jun 3, 2020

Your refactor commit 65e5e17 breaks the scaling form SD (720x576) to HD (1920x1080) in my applikation.
No changes on my side where done.

@jojo61
Copy link
Author

jojo61 commented Jun 4, 2020

Ok I found it. In renderer.c you scaled x and y with the same factor. Thats wrong. Here a fixed excerpt:

// Adjust the src rect corresponding to the rounded crop
float scale = pl_rect_w(*src) / pl_rect_w(*dst),
      base_x = src->x0,
      base_y = src->y0;

float scale_h = pl_rect_h(*src) / pl_rect_h(*dst);


src->x0 = base_x + (rx0 - dst->x0) * scale;
src->x1 = base_x + (rx1 - dst->x0) * scale;
src->y0 = base_y + (ry0 - dst->y0) * scale_h;
src->y1 = base_y + (ry1 - dst->y0) * scale_h;

// Update dst_rect to the rounded values and re-apply flip if needed. We
// always do this in the `dst_rect` rather than the `src_rect` because this
// allows e.g. polar sampling compute shaders to work.
*dst = (struct pl_rect2df) {
    .x0 = flipped_x ? rx1 : rx0,
    .y0 = flipped_y ? ry1 : ry0,
    .x1 = flipped_x ? rx0 : rx1,
    .y1 = flipped_y ? ry0 : ry1,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants