diff --git a/src/renderer.c b/src/renderer.c index 802480d..08eff17 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -2801,6 +2801,9 @@ static void fix_refs_and_rects(struct pass_state *pass) pl_rect2df_normalize(src); pl_rect2df_normalize(dst); + if (flipped_y) PL_SWAP(dst->y1, dst->y0); + if (flipped_x) PL_SWAP(dst->x1, dst->x0); + // Round the output rect and clip it to the framebuffer dimensions float rx0 = roundf(PL_CLAMP(dst->x0, 0.0, dst_w)), ry0 = roundf(PL_CLAMP(dst->y0, 0.0, dst_h)), @@ -2822,10 +2825,10 @@ static void fix_refs_and_rects(struct pass_state *pass) // always do this in the `dst` rather than the `src`` because this allows // e.g. polar sampling compute shaders to work. *dst = (pl_rect2df) { - .x0 = flipped_x ? rx1 : rx0, - .y0 = flipped_y ? ry1 : ry0, - .x1 = flipped_x ? rx0 : rx1, - .y1 = flipped_y ? ry0 : ry1, + .x0 = rx0, + .y0 = ry0, + .x1 = rx1, + .y1 = ry1, }; // Copies of the above, for convenience