Пример #1
0
/**
 * @fn static void gpsd_viewer_osd_draw (OsmGpsMapLayer *osd, OsmGpsMap *map, GdkDrawable *drawable)
 * @brief Overwrite the original _draw handler of the OsmGpsMap layer.
 */
static void gpsd_viewer_osd_draw (OsmGpsMapLayer *osd, OsmGpsMap *map, GdkDrawable *drawable)
{
    cairo_t *cr;
    GpsdViewerOsd *self;
    GpsdViewerOsdPrivate *priv;
    GtkAllocation allocation;

    g_return_if_fail(IS_GPSD_VIEWER_OSD(osd));

    self = GPSD_VIEWER_OSD(osd);
    priv = self->priv;

    gtk_widget_get_allocation(GTK_WIDGET(map), &allocation);
    cr = gdk_cairo_create(drawable);

    drone_draw(self, &allocation, cr);

    if (priv->show_scale)
        scale_draw(self, &allocation, cr);
    if (priv->show_coordinates)
        coordinates_draw(self, &allocation, cr);
    if (priv->show_zoom || priv->show_dpad)
        controls_draw(self, &allocation, cr);

    cairo_destroy(cr);
}
Пример #2
0
static void
osm_gps_map_osd_draw (OsmGpsMapLayer *osd,
                      OsmGpsMap *map,
                      cairo_t *cr)
{
    OsmGpsMapOsd *self;
    OsmGpsMapOsdPrivate *priv;
    GtkAllocation *allocation;

    g_return_if_fail(OSM_IS_GPS_MAP_OSD(osd));

    self = OSM_GPS_MAP_OSD(osd);
    priv = self->priv;
    allocation = &(GTK_WIDGET(map)->allocation);

    if (priv->show_scale)
        scale_draw(self, allocation, cr);
    if (priv->show_coordinates)
        coordinates_draw(self, allocation, cr);
    if (priv->show_crosshair)
        crosshair_draw(self, allocation, cr);
    if (priv->show_zoom || priv->show_dpad)
        controls_draw(self, allocation, cr);
}