]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikviewport.c
Fix to return the correct hash table pointer.
[andy/viking.git] / src / vikviewport.c
index eaff83a9a47005bda9bf7a3c1a0af9463a8dddf6..d8676db7519da4322cc4a38ab4f0454781680472 100644 (file)
@@ -85,10 +85,6 @@ struct _VikViewport {
   guint centers_max;      // configurable maximum size of the history list
   guint centers_radius;   // Metres
 
-  GdkPixbuf *alpha_pixbuf;
-  guint8 alpha_pixbuf_width;
-  guint8 alpha_pixbuf_height;
-
   gdouble utm_zone_width;
   gboolean one_utm_zone;
 
@@ -210,8 +206,6 @@ vik_viewport_init ( VikViewport *vvp )
   vvp->center.utm_zone = (int)utm.zone;
   vvp->center.utm_letter = utm.letter;
   vvp->scr_buffer = NULL;
-  vvp->alpha_pixbuf = NULL;
-  vvp->alpha_pixbuf_width = vvp->alpha_pixbuf_height = 0;
   vvp->utm_zone_width = 0.0;
   vvp->background_gc = NULL;
   vvp->highlight_gc = NULL;
@@ -433,9 +427,6 @@ static void viewport_finalize ( GObject *gob )
   if ( vvp->snapshot_buffer )
     g_object_unref ( G_OBJECT ( vvp->snapshot_buffer ) );
 
-  if ( vvp->alpha_pixbuf )
-    g_object_unref ( G_OBJECT ( vvp->alpha_pixbuf ) );
-
   if ( vvp->background_gc )
     g_object_unref ( G_OBJECT ( vvp->background_gc ) );
 
@@ -492,8 +483,8 @@ void vik_viewport_draw_scale ( VikViewport *vvp )
     PangoLayout *pl;
     gchar s[128];
 
-    vik_viewport_screen_to_coord ( vvp, 0, vvp->height, &left );
-    vik_viewport_screen_to_coord ( vvp, vvp->width/SCSIZE, vvp->height, &right );
+    vik_viewport_screen_to_coord ( vvp, 0, vvp->height/2, &left );
+    vik_viewport_screen_to_coord ( vvp, vvp->width/SCSIZE, vvp->height/2, &right );
 
     vik_units_distance_t dist_units = a_vik_get_units_distance ();
     switch (dist_units) {
@@ -547,9 +538,9 @@ void vik_viewport_draw_scale ( VikViewport *vvp )
       int i;
       for (i=1; i<5; i++) {
         vik_viewport_draw_line(vvp, vvp->scale_bg_gc, 
-                            PAD+i*len/5, vvp->height-PAD, PAD+i*len/5, vvp->height-PAD-((i==5)?(2*HEIGHT/3):(HEIGHT/2)));
+                               PAD+i*len/5, vvp->height-PAD, PAD+i*len/5, vvp->height-PAD-(HEIGHT/2));
         vik_viewport_draw_line(vvp, gtk_widget_get_style(GTK_WIDGET(&vvp->drawing_area))->black_gc,
-                            PAD+i*len/5, vvp->height-PAD, PAD+i*len/5, vvp->height-PAD-((i==5)?(2*HEIGHT/3):(HEIGHT/2)));
+                               PAD+i*len/5, vvp->height-PAD, PAD+i*len/5, vvp->height-PAD-(HEIGHT/2));
       }
     } else {
       int i;
@@ -1329,44 +1320,6 @@ void vik_viewport_draw_string ( VikViewport *vvp, GdkFont *font, GdkGC *gc, gint
     gdk_draw_string ( vvp->scr_buffer, font, gc, x1, y1, string );
 }
 
-/* shouldn't use this -- slow -- change the alpha channel instead. */
-void vik_viewport_draw_pixbuf_with_alpha ( VikViewport *vvp, GdkPixbuf *pixbuf, gint alpha,
-                                           gint src_x, gint src_y, gint dest_x, gint dest_y, gint w, gint h )
-{
-  gint real_dest_x = MAX(dest_x,0);
-  gint real_dest_y = MAX(dest_y,0);
-
-  if ( alpha == 0 )
-    return; /* don't waste your time */
-
-  if ( w > vvp->alpha_pixbuf_width || h > vvp->alpha_pixbuf_height )
-  {
-    if ( vvp->alpha_pixbuf )
-      g_object_unref ( G_OBJECT ( vvp->alpha_pixbuf ) );
-    vvp->alpha_pixbuf_width = MAX(w,vvp->alpha_pixbuf_width);
-    vvp->alpha_pixbuf_height = MAX(h,vvp->alpha_pixbuf_height);
-    vvp->alpha_pixbuf = gdk_pixbuf_new ( GDK_COLORSPACE_RGB, FALSE, 8, vvp->alpha_pixbuf_width, vvp->alpha_pixbuf_height );
-  }
-
-  w = MIN(w,vvp->width - dest_x);
-  h = MIN(h,vvp->height - dest_y);
-
-  /* check that we are drawing within boundaries. */
-  src_x += (real_dest_x - dest_x);
-  src_y += (real_dest_y - dest_y);
-  w -= (real_dest_x - dest_x);
-  h -= (real_dest_y - dest_y);
-
-  gdk_pixbuf_get_from_drawable ( vvp->alpha_pixbuf, vvp->scr_buffer, NULL,
-                                 real_dest_x, real_dest_y, 0, 0, w, h );
-
-  /* do a composite */
-  gdk_pixbuf_composite ( pixbuf, vvp->alpha_pixbuf, 0, 0, w, h, -src_x, -src_y, 1, 1, 0, alpha );
-
-  /* draw pixbuf_tmp */
-  vik_viewport_draw_pixbuf ( vvp, vvp->alpha_pixbuf, 0, 0, real_dest_x, real_dest_y, w, h );
-}
-
 void vik_viewport_draw_pixbuf ( VikViewport *vvp, GdkPixbuf *pixbuf, gint src_x, gint src_y,
                               gint dest_x, gint dest_y, gint w, gint h )
 {
@@ -1411,7 +1364,6 @@ static gboolean calcxy_rev(double *lg, double *lt, gint x, gint y, double zero_l
   px = (mapSizeX2 - x) * pixelfact_x;
   py = (-mapSizeY2 + y) * pixelfact_y;
 
-  lat = zero_lat - py / Ra;
   lat = zero_lat - py / Ra;
   lon =
     zero_long -