forked from AuroraMiddleware/gtk
Merge branch 'fix-downscaled-textures' into 'master'
ngl: Fix downscaled textures See merge request GNOME/gtk!3395
This commit is contained in:
commit
7cb99a0866
@ -1498,20 +1498,14 @@ gsk_ngl_render_job_visit_clipped_child (GskNglRenderJob *job,
|
||||
}
|
||||
else
|
||||
{
|
||||
GskRoundedRect scaled_clip;
|
||||
GskNglRenderOffscreen offscreen = {0};
|
||||
|
||||
offscreen.bounds = &child->bounds;
|
||||
offscreen.bounds = clip;
|
||||
offscreen.force_offscreen = TRUE;
|
||||
offscreen.reset_clip = TRUE;
|
||||
offscreen.do_not_cache = TRUE;
|
||||
|
||||
scaled_clip = GSK_ROUNDED_RECT_INIT ((job->offset_x + clip->origin.x) * job->scale_x,
|
||||
(job->offset_y + clip->origin.y) * job->scale_y,
|
||||
clip->size.width * job->scale_x,
|
||||
clip->size.height * job->scale_y);
|
||||
|
||||
gsk_ngl_render_job_push_clip (job, &scaled_clip);
|
||||
gsk_ngl_render_job_visit_node_with_offscreen (job, child, &offscreen);
|
||||
gsk_ngl_render_job_pop_clip (job);
|
||||
|
||||
g_assert (offscreen.texture_id);
|
||||
|
||||
@ -1521,7 +1515,7 @@ gsk_ngl_render_job_visit_clipped_child (GskNglRenderJob *job,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE0,
|
||||
offscreen.texture_id);
|
||||
gsk_ngl_render_job_draw_offscreen_rect (job, &child->bounds);
|
||||
gsk_ngl_render_job_draw_offscreen_rect (job, clip);
|
||||
gsk_ngl_render_job_end_draw (job);
|
||||
}
|
||||
}
|
||||
@ -1898,6 +1892,7 @@ gsk_ngl_render_job_visit_transform_node (GskNglRenderJob *job,
|
||||
GskNglRenderOffscreen offscreen = {0};
|
||||
|
||||
offscreen.bounds = &child->bounds;
|
||||
offscreen.force_offscreen = FALSE;
|
||||
offscreen.reset_clip = TRUE;
|
||||
|
||||
if (!result_is_axis_aligned (transform, &child->bounds))
|
||||
@ -3624,6 +3619,13 @@ gsk_ngl_render_job_visit_node_with_offscreen (GskNglRenderJob *job,
|
||||
render_target->framebuffer_id);
|
||||
}
|
||||
|
||||
if (downscale_x != 1 || downscale_y != 1)
|
||||
{
|
||||
GskTransform *transform = gsk_transform_scale (NULL, downscale_x, downscale_y);
|
||||
gsk_ngl_render_job_push_modelview (job, transform);
|
||||
gsk_transform_unref (transform);
|
||||
}
|
||||
|
||||
gsk_ngl_render_job_transform_bounds (job, offscreen->bounds, &viewport);
|
||||
/* Code above will scale the size with the scale we use in the render ops,
|
||||
* but for the viewport size, we need our own size limited by the texture size */
|
||||
@ -3632,8 +3634,6 @@ gsk_ngl_render_job_visit_node_with_offscreen (GskNglRenderJob *job,
|
||||
|
||||
gsk_ngl_render_job_set_viewport (job, &viewport, &prev_viewport);
|
||||
gsk_ngl_render_job_set_projection_from_rect (job, &job->viewport, &prev_projection);
|
||||
if (downscale_x != 1 || downscale_y != 1)
|
||||
gsk_ngl_render_job_push_modelview (job, gsk_transform_scale (NULL, downscale_x, downscale_y));
|
||||
prev_alpha = gsk_ngl_render_job_set_alpha (job, 1.0f);
|
||||
|
||||
prev_fbo = gsk_ngl_command_queue_bind_framebuffer (job->command_queue, render_target->framebuffer_id);
|
||||
|
Loading…
Reference in New Issue
Block a user