Diff of /trunk/src/osm-gps-map-osd-classic.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 121 by harbaum, Sun Sep 20 19:26:29 2009 UTC revision 122 by harbaum, Mon Sep 21 13:15:25 2009 UTC
# Line 25  Line 25 
25  /* OSD_DIAMETER */  /* OSD_DIAMETER */
26  /* OSD_X, OSD_Y */  /* OSD_X, OSD_Y */
27    
28    #define OSD_NAV
29    
30  #ifndef USE_CAIRO  #ifndef USE_CAIRO
31  #error "OSD control display lacks a non-cairo implementation!"  #error "OSD control display lacks a non-cairo implementation!"
32  #endif  #endif
# Line 76  typedef struct { Line 78  typedef struct {
78      } crosshair;      } crosshair;
79  #endif  #endif
80    
81    #ifdef OSD_NAV
82        struct {
83            cairo_surface_t *surface;
84        } nav;
85    #endif
86    
87  #ifdef OSD_COORDINATES  #ifdef OSD_COORDINATES
88      struct {      struct {
89          cairo_surface_t *surface;          cairo_surface_t *surface;
# Line 1191  osd_render_coordinates(osm_gps_map_osd_t Line 1199  osd_render_coordinates(osm_gps_map_osd_t
1199  }  }
1200  #endif  // OSD_COORDINATES  #endif  // OSD_COORDINATES
1201    
1202    #ifdef OSD_NAV
1203    #define OSD_NAV_W  (100)
1204    #define OSD_NAV_H  (100)
1205    
1206    static void
1207    osd_render_nav(osm_gps_map_osd_t *osd)
1208    {
1209        osd_priv_t *priv = (osd_priv_t*)osd->priv;
1210    
1211        /* first fill with transparency */
1212        cairo_t *cr = cairo_create(priv->nav.surface);
1213        cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
1214        cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.2);
1215        cairo_paint(cr);
1216        cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
1217    
1218        cairo_destroy(cr);
1219    }
1220    
1221    #endif // OSD_NAV
1222    
1223    
1224  #ifdef OSD_CROSSHAIR  #ifdef OSD_CROSSHAIR
1225    
1226  #ifndef OSD_CROSSHAIR_RADIUS  #ifndef OSD_CROSSHAIR_RADIUS
# Line 1518  osd_render(osm_gps_map_osd_t *osd) Line 1548  osd_render(osm_gps_map_osd_t *osd)
1548      osd_render_crosshair(osd);      osd_render_crosshair(osd);
1549  #endif  #endif
1550    
1551    #ifdef OSD_NAV
1552        osd_render_nav(osd);
1553    #endif
1554    
1555  #ifdef OSD_COORDINATES  #ifdef OSD_COORDINATES
1556      osd_render_coordinates(osd);      osd_render_coordinates(osd);
1557  #endif  #endif
# Line 1562  osd_draw(osm_gps_map_osd_t *osd, GdkDraw Line 1596  osd_draw(osm_gps_map_osd_t *osd, GdkDraw
1596          priv->crosshair.rendered = FALSE;          priv->crosshair.rendered = FALSE;
1597  #endif  #endif
1598    
1599    #ifdef OSD_NAV
1600            priv->nav.surface =
1601                cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
1602                                           OSD_NAV_W, OSD_NAV_H);
1603    #endif
1604    
1605  #ifdef OSD_COORDINATES  #ifdef OSD_COORDINATES
1606          priv->coordinates.surface =          priv->coordinates.surface =
1607              cairo_image_surface_create(CAIRO_FORMAT_ARGB32,              cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
# Line 1597  osd_draw(osm_gps_map_osd_t *osd, GdkDraw Line 1637  osd_draw(osm_gps_map_osd_t *osd, GdkDraw
1637      cairo_paint(cr);      cairo_paint(cr);
1638  #endif  #endif
1639    
1640    #ifdef OSD_NAV
1641        x =  OSD_X;
1642        if(x < 0) x += osd->widget->allocation.width - OSD_NAV_W;
1643        y = (osd->widget->allocation.height - OSD_NAV_H)/2;
1644    
1645        cairo_set_source_surface(cr, priv->nav.surface, x, y);
1646        cairo_paint(cr);
1647    #endif
1648    
1649  #ifdef OSD_COORDINATES  #ifdef OSD_COORDINATES
1650      x = -OSD_X;      x = -OSD_X;
1651      y = -OSD_Y;      y = -OSD_Y;
# Line 1688  osd_free(osm_gps_map_osd_t *osd) Line 1737  osd_free(osm_gps_map_osd_t *osd)
1737           cairo_surface_destroy(priv->crosshair.surface);           cairo_surface_destroy(priv->crosshair.surface);
1738  #endif  #endif
1739    
1740    #ifdef OSD_NAV
1741        if (priv->nav.surface)
1742             cairo_surface_destroy(priv->nav.surface);
1743    #endif
1744    
1745  #ifdef OSD_COORDINATES  #ifdef OSD_COORDINATES
1746      if (priv->coordinates.surface)      if (priv->coordinates.surface)
1747           cairo_surface_destroy(priv->coordinates.surface);           cairo_surface_destroy(priv->coordinates.surface);

Legend:
Removed from v.121  
changed lines
  Added in v.122