[gtk/wip/chergert/glproto: 629/920] add gsk_gl_render_job_draw() with float variant
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto: 629/920] add gsk_gl_render_job_draw() with float variant
- Date: Mon, 8 Feb 2021 19:15:33 +0000 (UTC)
commit 4e97f9027288d2531c4e8504c3a1190f0e67458a
Author: Christian Hergert <chergert redhat com>
Date: Sat Jan 2 00:22:07 2021 -0800
add gsk_gl_render_job_draw() with float variant
gsk/next/gskglrenderjob.c | 50 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 48 insertions(+), 2 deletions(-)
---
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index 24d9d0bad3..ec1d592c4a 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -613,8 +613,8 @@ gsk_gl_render_job_node_overlaps_clip (GskGLRenderJob *job,
}
static void
-gsk_gl_render_job_draw_rect (GskGLRenderJob *job,
- graphene_rect_t *rect)
+gsk_gl_render_job_draw_rect (GskGLRenderJob *job,
+ const graphene_rect_t *rect)
{
GskGLDrawVertex *vertices;
const float min_x = job->offset_x + rect->origin.x;
@@ -655,6 +655,52 @@ gsk_gl_render_job_draw_rect (GskGLRenderJob *job,
vertices[5].uv[1] = 0;
}
+static void
+gsk_gl_render_job_draw (GskGLRenderJob *job,
+ float x,
+ float y,
+ float width,
+ float height)
+{
+ GskGLDrawVertex *vertices;
+ const float min_x = job->offset_x + x;
+ const float min_y = job->offset_y + y;
+ const float max_x = min_x + width;
+ const float max_y = min_y + height;
+
+ vertices = gsk_gl_command_queue_add_vertices (job->command_queue, NULL);
+
+ vertices[0].position[0] = min_x;
+ vertices[0].position[1] = min_y;
+ vertices[0].uv[0] = 0;
+ vertices[0].uv[1] = 0;
+
+ vertices[1].position[0] = min_x;
+ vertices[1].position[1] = max_y;
+ vertices[1].uv[0] = 0;
+ vertices[1].uv[1] = 1;
+
+ vertices[2].position[0] = max_x;
+ vertices[2].position[1] = min_y;
+ vertices[2].uv[0] = 1;
+ vertices[2].uv[1] = 0;
+
+ vertices[3].position[0] = max_x;
+ vertices[3].position[1] = max_y;
+ vertices[3].uv[0] = 1;
+ vertices[3].uv[1] = 1;
+
+ vertices[4].position[0] = min_x;
+ vertices[4].position[1] = max_y;
+ vertices[4].uv[0] = 0;
+ vertices[4].uv[1] = 1;
+
+ vertices[5].position[0] = max_x;
+ vertices[5].position[1] = min_y;
+ vertices[5].uv[0] = 1;
+ vertices[5].uv[1] = 0;
+}
+
static void
gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
GskRenderNode *node)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]