forked from AuroraMiddleware/gtk
Revert "gl renderer: Take a out graphene_rect in blur_node()"
This reverts commit 7eece7e769
.
This commit is contained in:
parent
3e319b409b
commit
12611fa142
@ -466,15 +466,12 @@ load_vertex_data (GskQuadVertex vertex_data[GL_N_VERTICES],
|
||||
}
|
||||
|
||||
static void
|
||||
load_offscreen_vertex_data (GskQuadVertex vertex_data[GL_N_VERTICES],
|
||||
const graphene_rect_t *bounds,
|
||||
RenderOpBuilder *builder)
|
||||
fill_vertex_data (GskQuadVertex vertex_data[GL_N_VERTICES],
|
||||
const float min_x,
|
||||
const float min_y,
|
||||
const float max_x,
|
||||
const float max_y)
|
||||
{
|
||||
const float min_x = builder->dx + bounds->origin.x;
|
||||
const float min_y = builder->dy + bounds->origin.y;
|
||||
const float max_x = min_x + bounds->size.width;
|
||||
const float max_y = min_y + bounds->size.height;
|
||||
|
||||
vertex_data[0].position[0] = min_x;
|
||||
vertex_data[0].position[1] = min_y;
|
||||
vertex_data[0].uv[0] = 0;
|
||||
@ -506,6 +503,22 @@ load_offscreen_vertex_data (GskQuadVertex vertex_data[GL_N_VERTICES],
|
||||
vertex_data[5].uv[1] = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
load_offscreen_vertex_data (GskQuadVertex vertex_data[GL_N_VERTICES],
|
||||
GskRenderNode *node,
|
||||
RenderOpBuilder *builder)
|
||||
{
|
||||
const float min_x = builder->dx + node->bounds.origin.x;
|
||||
const float min_y = builder->dy + node->bounds.origin.y;
|
||||
const float max_x = min_x + node->bounds.size.width;
|
||||
const float max_y = min_y + node->bounds.size.height;
|
||||
|
||||
fill_vertex_data (vertex_data,
|
||||
min_x, min_y,
|
||||
max_x, max_y);
|
||||
}
|
||||
|
||||
|
||||
static void gsk_gl_renderer_setup_render_mode (GskGLRenderer *self);
|
||||
static bool add_offscreen_ops (GskGLRenderer *self,
|
||||
RenderOpBuilder *builder,
|
||||
@ -669,7 +682,7 @@ render_fallback_node (GskGLRenderer *self,
|
||||
{
|
||||
ops_set_program (builder, &self->programs->blit_program);
|
||||
ops_set_texture (builder, cached_id);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), &node->bounds, builder);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -753,7 +766,7 @@ render_fallback_node (GskGLRenderer *self,
|
||||
|
||||
ops_set_program (builder, &self->programs->blit_program);
|
||||
ops_set_texture (builder, texture_id);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), &node->bounds, builder);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -1247,7 +1260,7 @@ render_gl_shader_node (GskGLRenderer *self,
|
||||
ops_set_extra_texture (builder, results[i].region.texture_id, i);
|
||||
}
|
||||
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), &node->bounds, builder);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1735,7 +1748,7 @@ render_rounded_clip_node (GskGLRenderer *self,
|
||||
ops_set_program (builder, &self->programs->blit_program);
|
||||
ops_set_texture (builder, result.region.texture_id);
|
||||
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), &node->bounds, builder);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1875,7 +1888,7 @@ blur_node (GskGLRenderer *self,
|
||||
float blur_radius,
|
||||
guint extra_flags,
|
||||
TextureRegion *out_region,
|
||||
graphene_rect_t *out_rect)
|
||||
float *out_vertex_data[4]) /* min, max, min, max */
|
||||
{
|
||||
const float scale_x = builder->scale_x;
|
||||
const float scale_y = builder->scale_y;
|
||||
@ -1884,7 +1897,6 @@ blur_node (GskGLRenderer *self,
|
||||
int blurred_texture_id;
|
||||
|
||||
g_assert (blur_radius > 0);
|
||||
g_assert (out_rect);
|
||||
|
||||
/* Increase texture size for the given blur radius and scale it */
|
||||
texture_width = ceilf ((node->bounds.size.width + blur_extra));
|
||||
@ -1910,10 +1922,13 @@ blur_node (GskGLRenderer *self,
|
||||
init_full_texture_region (out_region, blurred_texture_id);
|
||||
}
|
||||
|
||||
out_rect->origin.x = node->bounds.origin.x - (blur_extra / 2.0f);
|
||||
out_rect->origin.y = node->bounds.origin.y - (blur_extra / 2.0f);
|
||||
out_rect->size.width = node->bounds.size.width + (blur_extra / 2.0f);
|
||||
out_rect->size.height = node->bounds.size.height + (blur_extra / 2.0f);
|
||||
if (out_vertex_data)
|
||||
{
|
||||
*out_vertex_data[0] = builder->dx + node->bounds.origin.x - (blur_extra / 2.0);
|
||||
*out_vertex_data[1] = builder->dx + node->bounds.origin.x + node->bounds.size.width + (blur_extra / 2.0);
|
||||
*out_vertex_data[2] = builder->dy + node->bounds.origin.y - (blur_extra / 2.0);
|
||||
*out_vertex_data[3] = builder->dy + node->bounds.origin.y + node->bounds.size.height + (blur_extra / 2.0);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -1925,7 +1940,7 @@ render_blur_node (GskGLRenderer *self,
|
||||
GskRenderNode *child = gsk_blur_node_get_child (node);
|
||||
TextureRegion blurred_region;
|
||||
GskTextureKey key;
|
||||
graphene_rect_t result_rect;
|
||||
float min_x, max_x, min_y, max_y;
|
||||
|
||||
if (node_is_invisible (child))
|
||||
return;
|
||||
@ -1942,14 +1957,16 @@ render_blur_node (GskGLRenderer *self,
|
||||
key.scale_y = builder->scale_y;
|
||||
key.filter = GL_NEAREST;
|
||||
blurred_region.texture_id = gsk_gl_driver_get_texture_for_key (self->gl_driver, &key);
|
||||
blur_node (self, child, builder, blur_radius, 0, &blurred_region, &result_rect);
|
||||
blur_node (self, child, builder, blur_radius, 0, &blurred_region,
|
||||
(float*[4]){&min_x, &max_x, &min_y, &max_y});
|
||||
|
||||
g_assert (blurred_region.texture_id != 0);
|
||||
|
||||
/* Draw the result */
|
||||
ops_set_program (builder, &self->programs->blit_program);
|
||||
ops_set_texture (builder, blurred_region.texture_id);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), &result_rect, builder);
|
||||
fill_vertex_data (ops_draw (builder, NULL), min_x, min_y, max_x, max_y);
|
||||
|
||||
|
||||
/* Add to cache for the blur node */
|
||||
gsk_gl_driver_set_texture_for_key (self->gl_driver, &key, blurred_region.texture_id);
|
||||
@ -2549,9 +2566,18 @@ render_shadow_node (GskGLRenderer *self,
|
||||
|
||||
if (shadow->radius > 0)
|
||||
{
|
||||
float min_x;
|
||||
float min_y;
|
||||
float max_x;
|
||||
float max_y;
|
||||
|
||||
result.region.texture_id = 0;
|
||||
blur_node (self, shadow_child, builder, shadow->radius, NO_CACHE_PLZ, &result.region,
|
||||
&bounds);
|
||||
(float*[4]){&min_x, &max_x, &min_y, &max_y});
|
||||
bounds.origin.x = min_x - builder->dx;
|
||||
bounds.origin.y = min_y - builder->dy;
|
||||
bounds.size.width = max_x - min_x;
|
||||
bounds.size.height = max_y - min_y;
|
||||
result.is_offscreen = true;
|
||||
}
|
||||
else if (dx == 0 && dy == 0)
|
||||
@ -2640,7 +2666,7 @@ render_cross_fade_node (GskGLRenderer *self,
|
||||
|
||||
ops_set_texture (builder, start_result.region.texture_id);
|
||||
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), &node->bounds, builder);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -2681,7 +2707,7 @@ render_blend_node (GskGLRenderer *self,
|
||||
op->source2 = top_result.region.texture_id;
|
||||
op->mode = gsk_blend_node_get_blend_mode (node);
|
||||
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), &node->bounds, builder);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -4377,11 +4403,8 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
||||
graphene_matrix_scale (&m, 1, -1, 1); /* Undo the scale init_projection_matrix() does again */
|
||||
ops_set_projection (&self->op_builder, &m);
|
||||
|
||||
g_assert (self->op_builder.dx == 0);
|
||||
g_assert (self->op_builder.dy == 0);
|
||||
|
||||
load_offscreen_vertex_data (ops_draw (&self->op_builder, NULL),
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height), &self->op_builder);
|
||||
fill_vertex_data (ops_draw (&self->op_builder, NULL),
|
||||
0, 0, width, height);
|
||||
ops_pop_clip (&self->op_builder);
|
||||
gsk_gl_renderer_render_ops (self);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user