[gtk/wip/baedert/transforms6: 51/61] gl renderer: Fix offscreen-drawn transform nodes
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/transforms6: 51/61] gl renderer: Fix offscreen-drawn transform nodes
- Date: Wed, 23 Jan 2019 16:54:57 +0000 (UTC)
commit bee1b5fab2c9b7d372c9e9bd51c44a1fec5250a1
Author: Timm Bäder <mail baedert org>
Date: Wed Dec 12 07:54:26 2018 +0100
gl renderer: Fix offscreen-drawn transform nodes
We need to vertically flip them if they are indeed drawn offscreen, like
everything else. Also use the child bounds for the offscreen texture,
because that's what we draw offscreen.
gsk/gl/gskglrenderer.c | 51 ++++++++++++++++++++++++++++++++++----------------
1 file changed, 35 insertions(+), 16 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 6e7abbc3e1..ef2bc59641 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -811,35 +811,54 @@ render_transform_node (GskGLRenderer *self,
}
else
{
- const float min_x = node->bounds.origin.x;
- const float min_y = node->bounds.origin.y;
- const float max_x = min_x + node->bounds.size.width;
- const float max_y = min_y + node->bounds.size.height;
- const GskQuadVertex vertex_data[GL_N_VERTICES] = {
- { { min_x, min_y }, { 0, 1 }, },
- { { min_x, max_y }, { 0, 0 }, },
- { { max_x, min_y }, { 1, 1 }, },
-
- { { max_x, max_y }, { 1, 0 }, },
- { { min_x, max_y }, { 0, 0 }, },
- { { max_x, min_y }, { 1, 1 }, },
- };
+ const float min_x = child->bounds.origin.x;
+ const float min_y = child->bounds.origin.y;
+ const float max_x = min_x + child->bounds.size.width;
+ const float max_y = min_y + child->bounds.size.height;
int texture_id;
gboolean is_offscreen;
/* For non-trivial transforms, we draw everything on a texture and then
* draw the texture transformed. */
+
/* TODO: We should compute a modelview containing only the "non-trivial"
* part (e.g. the rotation) and use that. We want to keep the scale
* for the texture.
*/
+
add_offscreen_ops (self, builder,
- &node->bounds,
+ &child->bounds,
child,
- &texture_id, &is_offscreen,
+ &texture_id,
+ &is_offscreen,
RESET_CLIP | RESET_OPACITY);
ops_set_texture (builder, texture_id);
ops_set_program (builder, &self->blit_program);
- ops_draw (builder, vertex_data);
+
+ if (is_offscreen)
+ {
+ ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
+ { { min_x, min_y }, { 0, 1 }, },
+ { { min_x, max_y }, { 0, 0 }, },
+ { { max_x, min_y }, { 1, 1 }, },
+
+ { { max_x, max_y }, { 1, 0 }, },
+ { { min_x, max_y }, { 0, 0 }, },
+ { { max_x, min_y }, { 1, 1 }, },
+ });
+ }
+ else
+ {
+ ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
+ { { min_x, min_y }, { 0, 0 }, },
+ { { min_x, max_y }, { 0, 1 }, },
+ { { max_x, min_y }, { 1, 0 }, },
+
+ { { max_x, max_y }, { 1, 1 }, },
+ { { min_x, max_y }, { 0, 1 }, },
+ { { max_x, min_y }, { 1, 0 }, },
+ });
+
+ }
}
ops_pop_modelview (builder);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]