summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2023-04-01 22:48:38 -0400
committerMatthias Clasen <mclasen@redhat.com>2023-04-01 22:51:52 -0400
commit8aead765fe1a9600765953c7d3604c66104c03d5 (patch)
treeac271e4beb4518cb57b4415c16cbab4293ab56a7
parent39a1d6cf56b90833f56764d569b3f98e8ef4f729 (diff)
downloadgtk+-8aead765fe1a9600765953c7d3604c66104c03d5.tar.gz
gsk: Pass scale as float to the command queue
-rw-r--r--gsk/gl/gskglcommandqueue.c12
-rw-r--r--gsk/gl/gskglcommandqueueprivate.h2
-rw-r--r--gsk/gl/gskglrenderjob.c6
3 files changed, 10 insertions, 10 deletions
diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c
index 3d2998e43d..f186c79fb8 100644
--- a/gsk/gl/gskglcommandqueue.c
+++ b/gsk/gl/gskglcommandqueue.c
@@ -993,7 +993,7 @@ gsk_gl_command_queue_sort_batches (GskGLCommandQueue *self)
* gsk_gl_command_queue_execute:
* @self: a `GskGLCommandQueue`
* @surface_height: the height of the backing surface
- * @scale_factor: the scale factor of the backing surface
+ * @scale: the scale of the backing surface
* @scissor: (nullable): the scissor clip if any
* @default_framebuffer: the default framebuffer id if not zero
*
@@ -1009,7 +1009,7 @@ gsk_gl_command_queue_sort_batches (GskGLCommandQueue *self)
void
gsk_gl_command_queue_execute (GskGLCommandQueue *self,
guint surface_height,
- guint scale_factor,
+ float scale,
const cairo_region_t *scissor,
guint default_framebuffer)
{
@@ -1097,10 +1097,10 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
g_assert (cairo_region_num_rectangles (scissor) == 1);
cairo_region_get_rectangle (scissor, 0, &r);
- scissor_test.origin.x = r.x * scale_factor;
- scissor_test.origin.y = surface_height - (r.height * scale_factor) - (r.y * scale_factor);
- scissor_test.size.width = r.width * scale_factor;
- scissor_test.size.height = r.height * scale_factor;
+ scissor_test.origin.x = (int) floor (r.x * scale);
+ scissor_test.origin.y = (int) floor (surface_height - (r.height * scale) - (r.y * scale));
+ scissor_test.size.width = (int) ceil (r.width * scale);
+ scissor_test.size.height = (int) ceil (r.height * scale);
}
next_batch_index = self->head_batch_index;
diff --git a/gsk/gl/gskglcommandqueueprivate.h b/gsk/gl/gskglcommandqueueprivate.h
index c946eb9803..fd72f68aff 100644
--- a/gsk/gl/gskglcommandqueueprivate.h
+++ b/gsk/gl/gskglcommandqueueprivate.h
@@ -288,7 +288,7 @@ void gsk_gl_command_queue_begin_frame (GskGLCommandQueue
void gsk_gl_command_queue_end_frame (GskGLCommandQueue *self);
void gsk_gl_command_queue_execute (GskGLCommandQueue *self,
guint surface_height,
- guint scale_factor,
+ float scale,
const cairo_region_t *scissor,
guint default_framebuffer);
int gsk_gl_command_queue_upload_texture (GskGLCommandQueue *self,
diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c
index b68a8278aa..48a30f8143 100644
--- a/gsk/gl/gskglrenderjob.c
+++ b/gsk/gl/gskglrenderjob.c
@@ -4322,14 +4322,14 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
GskRenderNode *root)
{
G_GNUC_UNUSED gint64 start_time;
- guint scale_factor;
+ float scale;
guint surface_height;
g_return_if_fail (job != NULL);
g_return_if_fail (root != NULL);
g_return_if_fail (GSK_IS_GL_DRIVER (job->driver));
- scale_factor = MAX (job->scale_x, job->scale_y);
+ scale = MAX (job->scale_x, job->scale_y);
surface_height = job->viewport.size.height;
gsk_gl_command_queue_make_current (job->command_queue);
@@ -4360,7 +4360,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
start_time = GDK_PROFILER_CURRENT_TIME;
gsk_gl_command_queue_make_current (job->command_queue);
gdk_gl_context_push_debug_group (job->command_queue->context, "Executing command queue");
- gsk_gl_command_queue_execute (job->command_queue, surface_height, scale_factor, job->region, job->default_framebuffer);
+ gsk_gl_command_queue_execute (job->command_queue, surface_height, scale, job->region, job->default_framebuffer);
gdk_gl_context_pop_debug_group (job->command_queue->context);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Execute GL command queue", "");
}