summaryrefslogtreecommitdiffstats
path: root/src/text.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-15 18:20:22 +0100
committerDavid Robillard <d@drobilla.net>2020-12-15 19:32:03 +0100
commit7c84fcb0e6bcddc043b7b92dd9d854167844948f (patch)
treeac20067a6ea88d37393e1180456dd877689ab0e9 /src/text.c
parente33f4f6a197eb3cae29dd42ea728f5f782a29897 (diff)
downloadganv-7c84fcb0e6bcddc043b7b92dd9d854167844948f.tar.gz
ganv-7c84fcb0e6bcddc043b7b92dd9d854167844948f.tar.bz2
ganv-7c84fcb0e6bcddc043b7b92dd9d854167844948f.zip
Initialize all variables
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/text.c b/src/text.c
index 058d765..7e5a565 100644
--- a/src/text.c
+++ b/src/text.c
@@ -128,7 +128,8 @@ ganv_text_layout(GanvText* text)
cairo_font_options_destroy(opt);
pango_font_description_free(font);
- int width, height;
+ int width = 0;
+ int height = 0;
pango_layout_get_pixel_size(impl->layout, &width, &height);
impl->coords.width = width;
@@ -255,14 +256,18 @@ ganv_text_point(GanvItem* item, double x, double y, GanvItem** actual_item)
{
*actual_item = NULL;
- double x1, y1, x2, y2;
+ double x1 = 0.0;
+ double y1 = 0.0;
+ double x2 = 0.0;
+ double y2 = 0.0;
ganv_text_bounds_item(item, &x1, &y1, &x2, &y2);
if ((x >= x1) && (y >= y1) && (x <= x2) && (y <= y2)) {
return 0.0;
}
// Point is outside the box
- double dx, dy;
+ double dx = 0.0;
+ double dy = 0.0;
// Find horizontal distance to nearest edge
if (x < x1) {
@@ -305,7 +310,10 @@ ganv_text_draw(GanvItem* item,
ganv_text_layout(text);
}
- double r, g, b, a;
+ double r = 0.0;
+ double g = 0.0;
+ double b = 0.0;
+ double a = 0.0;
color_to_rgba(impl->color, &r, &g, &b, &a);
cairo_set_source_rgba(cr, r, g, b, a);