diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-04-11 22:26:36 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-04-11 22:35:02 -0400 |
commit | 849692b24ba2073f9ef1edfe5de9ec6a6b169bd8 (patch) | |
tree | 61f5e371d67efde3644d2a3b7f78f88db52883cf /gsk/ngl/gsknglrenderjob.c | |
parent | f3bf4e487690443ba6f3acc341ad7f7293b0aae4 (diff) | |
download | gtk+-849692b24ba2073f9ef1edfe5de9ec6a6b169bd8.tar.gz |
ngl: Fix unevenly scaled shadowsngl-shadow-fixes
Ensure that we don't cut them off at the edges.
Diffstat (limited to 'gsk/ngl/gsknglrenderjob.c')
-rw-r--r-- | gsk/ngl/gsknglrenderjob.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c index 5c34d1273b..e23d4741c6 100644 --- a/gsk/ngl/gsknglrenderjob.c +++ b/gsk/ngl/gsknglrenderjob.c @@ -2299,7 +2299,8 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job, float blur_radius = gsk_outset_shadow_node_get_blur_radius (node); float blur_extra = blur_radius * 2.0f; /* 2.0 = shader radius_multiplier */ float half_blur_extra = blur_extra / 2.0f; - int extra_blur_pixels = ceilf (half_blur_extra * scale_x); + int extra_blur_pixels_x = ceilf (half_blur_extra * scale_x); + int extra_blur_pixels_y = ceilf (half_blur_extra * scale_y); float spread = gsk_outset_shadow_node_get_spread (node); float dx = gsk_outset_shadow_node_get_dx (node); float dy = gsk_outset_shadow_node_get_dy (node); @@ -2352,10 +2353,10 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job, texture_width = (int)ceil ((scaled_outline.bounds.size.width + blur_extra) * scale_x); texture_height = (int)ceil ((scaled_outline.bounds.size.height + blur_extra) * scale_y); - scaled_outline.bounds.origin.x = extra_blur_pixels; - scaled_outline.bounds.origin.y = extra_blur_pixels; - scaled_outline.bounds.size.width = texture_width - (extra_blur_pixels * 2); - scaled_outline.bounds.size.height = texture_height - (extra_blur_pixels * 2); + scaled_outline.bounds.origin.x = extra_blur_pixels_x; + scaled_outline.bounds.origin.y = extra_blur_pixels_y; + scaled_outline.bounds.size.width = texture_width - (extra_blur_pixels_x * 2); + scaled_outline.bounds.size.height = texture_height - (extra_blur_pixels_y * 2); for (guint i = 0; i < G_N_ELEMENTS (scaled_outline.corner); i++) { @@ -2493,12 +2494,13 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job, GskNglTexture *texture; texture = gsk_ngl_driver_get_texture_by_id (job->driver, blurred_texture_id); - slices = gsk_ngl_texture_get_nine_slice (texture, &scaled_outline, extra_blur_pixels); + slices = gsk_ngl_texture_get_nine_slice (texture, &scaled_outline, extra_blur_pixels_x, extra_blur_pixels_y); offscreen.was_offscreen = TRUE; /* Our texture coordinates MUST be scaled, while the actual vertex coords - * MUST NOT be scaled. */ + * MUST NOT be scaled. + */ left_width = slices[NINE_SLICE_TOP_LEFT].rect.width / scale_x; right_width = slices[NINE_SLICE_TOP_RIGHT].rect.width / scale_x; |