[gnome-shell] St: Take the cairo fallback for large corners
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] St: Take the cairo fallback for large corners
- Date: Sat, 9 Jul 2011 22:05:37 +0000 (UTC)
commit 325462d9bf4bc3ad77e050c126c7b3200f882b06
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon May 16 19:02:24 2011 -0400
St: Take the cairo fallback for large corners
The cogl path pads the corners out to the maximum corner radius to make the
math and painting logic easier. Unfortunately, when the radius exceeds the
actor's halfsize, the padding ends up interfering with other corners, creating
a big mess of rendering errors.
It'd be extremely complicated to fix this properly in the Cogl code,
so take the Cairo fallback.
https://bugzilla.gnome.org/show_bug.cgi?id=649513
src/st/st-theme-node-drawing.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c
index fdef350..a600179 100644
--- a/src/st/st-theme-node-drawing.c
+++ b/src/st/st-theme-node-drawing.c
@@ -1330,6 +1330,7 @@ st_theme_node_render_resources (StThemeNode *node,
gboolean has_border;
gboolean has_border_radius;
gboolean has_inset_box_shadow;
+ gboolean has_large_corners;
StShadow *box_shadow_spec;
StShadow *background_image_shadow_spec;
const char *background_image;
@@ -1367,6 +1368,27 @@ st_theme_node_render_resources (StThemeNode *node,
else
has_border_radius = FALSE;
+ /* The cogl code pads each corner to the maximum border radius,
+ * which results in overlapping corner areas if the radius
+ * exceeds the actor's halfsize, causing rendering errors.
+ * Fall back to cairo in these cases. */
+ has_large_corners = FALSE;
+
+ if (has_border_radius) {
+ guint border_radius[4];
+ int corner;
+
+ st_theme_node_reduce_border_radius (node, border_radius);
+
+ for (corner = 0; corner < 4; corner ++) {
+ if (border_radius[corner] * 2 > height ||
+ border_radius[corner] * 2 > width) {
+ has_large_corners = TRUE;
+ break;
+ }
+ }
+ }
+
/* Load referenced images from disk and draw anything we need with cairo now */
background_image = st_theme_node_get_background_image (node);
border_image = st_theme_node_get_border_image (node);
@@ -1387,7 +1409,8 @@ st_theme_node_render_resources (StThemeNode *node,
/* Use cairo to prerender the node if there is a gradient, or
* background image with borders and/or rounded corners,
- * since we can't do those things easily with cogl.
+ * or large corners, since we can't do those things
+ * easily with cogl.
*
* FIXME: if we could figure out ahead of time that a
* background image won't overlap with the node borders,
@@ -1395,7 +1418,8 @@ st_theme_node_render_resources (StThemeNode *node,
*/
if ((node->background_gradient_type != ST_GRADIENT_NONE)
|| (has_inset_box_shadow && (has_border || node->background_color.alpha > 0))
- || (background_image && (has_border || has_border_radius)))
+ || (background_image && (has_border || has_border_radius))
+ || has_large_corners)
node->prerendered_texture = st_theme_node_prerender_background (node);
if (node->prerendered_texture)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]