[gtk/fix-neg-scales-4.2: 21/22] ngl: Handle negative scales
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-neg-scales-4.2: 21/22] ngl: Handle negative scales
- Date: Fri, 16 Jul 2021 23:34:55 +0000 (UTC)
commit 3d0c23597d1d8fdb22921e6c273e7ccd99cbd77f
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 15 16:40:13 2021 -0400
ngl: Handle negative scales
Scale factors can be negative, but we were not
looking out for that, triggering an assertion when
trying to create a render target with negative
width of height. Avoid that.
Fixes: #4096
gsk/ngl/gsknglrenderjob.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index 3e823dedab..02f8bcc4b8 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -3573,19 +3573,23 @@ gsk_ngl_render_job_visit_node_with_offscreen (GskNglRenderJob *job,
{
int max_texture_size = job->command_queue->max_texture_size;
- scaled_width = ceilf (offscreen->bounds->size.width * job->scale_x);
+ scaled_width = ceilf (offscreen->bounds->size.width * fabs (job->scale_x));
if (scaled_width > max_texture_size)
{
downscale_x = (float)max_texture_size / scaled_width;
scaled_width = max_texture_size;
}
+ if (job->scale_x < 0)
+ downscale_x = -downscale_x;
- scaled_height = ceilf (offscreen->bounds->size.height * job->scale_y);
+ scaled_height = ceilf (offscreen->bounds->size.height * fabs (job->scale_y));
if (scaled_height > max_texture_size)
{
downscale_y = (float)max_texture_size / scaled_height;
scaled_height = max_texture_size;
}
+ if (job->scale_y < 0)
+ downscale_y = -downscale_y;
}
GskNglRenderTarget *render_target;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]