]> err.no Git - mapper/commitdiff
Pre-calc size/2
authorKaj-Michael Lang <milang@onion.tal.org>
Mon, 15 Oct 2007 12:33:10 +0000 (15:33 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Mon, 15 Oct 2007 12:33:10 +0000 (15:33 +0300)
src/gtkcompass.c

index d2936d41d1a25fac6e277525c5f5e9c766506c9a..998df74ab3c71c62f70db84b52e11ed74b2cb80b 100644 (file)
@@ -287,7 +287,11 @@ gint fsize[5] = { 0, 4, 10, 4, 0 };
 
 widget=GTK_WIDGET(compass);
 size=compass->size;
+#if 1
 hsize=size/2;
+#else
+hsize=0;
+#endif
 
 fs=size/42;
 BOUND(fs, 1, 16);
@@ -302,38 +306,38 @@ pango_layout_get_pixel_size(compass->layout, &x, &y);
 
 gdk_draw_layout(widget->window,
        compass->gc_h,
-       compass->xoffset+size/2-x/2,
+       compass->xoffset+hsize-x/2,
        compass->yoffset+size-y-2, compass->layout);
 
 gdk_draw_arc(widget->window,
        compass->gc_h,
        FALSE,
-       compass->xoffset, compass->yoffset+size/2, size, size, 0, 64 * 180);
+       compass->xoffset, compass->yoffset+hsize, size - fs, size - fs, 0, 64 * 360);
 
 /* Simple arrow for heading */
 gdk_draw_line(widget->window,
        compass->gc_h,
-       compass->xoffset + size / 2 + 3,
+       compass->xoffset + hsize + 3,
        compass->yoffset + size - y - 5,
-       compass->xoffset + size / 2, compass->yoffset + size / 2 + 5);
+       compass->xoffset + hsize, compass->yoffset + hsize + 5);
 
 gdk_draw_line(widget->window,
        compass->gc_h,
-       compass->xoffset + size / 2 - 3,
+       compass->xoffset + hsize - 3,
        compass->yoffset + size - y - 5,
-       compass->xoffset + size / 2, compass->yoffset + size / 2 + 5);
+       compass->xoffset + hsize, compass->yoffset + hsize + 5);
 
 gdk_draw_line(widget->window,
        compass->gc_h,
-       compass->xoffset + size / 2 - 3,
+       compass->xoffset + hsize - 3,
        compass->yoffset + size - y - 5,
-       compass->xoffset + size / 2, compass->yoffset + size - y - 8);
+       compass->xoffset + hsize, compass->yoffset + size - y - 8);
 
 gdk_draw_line(widget->window,
        compass->gc_h,
-       compass->xoffset + size / 2 + 3,
+       compass->xoffset + hsize + 3,
        compass->yoffset + size - y - 5,
-       compass->xoffset + size / 2, compass->yoffset + size - y - 8);
+       compass->xoffset + hsize, compass->yoffset + size - y - 8);
 
 for (i = 0; i < 5; i++) {
        PangoMatrix matrix = PANGO_MATRIX_INIT;
@@ -388,8 +392,8 @@ for (i = 0; i < 5; i++) {
        pango_matrix_rotate (&matrix, -(dir-compass->data->heading));
        pango_context_set_matrix (compass->context, &matrix);
        pango_layout_get_pixel_size(compass->layout, &x, &y);
-       x = compass->xoffset + size / 2 + ((size / 2 + 15 + fs) * sinf(tmp)) - x / 2,
-    y = compass->yoffset + size - ((size / 2 + 15 + fs) * cosf(tmp)) - y / 2,
+       x = compass->xoffset + hsize + ((hsize + 15 + fs) * sinf(tmp)) - x / 2,
+    y = compass->yoffset + size - ((hsize + 15 + fs) * cosf(tmp)) - y / 2,
     gdk_draw_layout(widget->window, compass->gc_h, x, y, compass->layout);
 }