summaryrefslogtreecommitdiff
path: root/cairo/gmathcairo_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'cairo/gmathcairo_utils.c')
-rw-r--r--cairo/gmathcairo_utils.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/cairo/gmathcairo_utils.c b/cairo/gmathcairo_utils.c
index 21f2cd8..a158a9a 100644
--- a/cairo/gmathcairo_utils.c
+++ b/cairo/gmathcairo_utils.c
@@ -132,7 +132,7 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value,
dwl = dwr = dwt = dwb = 0;
dhl = dhr = dht = dhb = 0;
empty_height = 0;
- width = width0;
+ width = width1 = width0;
height = height0;
if (lsymbol)
@@ -155,20 +155,21 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value,
height = MAX (height, dhr);
}
}
- width1 = width;
height1 = height;
- empty_height = (height1 - height0) / 2;
+ empty_height = (height - height0) / 2;
if (tsymbol)
{
children[2] = gmathcairo_render_symbol (ccontext, tsymbol, size_small);
if (children[2])
{
gmathcairo_get_surface_size (children[2], &dwt, &dht);
- width = MAX (width, dwt);
- if (dwt <= width0 && dht > empty_height)
- height += dht - empty_height;
- else if (dwt > width0)
- height += dht;
+ if (dwt > width1)
+ {
+ width += dwt - width1;
+ width1 = dwt;
+ }
+ if (dht > empty_height)
+ height += dht - empty_height;
}
}
if (bsymbol)
@@ -177,18 +178,20 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value,
if (children[3])
{
gmathcairo_get_surface_size (children[3], &dwb, &dhb);
- width = MAX (width, dwb);
- if (dwb <= width0 && dhb > empty_height)
- height += dhb - empty_height;
- else if (dwb > width0)
- height += dhb;
+ if (dwb > width1)
+ {
+ width += dwb - width1;
+ width1 = dwb;
+ }
+ if (dhb > empty_height)
+ height += dhb - empty_height;
}
}
- x0 = dwl;
- y0 = dht + (height1 - height0) / 2;
- if (width1 != width)
- x0 = dwl + (width - width0) / 2;
+ x0 = dwl + (width1 - width0) / 2;
+ y0 = (height1 - height0) / 2;
+ if (dht > empty_height)
+ y0 += dhb - empty_height;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
cr = cairo_create (surface);
@@ -201,7 +204,7 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value,
if (children[0])
{
- x = x0 - dwl;
+ x = 0;
y = y0 + (height0 - dhl) / 2;
cairo_save (cr);
cairo_set_source_surface (cr, children[0], x, y);
@@ -212,7 +215,7 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value,
if (children[1])
{
- x = x0 + width0;
+ x = width - dwr;
y = y0 + (height0 - dhr) / 2;
cairo_save (cr);
cairo_set_source_surface (cr, children[1], x, y);
@@ -224,7 +227,7 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value,
if (children[2])
{
x = x0 + (width0 - dwt) / 2;
- if (dwt <= width0)
+ if (dhb <= empty_height)
y = y0 - dht;
else
y = 0;
@@ -237,8 +240,8 @@ gmathcairo_render_cross_symbol (GMathCairoContext *ccontext, gchar *value,
if (children[3])
{
- x = x0 + (width0 - dwb) / 3;
- if (dwb <= width0)
+ x = x0 + (width0 - dwb) / 2;
+ if (dht <= empty_height)
y = y0 + height0;
else
y = height - dwb;