[cairo] roadster install problem

G Blair gblair at sympatico.ca
Mon May 9 11:32:45 PDT 2005


Thanks to Carl and others on this list, we have cairo installed.

Roadster had a problem with a GPSD nested structure related to latitude, longitude and speed.  That was easy to find and fix.

File map_draw_cairo.c calls cairo_create without any parameters.

Any suggestions as to how the parameters for the cairo_create function call should be set up in the following code?

Greg

===============================================
file map_draw_cairo.c, function map_draw_cairo:
===============================================

void map_draw_cairo(map_t* pMap, rendermetrics_t* pRenderMetrics, GdkPixmap* pPixmap, gint nDrawFlags)
{
	// 1. Set draw target to X Drawable
	Display* dpy;
	Drawable drawable;
	dpy = gdk_x11_drawable_get_xdisplay(pPixmap);
	drawable = gdk_x11_drawable_get_xid(pPixmap);

	cairo_t* pCairo = cairo_create ();
	cairo_set_target_drawable(pCairo, dpy, drawable);

	// 2. Rendering
	TIMER_BEGIN(maptimer, "BEGIN RENDER MAP (cairo)");
	cairo_save(pCairo);

	// 2.1. Settings for all rendering
	cairo_set_fill_rule(pCairo, CAIRO_FILL_RULE_WINDING);

	// 2.2. Draw Background
	if(nDrawFlags & DRAWFLAG_GEOMETRY) {
		map_draw_cairo_background(pMap, pCairo);
	}

	// 2.3. Render Layers
	gint i;
	for(i=0 ; i<NUM_ELEMS(layerdraworder) ; i++) {
		gint nLayer = layerdraworder[i].nLayer;
		gint nSubLayer = layerdraworder[i].nSubLayer;
		gint nRenderType = layerdraworder[i].eSubLayerRenderType;

		if(nRenderType == SUBLAYER_RENDERTYPE_LINES) {
			if(nDrawFlags & DRAWFLAG_GEOMETRY) {
				map_draw_cairo_layer_roads(pMap, pCairo,
						pRenderMetrics,
				/* geometry */ 	pMap->m_apLayerData[nLayer]->m_pRoadsArray,
				/* style */ 	&(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
						&(g_aLayers[nLayer]->m_TextLabelStyle));
			}
		}
		else if(nRenderType == SUBLAYER_RENDERTYPE_POLYGONS) {
			if(nDrawFlags & DRAWFLAG_GEOMETRY) {
				map_draw_cairo_layer_polygons(pMap, pCairo,
						pRenderMetrics,
				/* geometry */ 	pMap->m_apLayerData[nLayer]->m_pRoadsArray,
				/* style */ 	&(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
						&(g_aLayers[nLayer]->m_TextLabelStyle));
			}
		}
		else if(nRenderType == SUBLAYER_RENDERTYPE_LINE_LABELS) {
			if(nDrawFlags & DRAWFLAG_LABELS) {
				map_draw_cairo_layer_road_labels(pMap, pCairo,
						pRenderMetrics,
				/* geometry */  pMap->m_apLayerData[nLayer]->m_pRoadsArray,
				/* style */     &(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
						&(g_aLayers[nLayer]->m_TextLabelStyle));
			}
		}
		else if(nRenderType == SUBLAYER_RENDERTYPE_POLYGON_LABELS) {
			if(nDrawFlags & DRAWFLAG_LABELS) {
				map_draw_cairo_layer_polygon_labels(pMap, pCairo,
						pRenderMetrics,
				/* geometry */  pMap->m_apLayerData[nLayer]->m_pRoadsArray,
				/* style */     &(g_aLayers[nLayer]->m_Style.m_aSubLayers[nSubLayer]),
						&(g_aLayers[nLayer]->m_TextLabelStyle));
			}
		}
	}

//	map_draw_cairo_locations(pMap, pCairo, pRenderMetrics);
	map_draw_cairo_locationselection(pMap, pCairo, pRenderMetrics, pMap->m_pLocationSelectionArray);

	// 4. Cleanup
	cairo_restore(pCairo);
	TIMER_END(maptimer, "END RENDER MAP (cairo)");
}





More information about the cairo mailing list