/[zanavi_public1]/navit/navit/graphics.c
ZANavi

Diff of /navit/navit/graphics.c

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

Revision 29 Revision 30
72// 72//
73#include "attr.h" 73#include "attr.h"
74#include "navit.h" 74#include "navit.h"
75#include "route.h" 75#include "route.h"
76 76
77#ifdef HAVE_API_ANDROID
78// nothing todo for android
79#else
80// linux seems to need this explicitly
81#include "pthread.h"
82#endif
83
84
85static pthread_cond_t uiConditionVariable = PTHREAD_COND_INITIALIZER;
86static pthread_mutex_t uiConditionMutex = PTHREAD_MUTEX_INITIALIZER;
87
77//############################################################################################################## 88//##############################################################################################################
78//# Description: 89//# Description:
79//# Comment: 90//# Comment:
80//# Authors: Martin Schaller (04/2008) 91//# Authors: Martin Schaller (04/2008)
81//############################################################################################################## 92//##############################################################################################################
104 int gamma, brightness, contrast; 115 int gamma, brightness, contrast;
105 int colormgmt; 116 int colormgmt;
106 int font_size; 117 int font_size;
107 GList *selection; 118 GList *selection;
108}; 119};
109
110 120
111/* 121/*
112 struct display_context 122 struct display_context
113 { 123 {
114 struct graphics *gra; 124 struct graphics *gra;
258} 268}
259 269
260int graphics_set_attr(struct graphics *gra, struct attr *attr) 270int graphics_set_attr(struct graphics *gra, struct attr *attr)
261{ 271{
262 int ret = 1; 272 int ret = 1;
263 // //DBG dbg(0,"enter\n"); 273 // //DBG // dbg(0,"enter\n");
264 if (gra->meth.set_attr) 274 if (gra->meth.set_attr)
265 ret = gra->meth.set_attr(gra->priv, attr); 275 ret = gra->meth.set_attr(gra->priv, attr);
266 if (!ret) 276 if (!ret)
267 ret = graphics_set_attr_do(gra, attr); 277 ret = graphics_set_attr_do(gra, attr);
268 return ret != 0; 278 return ret != 0;
280 * @returns <> 290 * @returns <>
281 * @author Martin Schaller (04/2008) 291 * @author Martin Schaller (04/2008)
282 */ 292 */
283struct graphics * graphics_new(struct attr *parent, struct attr **attrs) 293struct graphics * graphics_new(struct attr *parent, struct attr **attrs)
284{ 294{
295 // dbg(0, "EEnter\n");
296
297 int count = 0;
285 struct graphics *this_; 298 struct graphics *this_;
286 struct attr *type_attr; 299 struct attr *type_attr;
287 struct graphics_priv * (*graphicstype_new)(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl); 300 struct graphics_priv * (*graphicstype_new)(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl);
288 301
289 if (!(type_attr = attr_search(attrs, NULL, attr_type))) 302 if (!(type_attr = attr_search(attrs, NULL, attr_type)))
290 { 303 {
291 return NULL; 304 return NULL;
292 } 305 }
293 306
307 // dbg(0, "plugins\n");
308
294 graphicstype_new = plugin_get_graphics_type(type_attr->u.str); 309 graphicstype_new = plugin_get_graphics_type(type_attr->u.str);
295 if (!graphicstype_new) 310 if (!graphicstype_new)
296 { 311 {
297 return NULL; 312 return NULL;
298 } 313 }
299 314
315 // dbg(0, "g 003\n");
316
300 this_=g_new0(struct graphics, 1); 317 this_=g_new0(struct graphics, 1);
301 this_->cbl = callback_list_new(); 318 this_->cbl = callback_list_new();
319 // dbg(0, "g 003.1\n");
302 this_->priv = (*graphicstype_new)(parent->u.navit, &this_->meth, attrs, this_->cbl); 320 this_->priv = (*graphicstype_new)(parent->u.navit, &this_->meth, attrs, this_->cbl);
321 // dbg(0, "g 003.2\n");
303 this_->attrs = attr_list_dup(attrs); 322 this_->attrs = attr_list_dup(attrs);
304 this_->brightness = 0; 323 this_->brightness = 0;
305 this_->contrast = 65536; 324 this_->contrast = 65536;
306 this_->gamma = 65536; 325 this_->gamma = 65536;
307 this_->font_size = 20; 326 this_->font_size = 20;
308 327
328 // dbg(0, "g 004\n");
329
309 while (*attrs) 330 while (*attrs)
310 { 331 {
332 count++;
333 // dbg(0, "g 005 attr %d\n", count);
311 graphics_set_attr_do(this_, *attrs); 334 graphics_set_attr_do(this_, *attrs);
312 attrs++; 335 attrs++;
336 // dbg(0, "g 006 attr\n");
313 } 337 }
314 338
339 // dbg(0, "return\n");
315 return this_; 340 return this_;
316} 341}
317 342
318/** 343/**
319 * FIXME 344 * FIXME
330 * FIXME 355 * FIXME
331 * @param <> 356 * @param <>
332 * @returns <> 357 * @returns <>
333 * @author Martin Schaller (04/2008) 358 * @author Martin Schaller (04/2008)
334 */ 359 */
335struct graphics * graphics_overlay_new(struct graphics *parent, struct point *p, int w, int h, int alpha, int wraparound) 360struct graphics * graphics_overlay_new(const char* name, struct graphics *parent, struct point *p, int w, int h, int alpha, int wraparound)
336{ 361{
337 struct graphics *this_; 362 struct graphics *this_;
338 struct point_rect pr; 363 struct point_rect pr;
339 if (!parent->meth.overlay_new) 364 if (!parent->meth.overlay_new)
340 return NULL;this_=g_new0(struct graphics, 1); 365 return NULL;this_=g_new0(struct graphics, 1);
341 this_->priv = parent->meth.overlay_new(parent->priv, &this_->meth, p, w, h, alpha, wraparound); 366 this_->priv = parent->meth.overlay_new(name, parent->priv, &this_->meth, p, w, h, alpha, wraparound);
342 pr.lu.x = 0; 367 pr.lu.x = 0;
343 pr.lu.y = 0; 368 pr.lu.y = 0;
344 pr.rl.x = w; 369 pr.rl.x = w;
345 pr.rl.y = h; 370 pr.rl.y = h;
346 this_->font_size = 20; 371 this_->font_size = 20;
373 this_->meth.overlay_resize(this_->priv, p, w, h, alpha, wraparound); 398 this_->meth.overlay_resize(this_->priv, p, w, h, alpha, wraparound);
374} 399}
375 400
376static void graphics_gc_init(struct graphics *this_) 401static void graphics_gc_init(struct graphics *this_)
377{ 402{
378 struct color background = 403 // dbg(0, "EEnter\n");
379 { COLOR_BACKGROUND_ }; 404
380 struct color black = 405 struct color background = { COLOR_BACKGROUND_ };
381 { COLOR_BLACK_ }; 406 struct color black = { COLOR_BLACK_ };
382 struct color white = 407 struct color white = { COLOR_WHITE_ };
383 { COLOR_WHITE_ };
384 if (!this_->gc[0] || !this_->gc[1] || !this_->gc[2]) 408 if (!this_->gc[0] || !this_->gc[1] || !this_->gc[2])
385 return; 409 return;
386 graphics_gc_set_background(this_->gc[0], &background); 410 graphics_gc_set_background(this_->gc[0], &background);
387 graphics_gc_set_foreground(this_->gc[0], &background); 411 graphics_gc_set_foreground(this_->gc[0], &background);
388 graphics_gc_set_background(this_->gc[1], &black); 412 graphics_gc_set_background(this_->gc[1], &black);
389 graphics_gc_set_foreground(this_->gc[1], &white); 413 graphics_gc_set_foreground(this_->gc[1], &white);
390 graphics_gc_set_background(this_->gc[2], &white); 414 graphics_gc_set_background(this_->gc[2], &white);
391 graphics_gc_set_foreground(this_->gc[2], &black); 415 graphics_gc_set_foreground(this_->gc[2], &black);
416
417 // dbg(0, "return\n");
392} 418}
393 419
394/** 420/**
395 * FIXME 421 * FIXME
396 * @param <> 422 * @param <>
704 * @returns <> 730 * @returns <>
705 * @author Martin Schaller (04/2008) 731 * @author Martin Schaller (04/2008)
706 */ 732 */
707void graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h) 733void graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h)
708{ 734{
709 ////DBG dbg(0,"ooo enter ooo\n"); 735 ////DBG // dbg(0,"ooo enter ooo\n");
710 736
711 this_->meth.draw_restore(this_->priv, p, w, h); 737 this_->meth.draw_restore(this_->priv, p, w, h);
712} 738}
713 739
714/** 740/**
717 * @returns <> 743 * @returns <>
718 * @author Martin Schaller (04/2008) 744 * @author Martin Schaller (04/2008)
719 */ 745 */
720void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode) 746void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode)
721{ 747{
722 ////DBG dbg(0,"ooo enter ooo\n"); 748 ////DBG // dbg(0,"ooo enter ooo\n");
723 749
724 this_->meth.draw_mode(this_->priv, mode); 750 this_->meth.draw_mode(this_->priv, mode);
725} 751}
726 752
727/** 753/**
746 * @returns <> 772 * @returns <>
747 * @author Martin Schaller (04/2008) 773 * @author Martin Schaller (04/2008)
748 */ 774 */
749void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int r) 775void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int r)
750{ 776{
751 struct point *pnt = g_alloca(sizeof(struct point) * (r * 4 + 64));
752 int i = 0; 777 int i = 0;
753 778
754 if (this_->meth.draw_circle) 779 if (this_->meth.draw_circle)
780 {
755 this_->meth.draw_circle(this_->priv, gc->priv, p, r); 781 this_->meth.draw_circle(this_->priv, gc->priv, p, r);
782 }
756 else 783 else
757 { 784 {
785 struct point *pnt = g_alloca(sizeof(struct point) * (r * 4 + 64));
758 draw_circle(p, r, 0, -1, 1026, pnt, &i, 1); 786 draw_circle(p, r, 0, -1, 1026, pnt, &i, 1);
759 pnt[i] = pnt[0]; 787 pnt[i] = pnt[0];
760 i++; 788 i++;
761 this_->meth.draw_lines(this_->priv, gc->priv, pnt, i); 789 this_->meth.draw_lines(this_->priv, gc->priv, pnt, i);
762 } 790 }
774} 802}
775 803
776void graphics_draw_rectangle_rounded(struct graphics *this_, struct graphics_gc *gc, struct point *plu, int w, int h, int r, int fill) 804void graphics_draw_rectangle_rounded(struct graphics *this_, struct graphics_gc *gc, struct point *plu, int w, int h, int r, int fill)
777{ 805{
778 struct point *p = g_alloca(sizeof(struct point) * (r * 4 + 32)); 806 struct point *p = g_alloca(sizeof(struct point) * (r * 4 + 32));
779 struct point pi0 = 807 struct point pi0 = { plu->x + r, plu->y + r };
780 { plu->x + r, plu->y + r };
781 struct point pi1 =
782 { plu->x + w - r, plu->y + r }; 808 struct point pi1 = { plu->x + w - r, plu->y + r };
783 struct point pi2 =
784 { plu->x + w - r, plu->y + h - r }; 809 struct point pi2 = { plu->x + w - r, plu->y + h - r };
785 struct point pi3 =
786 { plu->x + r, plu->y + h - r }; 810 struct point pi3 = { plu->x + r, plu->y + h - r };
787 int i = 0; 811 int i = 0;
788 812
789 draw_circle(&pi2, r * 2, 0, -1, 258, p, &i, 1); 813 draw_circle(&pi2, r * 2, 0, -1, 258, p, &i, 1);
790 draw_circle(&pi1, r * 2, 0, 255, 258, p, &i, 1); 814 draw_circle(&pi1, r * 2, 0, 255, 258, p, &i, 1);
791 draw_circle(&pi0, r * 2, 0, 511, 258, p, &i, 1); 815 draw_circle(&pi0, r * 2, 0, 511, 258, p, &i, 1);
851void graphics_draw_bigmap(struct graphics *this_, struct graphics_gc *gc, int yaw, int order, float clat, float clng, int x, int y, int scx, int scy, int px, int py, int valid) 875void graphics_draw_bigmap(struct graphics *this_, struct graphics_gc *gc, int yaw, int order, float clat, float clng, int x, int y, int scx, int scy, int px, int py, int valid)
852{ 876{
853 this_->meth.draw_bigmap(this_->priv, gc->priv, yaw, order, clat, clng, x, y, scx, scy, px, py, valid); 877 this_->meth.draw_bigmap(this_->priv, gc->priv, yaw, order, clat, clng, x, y, scx, scy, px, py, valid);
854} 878}
855 879
856void graphics_send_osd_values(struct graphics *this_, struct graphics_gc *gc, char *id, char *text1, char *text2, char *text3, int i1, int i2, int i3, int i4, float f1, float f2, float f3)
857{
858 this_->meth.send_osd_values(this_->priv, gc->priv, id, text1, text2, text3, i1, i2, i3, i4, f1, f2, f3);
859}
860
861//############################################################################################################## 880//##############################################################################################################
862//# Description: 881//# Description:
863//# Comment: 882//# Comment:
864//# Authors: Martin Schaller (04/2008) 883//# Authors: Martin Schaller (04/2008)
865//############################################################################################################## 884//##############################################################################################################
866int graphics_draw_drag(struct graphics *this_, struct point *p) 885int graphics_draw_drag(struct graphics *this_, struct point *p)
867{ 886{
868 ////DBG dbg(0,"ooo enter ooo\n"); 887 ////DBG // dbg(0,"ooo enter ooo\n");
869 888
870 if (!this_->meth.draw_drag) 889 if (!this_->meth.draw_drag)
871 { 890 {
872 return 0; 891 return 0;
873 } 892 }
874 ////DBG dbg(0,"draw DRAG start ...\n"); 893 ////DBG // dbg(0,"draw DRAG start ...\n");
875 this_->meth.draw_drag(this_->priv, p); 894 this_->meth.draw_drag(this_->priv, p);
876 ////DBG dbg(0,"draw DRAG end ...\n"); 895 ////DBG // dbg(0,"draw DRAG end ...\n");
877 return 1; 896 return 1;
878} 897}
879 898
880void graphics_background_gc(struct graphics *this_, struct graphics_gc *gc) 899void graphics_background_gc(struct graphics *this_, struct graphics_gc *gc)
881{ 900{
882 ////DBG dbg(0,"ooo enter ooo\n"); 901 ////DBG // dbg(0,"ooo enter ooo\n");
883 902
884 this_->meth.background_gc(this_->priv, gc ? gc->priv : NULL); 903 this_->meth.background_gc(this_->priv, gc ? gc->priv : NULL);
885} 904}
886 905
887#include "attr.h" 906#include "attr.h"
988 len++; 1007 len++;
989 } 1008 }
990 } 1009 }
991 } 1010 }
992 p = g_malloc(len); 1011 p = g_malloc(len);
993 // dbg(0,"malloc len:%d\n", len); 1012 // // dbg(0,"malloc len:%d\n", len);
994 1013
995 di = (struct displayitem *) p; 1014 di = (struct displayitem *) p;
996 p += sizeof(*di) + count * sizeof(*c); 1015 p += sizeof(*di) + count * sizeof(*c);
997 di->item = *item; 1016 di->item = *item;
998 if (label && label_count) 1017 if (label && label_count)
1063 dy *= 32; 1082 dy *= 32;
1064 // lsq -> (line length * 32) squared 1083 // lsq -> (line length * 32) squared
1065 lsq = dx * dx + dy * dy; 1084 lsq = dx * dx + dy * dy;
1066 if (lsq > tlsq) 1085 if (lsq > tlsq)
1067 { 1086 {
1068 if (((int)lsq > MIN_LINE_LENGTH_FOR_TEXT_MIDDLE_2) || ( ( (i==0)||(i==(count-2)) && ((int)lsq > (int)MIN_LINE_LENGTH_FOR_TEXT_2) ) )) 1087 if (((int) lsq > MIN_LINE_LENGTH_FOR_TEXT_MIDDLE_2) || (((i == 0) || (i == (count - 2)) && ((int) lsq > (int) MIN_LINE_LENGTH_FOR_TEXT_2))))
1069 { 1088 {
1070 // segments in the middle of the "way" need to be longer for streetname to be drawn 1089 // segments in the middle of the "way" need to be longer for streetname to be drawn
1071 // l -> line length 1090 // l -> line length
1072 l = (int) sqrtf_fast2(lsq); 1091 l = (int) sqrtf_fast2(lsq);
1073 x = p[i].x; 1092 x = p[i].x;
1083 y += (l - tlm) * dy / l / 64; 1102 y += (l - tlm) * dy / l / 64;
1084 x -= dy * thm / l / 64; 1103 x -= dy * thm / l / 64;
1085 y += dx * thm / l / 64; 1104 y += dx * thm / l / 64;
1086 p_t.x = x; 1105 p_t.x = x;
1087 p_t.y = y; 1106 p_t.y = y;
1088 #if 0 1107#if 0
1089 //DBG dbg(0,"display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l); 1108 //DBG // dbg(0,"display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l);
1090 #endif 1109#endif
1091 if (x < gra->r.rl.x && x + tl > gra->r.lu.x && y + tl > gra->r.lu.y && y - tl < gra->r.rl.y) 1110 if (x < gra->r.rl.x && x + tl > gra->r.lu.x && y + tl > gra->r.lu.y && y - tl < gra->r.rl.y)
1092 { 1111 {
1093 gra->meth.draw_text(gra->priv, fg->priv, bg ? bg->priv : NULL, font->priv, label, &p_t, dx * 0x10000 / l, dy * 0x10000 / l); 1112 gra->meth.draw_text(gra->priv, fg->priv, bg ? bg->priv : NULL, font->priv, label, &p_t, dx * 0x10000 / l, dy * 0x10000 / l);
1094 } 1113 }
1095 } 1114 }
1159} 1178}
1160 1179
1161struct circle 1180struct circle
1162{ 1181{
1163 short x, y, fowler; 1182 short x, y, fowler;
1183}
1164} circle64[] = 1184 circle64[] =
1165{ 1185 { { 0, 128, 0 }, { 13, 127, 13 }, { 25, 126, 25 }, { 37, 122, 38 }, { 49, 118, 53 }, { 60, 113, 67 }, { 71, 106, 85 }, { 81, 99, 104 }, { 91, 91, 128 }, { 99, 81, 152 }, { 106, 71, 171 }, { 113, 60, 189 }, { 118, 49, 203 }, { 122, 37, 218 }, { 126, 25, 231 }, { 127, 13, 243 }, { 128, 0, 256 }, { 127, -13, 269 }, { 126, -25, 281 }, { 122, -37, 294 }, { 118, -49, 309 }, { 113, -60, 323 }, { 106, -71, 341 }, { 99, -81, 360 }, { 91, -91, 384 }, { 81, -99, 408 }, { 71, -106, 427 }, { 60, -113, 445 }, { 49, -118, 459 }, { 37, -122, 474 }, { 25, -126, 487 }, { 13, -127, 499 }, { 0, -128, 512 }, { -13, -127, 525 }, { -25, -126, 537 }, { -37, -122, 550 }, { -49, -118, 565 }, { -60, -113, 579 }, { -71, -106, 597 }, { -81, -99, 616 }, { -91, -91, 640 }, { -99, -81, 664 }, { -106, -71, 683 }, { -113, -60, 701 }, { -118, -49, 715 }, { -122, -37, 730 }, { -126, -25, 743 }, { -127, -13, 755 }, { -128, 0, 768 }, { -127, 13, 781 }, { -126, 25, 793 }, { -122, 37, 806 }, { -118, 49, 821 }, { -113, 60, 835 }, { -106, 71, 853 }, { -99, 81, 872 }, { -91, 91, 896 }, { -81, 99, 920 }, { -71, 106, 939 }, { -60, 113, 957 }, { -49, 118, 971 }, { -37, 122, 986 }, { -25, 126, 999 }, { -13, 127, 1011 }, };
1166{ 0, 128, 0 },
1167{ 13, 127, 13 },
1168{ 25, 126, 25 },
1169{ 37, 122, 38 },
1170{ 49, 118, 53 },
1171{ 60, 113, 67 },
1172{ 71, 106, 85 },
1173{ 81, 99, 104 },
1174{ 91, 91, 128 },
1175{ 99, 81, 152 },
1176{ 106, 71, 171 },
1177{ 113, 60, 189 },
1178{ 118, 49, 203 },
1179{ 122, 37, 218 },
1180{ 126, 25, 231 },
1181{ 127, 13, 243 },
1182{ 128, 0, 256 },
1183{ 127, -13, 269 },
1184{ 126, -25, 281 },
1185{ 122, -37, 294 },
1186{ 118, -49, 309 },
1187{ 113, -60, 323 },
1188{ 106, -71, 341 },
1189{ 99, -81, 360 },
1190{ 91, -91, 384 },
1191{ 81, -99, 408 },
1192{ 71, -106, 427 },
1193{ 60, -113, 445 },
1194{ 49, -118, 459 },
1195{ 37, -122, 474 },
1196{ 25, -126, 487 },
1197{ 13, -127, 499 },
1198{ 0, -128, 512 },
1199{ -13, -127, 525 },
1200{ -25, -126, 537 },
1201{ -37, -122, 550 },
1202{ -49, -118, 565 },
1203{ -60, -113, 579 },
1204{ -71, -106, 597 },
1205{ -81, -99, 616 },
1206{ -91, -91, 640 },
1207{ -99, -81, 664 },
1208{ -106, -71, 683 },
1209{ -113, -60, 701 },
1210{ -118, -49, 715 },
1211{ -122, -37, 730 },
1212{ -126, -25, 743 },
1213{ -127, -13, 755 },
1214{ -128, 0, 768 },
1215{ -127, 13, 781 },
1216{ -126, 25, 793 },
1217{ -122, 37, 806 },
1218{ -118, 49, 821 },
1219{ -113, 60, 835 },
1220{ -106, 71, 853 },
1221{ -99, 81, 872 },
1222{ -91, 91, 896 },
1223{ -81, 99, 920 },
1224{ -71, 106, 939 },
1225{ -60, 113, 957 },
1226{ -49, 118, 971 },
1227{ -37, 122, 986 },
1228{ -25, 126, 999 },
1229{ -13, 127, 1011 }, };
1230 1186
1231static void draw_circle(struct point *pnt, int diameter, int scale, int start, int len, struct point *res, int *pos, int dir) 1187static void draw_circle(struct point *pnt, int diameter, int scale, int start, int len, struct point *res, int *pos, int dir)
1232{ 1188{
1233 struct circle *c; 1189 struct circle *c;
1234 1190
1235#if 0 1191#if 0
1236 //DBG dbg(0,"diameter=%d start=%d len=%d pos=%d dir=%d\n", diameter, start, len, *pos, dir); 1192 //DBG // dbg(0,"diameter=%d start=%d len=%d pos=%d dir=%d\n", diameter, start, len, *pos, dir);
1237#endif 1193#endif
1238 int count = 64; 1194 int count = 64;
1239 int end = start + len; 1195 int end = start + len;
1240 int i, step; 1196 int i, step;
1241 c = circle64; 1197 c = circle64;
1404 res->ny = -(y + 1) / 2; 1360 res->ny = -(y + 1) / 2;
1405 res->py = y / 2; 1361 res->py = y / 2;
1406 } 1362 }
1407} 1363}
1408 1364
1409
1410// this func. is now obsolete!! and unused!!!! 1365// this func. is now obsolete!! and unused!!!!
1411// this func. is now obsolete!! and unused!!!! 1366// this func. is now obsolete!! and unused!!!!
1412// this func. is now obsolete!! and unused!!!! 1367// this func. is now obsolete!! and unused!!!!
1413static void graphics_draw_polyline_as_polygon(struct graphics *gra, struct graphics_gc *gc, struct point *pnt, int count, int *width, int step, int fill, int order, int oneway) 1368static void graphics_draw_polyline_as_polygon(struct graphics *gra, struct graphics_gc *gc, struct point *pnt, int count, int *width, int step, int fill, int order, int oneway)
1414{ 1369{
1415 int maxpoints = 200; 1370 int maxpoints = 200;
1416 struct point *res = g_alloca(sizeof(struct point) * maxpoints); 1371 struct point *res = g_alloca(sizeof(struct point) * maxpoints);
1417 struct point pos, poso, neg, nego; 1372 struct point pos, poso, neg, nego;
1418 int i, dx = 0, dy = 0, l = 0, dxo = 0, dyo = 0; 1373 int i, dx = 0, dy = 0, l = 0, dxo = 0, dyo = 0;
1419 struct offset o, oo = 1374 struct offset o, oo = { 0, 0, 0, 0 };
1420 { 0, 0, 0, 0 };
1421 int fow = 0, fowo = 0, delta; 1375 int fow = 0, fowo = 0, delta;
1422 int wi, ppos = maxpoints / 2, npos = maxpoints / 2; 1376 int wi, ppos = maxpoints / 2, npos = maxpoints / 2;
1423 int state, prec = 5; 1377 int state, prec = 5;
1424 int max_circle_points = 20; 1378 int max_circle_points = 20;
1425 int lscale = 16; 1379 int lscale = 16;
1577// this func. is now obsolete!! and unused!!!! 1531// this func. is now obsolete!! and unused!!!!
1578// this func. is now obsolete!! and unused!!!! 1532// this func. is now obsolete!! and unused!!!!
1579// this func. is now obsolete!! and unused!!!! 1533// this func. is now obsolete!! and unused!!!!
1580 1534
1581 1535
1582
1583struct wpoint 1536struct wpoint
1584{ 1537{
1585 int x, y, w; 1538 int x, y, w;
1586}; 1539};
1587 1540
1603#define DO_INTERSECT 1 1556#define DO_INTERSECT 1
1604#define COLLINEAR 2 1557#define COLLINEAR 2
1605#define SAME_SIGNS( a, b ) \ 1558#define SAME_SIGNS( a, b ) \
1606 (((long) ((unsigned long) a ^ (unsigned long) b)) >= 0 ) 1559 (((long) ((unsigned long) a ^ (unsigned long) b)) >= 0 )
1607 1560
1608static int lines_intersect(int x1, int y1, /* First line segment */ 1561static int lines_intersect(int x1, int y1, /* First line segment */
1609 int x2, int y2, 1562int x2, int y2,
1610 1563
1611 int x3, int y3, /* Second line segment */ 1564int x3, int y3, /* Second line segment */
1612 int x4, int y4, 1565int x4, int y4,
1613 1566
1614 int *x, 1567int *x, int *y /* Output value:
1615 int *y /* Output value:
1616 * point of intersection */ 1568 * point of intersection */
1617 ) 1569)
1618{ 1570{
1619 int a1, a2, b1, b2, c1, c2; /* Coefficients of line eqns. */ 1571 int a1, a2, b1, b2, c1, c2; /* Coefficients of line eqns. */
1620 int r1, r2, r3, r4; /* 'Sign' values */ 1572 int r1, r2, r3, r4; /* 'Sign' values */
1621 int denom, offset, num; /* Intermediate values */ 1573 int denom, offset, num; /* Intermediate values */
1622 1574
1623 /* Compute a1, b1, c1, where line joining points 1 and 2 1575 /* Compute a1, b1, c1, where line joining points 1 and 2
1624 * is "a1 x + b1 y + c1 = 0". 1576 * is "a1 x + b1 y + c1 = 0".
1625 */ 1577 */
1626 1578
1627 a1 = y2 - y1; 1579 a1 = y2 - y1;
1628 b1 = x1 - x2; 1580 b1 = x1 - x2;
1629 c1 = x2 * y1 - x1 * y2; 1581 c1 = x2 * y1 - x1 * y2;
1630 1582
1631 /* Compute r3 and r4. 1583 /* Compute r3 and r4.
1632 */ 1584 */
1633 r3 = a1 * x3 + b1 * y3 + c1; 1585 r3 = a1 * x3 + b1 * y3 + c1;
1634 r4 = a1 * x4 + b1 * y4 + c1; 1586 r4 = a1 * x4 + b1 * y4 + c1;
1635 1587
1636 /* Check signs of r3 and r4. If both point 3 and point 4 lie on 1588 /* Check signs of r3 and r4. If both point 3 and point 4 lie on
1637 * same side of line 1, the line segments do not intersect. 1589 * same side of line 1, the line segments do not intersect.
1638 */ 1590 */
1639 if ( r3 != 0 && 1591 if (r3 != 0 && r4 != 0 && SAME_SIGNS( r3, r4 ))
1640 r4 != 0 &&
1641 SAME_SIGNS( r3, r4 ))
1642 { 1592 {
1643 return ( DONT_INTERSECT ); 1593 return (DONT_INTERSECT);
1644 } 1594 }
1645 1595
1646 /* Compute a2, b2, c2 */ 1596 /* Compute a2, b2, c2 */
1647 a2 = y4 - y3; 1597 a2 = y4 - y3;
1648 b2 = x3 - x4; 1598 b2 = x3 - x4;
1649 c2 = x4 * y3 - x3 * y4; 1599 c2 = x4 * y3 - x3 * y4;
1650 1600
1651 /* Compute r1 and r2 */ 1601 /* Compute r1 and r2 */
1652 r1 = a2 * x1 + b2 * y1 + c2; 1602 r1 = a2 * x1 + b2 * y1 + c2;
1653 r2 = a2 * x2 + b2 * y2 + c2; 1603 r2 = a2 * x2 + b2 * y2 + c2;
1654 1604
1655 /* Check signs of r1 and r2. If both point 1 and point 2 lie 1605 /* Check signs of r1 and r2. If both point 1 and point 2 lie
1656 * on same side of second line segment, the line segments do 1606 * on same side of second line segment, the line segments do
1657 * not intersect. 1607 * not intersect.
1658 */ 1608 */
1659 if ( r1 != 0 && 1609 if (r1 != 0 && r2 != 0 && SAME_SIGNS( r1, r2 ))
1660 r2 != 0 &&
1661 SAME_SIGNS( r1, r2 ))
1662 { 1610 {
1663 return ( DONT_INTERSECT ); 1611 return (DONT_INTERSECT);
1664 } 1612 }
1665 1613
1666 /* Line segments intersect: compute intersection point. 1614 /* Line segments intersect: compute intersection point.
1667 */ 1615 */
1668 1616
1669 denom = a1 * b2 - a2 * b1; 1617 denom = a1 * b2 - a2 * b1;
1670 if ( denom == 0 ) 1618 if (denom == 0)
1671 { 1619 {
1672 return ( COLLINEAR ); 1620 return (COLLINEAR);
1673 } 1621 }
1674 offset = denom < 0 ? - denom / 2 : denom / 2; 1622 offset = denom < 0 ? -denom / 2 : denom / 2;
1675 1623
1676 /* The denom/2 is to get rounding instead of truncating. It 1624 /* The denom/2 is to get rounding instead of truncating. It
1677 * is added or subtracted to the numerator, depending upon the 1625 * is added or subtracted to the numerator, depending upon the
1678 * sign of the numerator. 1626 * sign of the numerator.
1679 */ 1627 */
1680 /* 1628 /*
1681 num = b1 * c2 - b2 * c1; 1629 num = b1 * c2 - b2 * c1;
1682 *x = ( num < 0 ? num - offset : num + offset ) / denom; 1630 *x = ( num < 0 ? num - offset : num + offset ) / denom;
1683 num = a2 * c1 - a1 * c2; 1631 num = a2 * c1 - a1 * c2;
1684 *y = ( num < 0 ? num - offset : num + offset ) / denom; 1632 *y = ( num < 0 ? num - offset : num + offset ) / denom;
1685 */ 1633 */
1686 1634
1687 return ( DO_INTERSECT ); 1635 return (DO_INTERSECT);
1688} /* lines_intersect */ 1636} /* lines_intersect */
1689
1690 1637
1691static int clip_line_aprox(struct wpoint *p1, struct wpoint *p2, struct point_rect *r) 1638static int clip_line_aprox(struct wpoint *p1, struct wpoint *p2, struct point_rect *r)
1692{ 1639{
1693 int code1, code2; 1640 int code1, code2;
1694 code1 = clipcode(p1, r); 1641 code1 = clipcode(p1, r);
1696 if (code1 & code2) 1643 if (code1 & code2)
1697 { 1644 {
1698 // line completely invisible! 1645 // line completely invisible!
1699 return 0; 1646 return 0;
1700 } 1647 }
1701 else if ((code1 == 0)&&(code2 == 0)) 1648 else if ((code1 == 0) && (code2 == 0))
1702 { 1649 {
1703 // line completely visible! 1650 // line completely visible!
1704 return 1; 1651 return 1;
1705 } 1652 }
1706 else if ((code1 == 0)||(code2 == 0)) 1653 else if ((code1 == 0) || (code2 == 0))
1707 { 1654 {
1708 // at least 1 point of line is visible 1655 // at least 1 point of line is visible
1709 return 2; 1656 return 2;
1710 } 1657 }
1711 else 1658 else
1712 { 1659 {
1713 int xx; 1660 int xx;
1714 int yy; 1661 int yy;
1715 // top 1662 // top
1716 int ret_ = lines_intersect(p1->x,p1->y,p2->x,p2->y,r->lu.x,r->lu.y,r->rl.x,r->lu.y,&xx,&yy); 1663 int ret_ = lines_intersect(p1->x, p1->y, p2->x, p2->y, r->lu.x, r->lu.y, r->rl.x, r->lu.y, &xx, &yy);
1717 if (ret_ == DO_INTERSECT) 1664 if (ret_ == DO_INTERSECT)
1718 { 1665 {
1719 return 3; 1666 return 3;
1720 } 1667 }
1721 // bottom 1668 // bottom
1722 ret_ = lines_intersect(p1->x,p1->y,p2->x,p2->y,r->lu.x,r->rl.y,r->rl.x,r->rl.y,&xx,&yy); 1669 ret_ = lines_intersect(p1->x, p1->y, p2->x, p2->y, r->lu.x, r->rl.y, r->rl.x, r->rl.y, &xx, &yy);
1723 if (ret_ == DO_INTERSECT) 1670 if (ret_ == DO_INTERSECT)
1724 { 1671 {
1725 return 3; 1672 return 3;
1726 } 1673 }
1727 // left 1674 // left
1728 ret_ = lines_intersect(p1->x,p1->y,p2->x,p2->y,r->lu.x,r->lu.y,r->lu.x,r->rl.y,&xx,&yy); 1675 ret_ = lines_intersect(p1->x, p1->y, p2->x, p2->y, r->lu.x, r->lu.y, r->lu.x, r->rl.y, &xx, &yy);
1729 if (ret_ == DO_INTERSECT) 1676 if (ret_ == DO_INTERSECT)
1730 { 1677 {
1731 return 3; 1678 return 3;
1732 } 1679 }
1733 // right 1680 // right
1734 ret_ = lines_intersect(p1->x,p1->y,p2->x,p2->y,r->rl.x,r->lu.y,r->rl.x,r->rl.y,&xx,&yy); 1681 ret_ = lines_intersect(p1->x, p1->y, p2->x, p2->y, r->rl.x, r->lu.y, r->rl.x, r->rl.y, &xx, &yy);
1735 if (ret_ == DO_INTERSECT) 1682 if (ret_ == DO_INTERSECT)
1736 { 1683 {
1737 return 3; 1684 return 3;
1738 } 1685 }
1739 } 1686 }
1814 code2 = clipcode(p2, r); 1761 code2 = clipcode(p2, r);
1815 } 1762 }
1816 return ret; 1763 return ret;
1817} 1764}
1818 1765
1819
1820static void graphics_draw_polyline_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pa, int count, int *width, int step, int poly, int order, int oneway) 1766static void graphics_draw_polyline_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pa, int count, int *width, int step, int poly, int order, int oneway, int dashes, struct color *c)
1821{ 1767{
1822 struct point *p = g_alloca(sizeof(struct point) * (count + 1)); 1768 struct point *p = g_alloca(sizeof(struct point) * (count + 1));
1823 struct wpoint p1, p2; 1769 struct wpoint p1, p2;
1824 int i; 1770 int i;
1825 int code; 1771 int code;
1826 int wmax; 1772 int wmax;
1827 int out = 0; 1773 int out = 0;
1828 const int max_segs = 2000; 1774 // const int max_segs = 2000;
1775 const int max_segs = 60; // send max this many segments to java with one single call
1829 struct point_rect r = gra->r; 1776 struct point_rect r = gra->r;
1830 1777
1778 //if (count > 30)
1779 //{
1780 // dbg(0,"segment count=%d\n", count);
1781 //}
1831 1782
1832#if 0 1783#if 0
1833 // check if whole line is within a 2x2 pixel square 1784 // check if whole line is within a 2x2 pixel square
1834 if (order < 11) 1785 if (order < 11)
1835 { 1786 {
1868 return; 1819 return;
1869 } 1820 }
1870 } 1821 }
1871#endif 1822#endif
1872 1823
1873
1874 // calc visible area on screen 1824 // calc visible area on screen
1875 wmax=width[0]; 1825 wmax = width[0];
1876 r.lu.x-=wmax; 1826 r.lu.x -= wmax;
1877 r.lu.y-=wmax; 1827 r.lu.y -= wmax;
1878 r.rl.x+=wmax; 1828 r.rl.x += wmax;
1879 r.rl.y+=wmax; 1829 r.rl.y += wmax;
1880 1830
1881 for (i = 0; i < count; i++) 1831 for (i = 0; i < count; i++)
1882 { 1832 {
1883 if (i > 0) 1833 if (i > 0)
1884 { 1834 {
1885 p1.x = pa[i - 1].x; 1835 p1.x = pa[i - 1].x;
1886 p1.y = pa[i - 1].y; 1836 p1.y = pa[i - 1].y;
1887 p2.x = pa[i].x; 1837 p2.x = pa[i].x;
1888 p2.y = pa[i].y; 1838 p2.y = pa[i].y;
1889 /* 0 = invisible, 1 = completely visible, 2,3 = at least part of line visible */ 1839 /* 0 = invisible, 1 = completely visible, 2,3 = at least part of line visible */
1890 code=clip_line_aprox(&p1, &p2, &r); 1840 code = clip_line_aprox(&p1, &p2, &r);
1891 // code = 1; 1841 // code = 1;
1892 1842
1893 if (code > 0) 1843 if (code > 0)
1894 { 1844 {
1895 if (out == 0) 1845 if (out == 0)
1896 { 1846 {
1897 p[out].x=p1.x; 1847 p[out].x = p1.x;
1898 p[out].y=p1.y; 1848 p[out].y = p1.y;
1899 out++; 1849 out++;
1900 } 1850 }
1901 p[out].x=p2.x; 1851 p[out].x = p2.x;
1902 p[out].y=p2.y; 1852 p[out].y = p2.y;
1903 out++; 1853 out++;
1904 1854
1905 if ((out <= max_segs) && (i < (count - 1))) 1855 if ((out <= max_segs) && (i < (count - 1)))
1906 { 1856 {
1907 // ok gather more line segs 1857 // ok gather more line segs
1918 } 1868 }
1919 1869
1920 // PAINT --- LINE SEGMENTS ------------ 1870 // PAINT --- LINE SEGMENTS ------------
1921 // PAINT --- LINE SEGMENTS ------------ 1871 // PAINT --- LINE SEGMENTS ------------
1922 1872
1923 if ((poly == 1) || (poly == 0)) 1873 if ((poly == 1) || (poly == 0))
1924 { 1874 {
1925 // normal street 1875 // normal street
1926 //if (1 == 0) 1876 //if (1 == 0)
1927 //{ 1877 //{
1928 // // draw as polygon --> OLD method 1878 // // draw as polygon --> OLD method
1929 // graphics_draw_polyline_as_polygon(gra, gc, p, out, w, step, 1, order, 0); 1879 // graphics_draw_polyline_as_polygon(gra, gc, p, out, w, step, 1, order, 0);
1930 //} 1880 //}
1931 //else 1881 //else
1932 //{ 1882 //{
1933 // draw as line 1883 // draw as line
1934 gra->meth.draw_lines3(gra->priv, gc->priv, p, out, order, width[i]); 1884 gra->meth.draw_lines3(gra->priv, gc->priv, p, out, order, width[i], dashes, c);
1935 //draw_lines_count_3++; 1885 //draw_lines_count_3++;
1936 //} 1886 //}
1937 1887
1938 // one way arrow 1888 // one way arrow
1939 if ((oneway > 0) && (order > 13)) 1889 if ((oneway > 0) && (order > 13))
1940 { 1890 {
1941 gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, oneway); 1891 gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, oneway);
1942 //draw_lines_count_2++; 1892 //draw_lines_count_2++;
1943 }
1944 } 1893 }
1894 }
1945 else if (poly == 2) 1895 else if (poly == 2)
1946 { 1896 {
1947 // ******* street is underground ******** 1897 // ******* street is underground ********
1948 // ******* street is underground ******** 1898 // ******* street is underground ********
1949 // ******* street is underground ******** 1899 // ******* street is underground ********
1950 1900
1951 //if (1 == 0) 1901 //if (1 == 0)
1952 //{ 1902 //{
1953 // // draw as polygon --> OLD method 1903 // // draw as polygon --> OLD method
1954 // graphics_draw_polyline_as_polygon(gra, gc, p, out, w, step, 0, order, 0); 1904 // graphics_draw_polyline_as_polygon(gra, gc, p, out, w, step, 0, order, 0);
1955 //} 1905 //}
1956 //else 1906 //else
1957 //{ 1907 //{
1958 1908
1959 // draw as line 1909 // draw as line
1960 gra->meth.draw_lines4(gra->priv, gc->priv, p, out, order, width[i], 1); 1910 gra->meth.draw_lines4(gra->priv, gc->priv, p, out, order, width[i], 1, dashes, c);
1961 //draw_lines_count_4++; 1911 //draw_lines_count_4++;
1962 //} 1912 //}
1963 1913
1964 // one way arrow 1914 // one way arrow
1965 if ((oneway > 0) && (order > 13)) 1915 if ((oneway > 0) && (order > 13))
1966 { 1916 {
1967 gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, oneway); 1917 gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, oneway);
1968 //draw_lines_count_2++; 1918 //draw_lines_count_2++;
1969 }
1970 } 1919 }
1920 }
1971 else if (poly == 3) 1921 else if (poly == 3)
1972 { 1922 {
1973 // ******* street has bridge ******** 1923 // ******* street has bridge ********
1974 // ******* street has bridge ******** 1924 // ******* street has bridge ********
1975 // ******* street has bridge ******** 1925 // ******* street has bridge ********
1976 gra->meth.draw_lines4(gra->priv, gc->priv, p, out, order, width[i], 2); 1926 gra->meth.draw_lines4(gra->priv, gc->priv, p, out, order, width[i], 2, dashes, c);
1977 //draw_lines_count_4++; 1927 //draw_lines_count_4++;
1978 1928
1979 // one way arrow 1929 // one way arrow
1980 if ((oneway > 0) && (order > 13)) 1930 if ((oneway > 0) && (order > 13))
1981 { 1931 {
1982 gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, oneway); 1932 gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, oneway);
1983 //draw_lines_count_2++; 1933 //draw_lines_count_2++;
1984 }
1985 } 1934 }
1935 }
1986 // --> now NOT used anymore!! 1936 // --> now NOT used anymore!!
1987 else // poly==0 -> street that is only a line (width=1) 1937 else // poly==0 -> street that is only a line (width=1)
1988 { 1938 {
1989 // OLD // gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, 0); 1939 // OLD // gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, 0);
1990 1940
1991 gra->meth.draw_lines3(gra->priv, gc->priv, p, out, order, width[i]); 1941 gra->meth.draw_lines3(gra->priv, gc->priv, p, out, order, width[i], dashes, c);
1992 //draw_lines_count_3++; 1942 //draw_lines_count_3++;
1993 1943
1994 // one way arrow 1944 // one way arrow
1995 if ((oneway > 0) && (order > 13)) 1945 if ((oneway > 0) && (order > 13))
1996 { 1946 {
1997 gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, oneway); 1947 gra->meth.draw_lines2(gra->priv, gc->priv, p, out, order, oneway);
1998 //draw_lines_count_2++; 1948 //draw_lines_count_2++;
1999 }
2000 } 1949 }
1950 }
2001 1951
2002 out = 0; // reset point counter after painting 1952 out = 0; // reset point counter after painting
2003 // PAINT --- LINE SEGMENTS ------------ 1953 // PAINT --- LINE SEGMENTS ------------
2004 // PAINT --- LINE SEGMENTS ------------ 1954 // PAINT --- LINE SEGMENTS ------------
2005 // PAINT --- LINE SEGMENTS ------------ 1955 // PAINT --- LINE SEGMENTS ------------
2006 } 1956 }
2007 } 1957 }
2008} 1958}
2009
2010 1959
2011static int is_inside(struct point *p, struct point_rect *r, int edge) 1960static int is_inside(struct point *p, struct point_rect *r, int edge)
2012{ 1961{
2013 switch (edge) 1962 switch (edge)
2014 { 1963 {
2070 p1 = pa1; 2019 p1 = pa1;
2071 p2 = pa2; 2020 p2 = pa2;
2072 } 2021 }
2073 else 2022 else
2074 { 2023 {
2075 p1=g_new(struct point, count_in*8+1); 2024p1 =g_new(struct point, count_in*8+1);
2076 p2=g_new(struct point, count_in*8+1); 2025 p2=g_new(struct point, count_in*8+1);
2077 } 2026}
2078 2027
2079 pout=p1; 2028pout=p1;
2080 for (edge = 0; edge < 4; edge++) 2029for (edge = 0; edge < 4; edge++)
2081 { 2030{
2082 p=pin; 2031 p=pin;
2083 s=pin+count_in-1; 2032 s=pin+count_in-1;
2084 count_out=0; 2033 count_out=0;
2085 for (i = 0; i < count_in; i++) 2034 for (i = 0; i < count_in; i++)
2086 { 2035 {
2087 if (is_inside(p, &r, edge)) 2036 if (is_inside(p, &r, edge))
2088 { 2037 {
2089 if (! is_inside(s, &r, edge)) 2038 if (! is_inside(s, &r, edge))
2090 { 2039 {
2091 poly_intersection(s,p,&r,edge,&pi); 2040 poly_intersection(s,p,&r,edge,&pi);
2092 pout[count_out++]=pi; 2041 pout[count_out++]=pi;
2093 } 2042 }
2094 pout[count_out++]=*p; 2043 pout[count_out++]=*p;
2095 }
2096 else
2097 {
2098 if (is_inside(s, &r, edge))
2099 {
2100 poly_intersection(p,s,&r,edge,&pi);
2101 pout[count_out++]=pi;
2102 }
2103 }
2104 s=p;
2105 p++;
2106 }
2107 count_in=count_out;
2108 if (pin == p1)
2109 {
2110 pin=p2;
2111 pout=p1;
2112 } 2044 }
2113 else 2045 else
2114 { 2046 {
2047 if (is_inside(s, &r, edge))
2048 {
2049 poly_intersection(p,s,&r,edge,&pi);
2050 pout[count_out++]=pi;
2051 }
2052 }
2053 s=p;
2054 p++;
2055 }
2056 count_in=count_out;
2057 if (pin == p1)
2058 {
2059 pin=p2;
2060 pout=p1;
2061 }
2062 else
2063 {
2115 pin=p1; 2064 pin=p1;
2116 pout=p2; 2065 pout=p2;
2117 } 2066 }
2118 } 2067}
2119 2068
2120 gra->meth.draw_polygon(gra->priv, gc->priv, pin, count_in); 2069gra->meth.draw_polygon(gra->priv, gc->priv, pin, count_in);
2121 if (count_in >= limit) 2070if (count_in >= limit)
2122 { 2071{
2123 g_free(p1); 2072 g_free(p1);
2124 g_free(p2); 2073 g_free(p2);
2125 } 2074}
2126} 2075}
2127 2076
2128static void display_context_free(struct display_context *dc) 2077static void display_context_free(struct display_context *dc)
2129{ 2078{
2130 if (dc->gc) 2079 if (dc->gc)
2235 return count; 2184 return count;
2236} 2185}
2237 2186
2238static void displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc, int order, int allow_dashed, int run_type) 2187static void displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc, int order, int allow_dashed, int run_type)
2239{ 2188{
2240 ////DBG dbg(0,"ooo enter ooo\n"); 2189 //// dbg(0, "EEnter\n");
2241 2190
2242 int *width = g_alloca(sizeof(int) * dc->maxlen); 2191 int *width = g_alloca(sizeof(int) * dc->maxlen);
2243 struct point *pa = g_alloca(sizeof(struct point) * dc->maxlen); 2192 struct point *pa = g_alloca(sizeof(struct point) * dc->maxlen);
2244 struct graphics *gra = dc->gra; 2193 struct graphics *gra = dc->gra;
2245 struct graphics_gc *gc = dc->gc; 2194 struct graphics_gc *gc = dc->gc;
2246 struct element *e = dc->e; 2195 struct element *e = dc->e;
2247 struct graphics_image *img = dc->img; 2196 struct graphics_image *img = dc->img;
2248 struct point p; 2197 struct point p;
2249 char *path; 2198 char *path;
2250 2199
2251 //if (run_type > 100) dbg(0,"enter\n"); 2200 //if (run_type > 100) // dbg(0,"enter\n");
2252 2201
2253 while (di) 2202 while (di)
2254 { 2203 {
2204
2205 // stop drawing is requested
2206 if (cancel_drawing_global == 1)
2207 {
2208 break;
2209 }
2210
2255 if (run_type != 99) 2211 if (run_type != 99)
2256 { 2212 {
2257 if (run_type == 1) 2213 if (run_type == 1)
2258 { 2214 {
2259 if (di->item.flags & AF_UNDERGROUND) 2215 if (di->item.flags & AF_UNDERGROUND)
2362 { 2318 {
2363 oneway = 1; 2319 oneway = 1;
2364 } 2320 }
2365 2321
2366 // -------- apply dashes ------- 2322 // -------- apply dashes -------
2367 if (e->u.polyline.dash_num > 0) 2323 //if (e->u.polyline.dash_num > 0)
2368 { 2324 //{
2369 graphics_gc_set_dashes(gra, gc, e->u.polyline.width, e->u.polyline.offset, e->u.polyline.dash_table, e->u.polyline.dash_num, order); 2325 // graphics_gc_set_dashes(gra, gc, e->u.polyline.width, e->u.polyline.offset, e->u.polyline.dash_table, e->u.polyline.dash_num, order);
2370 } 2326 //}
2371 // -------- apply dashes ------- 2327 // -------- apply dashes -------
2372 2328
2373 for (i = 0; i < count; i++) 2329 //for (i = 0; i < count; i++)
2374 { 2330 //{
2375 if (width[i] < 1) 2331 // if (width[i] < 1)
2376 { 2332 // {
2377 width[i] = 1; 2333 // width[i] = 1;
2378 } 2334 // }
2379 } 2335 //}
2380 2336
2381 if (dc->type == type_border_country) 2337 if (dc->type == type_border_country)
2382 { 2338 {
2383 graphics_draw_polyline_clipped(gra, gc, pa, count, width, 99, poly, order, oneway); 2339 graphics_draw_polyline_clipped(gra, gc, pa, count, width, 99, poly, order, oneway, e->u.polyline.dash_num, &e->color);
2384 } 2340 }
2385 else 2341 else
2386 { 2342 {
2387 graphics_draw_polyline_clipped(gra, gc, pa, count, width, 1, poly, order, oneway); 2343 graphics_draw_polyline_clipped(gra, gc, pa, count, width, 1, poly, order, oneway, e->u.polyline.dash_num, &e->color);
2388 // graphics_draw_polyline_clipped(gra, gc, pa, count, width, 99, poly, order, oneway); 2344 // graphics_draw_polyline_clipped(gra, gc, pa, count, width, 99, poly, order, oneway);
2389 } 2345 }
2390 2346
2391 // -------- cancel dashes ------- 2347 // -------- cancel dashes -------
2392 if (e->u.polyline.dash_num > 0) 2348 //if (e->u.polyline.dash_num > 0)
2393 { 2349 //{
2394 int dummy_1[1]; 2350 // int dummy_1[1];
2395 dummy_1[0]=0; 2351 // dummy_1[0] = 0;
2396 graphics_gc_set_dashes(gra, gc, e->u.polyline.width, e->u.polyline.offset, dummy_1, e->u.polyline.dash_num, order); 2352 // graphics_gc_set_dashes(gra, gc, e->u.polyline.width, e->u.polyline.offset, dummy_1, e->u.polyline.dash_num, order);
2397 } 2353 //}
2398 //if (run_type > 100) dbg(0,"gg005\n"); 2354 //if (run_type > 100) // dbg(0,"gg005\n");
2399 // -------- cancel dashes ------- 2355 // -------- cancel dashes -------
2400 } 2356 }
2401 break; 2357 break;
2402 case element_circle: 2358 case element_circle:
2403 if (count) 2359 if (count)
2405 if (e->u.circle.width > 1) 2361 if (e->u.circle.width > 1)
2406 { 2362 {
2407 gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width); 2363 gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width);
2408 } 2364 }
2409 2365
2366 //// dbg(0, "graphics_draw_circle\n");
2410 graphics_draw_circle(gra, gc, pa, e->u.circle.radius); 2367 graphics_draw_circle(gra, gc, pa, e->u.circle.radius);
2411 2368
2412 if (di->label && e->text_size) 2369 if (di->label && e->text_size)
2413 { 2370 {
2414 struct graphics_font *font = get_font(gra, e->text_size); 2371 struct graphics_font *font = get_font(gra, e->text_size);
2426 { 2383 {
2427 gra->meth.draw_text(gra->priv, gc->priv, gc_background ? gc_background->priv : NULL, font->priv, di->label, &p, 0x10000, 0); 2384 gra->meth.draw_text(gra->priv, gc->priv, gc_background ? gc_background->priv : NULL, font->priv, di->label, &p, 0x10000, 0);
2428 } 2385 }
2429 else 2386 else
2430 { 2387 {
2431 //DBG dbg(0, "Failed to get font with size %d\n", e->text_size); 2388 //DBG // dbg(0, "Failed to get font with size %d\n", e->text_size);
2432 } 2389 }
2433 } 2390 }
2434 } 2391 }
2435 break; 2392 break;
2436 case element_text: 2393 case element_text:
2437 if (count && di->label) 2394 if (count && di->label)
2438 { 2395 {
2439 //if (run_type > 100) dbg(0,"gg006\n"); 2396 //if (run_type > 100) // dbg(0,"gg006\n");
2440 2397
2441 struct graphics_font *font = get_font(gra, e->text_size); 2398 struct graphics_font *font = get_font(gra, e->text_size);
2442 struct graphics_gc *gc_background = dc->gc_background; 2399 struct graphics_gc *gc_background = dc->gc_background;
2443 2400
2444 if (!gc_background && e->u.text.background_color.a) 2401 if (!gc_background && e->u.text.background_color.a)
2452 { 2409 {
2453 label_line(gra, gc, gc_background, font, pa, count, di->label); 2410 label_line(gra, gc, gc_background, font, pa, count, di->label);
2454 } 2411 }
2455 else 2412 else
2456 { 2413 {
2457 //DBG dbg(0, "Failed to get font with size %d\n", e->text_size); 2414 //DBG // dbg(0, "Failed to get font with size %d\n", e->text_size);
2458 } 2415 }
2459 } 2416 }
2460 break; 2417 break;
2461 case element_icon: 2418 case element_icon:
2462 if (count) 2419 if (count)
2489 { 2446 {
2490 dc->img = img; 2447 dc->img = img;
2491 } 2448 }
2492 else 2449 else
2493 { 2450 {
2494 // missing icon // dbg(0, "-- ICON MISSING -- failed to load icon '%s'\n", path); 2451 // missing icon // // dbg(0, "-- ICON MISSING -- failed to load icon '%s'\n", path);
2495 } 2452 }
2496 g_free(path); 2453 g_free(path);
2497 } 2454 }
2498 2455
2499 if (img) 2456 if (img)
2500 { 2457 {
2501 p.x = pa[0].x - img->hot.x; 2458 p.x = pa[0].x - img->hot.x;
2502 p.y = pa[0].y - img->hot.y; 2459 p.y = pa[0].y - img->hot.y;
2503 //dbg(0, "icon: '%s'\n", path); 2460 //// dbg(0, "icon: '%s'\n", path);
2504 //dbg(0,"hot: %d %d\n", img->hot.x, img->hot.y); 2461 //// dbg(0,"hot: %d %d\n", img->hot.x, img->hot.y);
2505 gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p, img->priv); 2462 gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p, img->priv);
2506 } 2463 }
2507 } 2464 }
2508 break; 2465 break;
2509 case element_image: 2466 case element_image:
2510 //dbg(0, "image: '%s'\n", di->label); 2467 //// dbg(0, "image: '%s'\n", di->label);
2511 if (gra->meth.draw_image_warp) 2468 if (gra->meth.draw_image_warp)
2512 gra->meth.draw_image_warp(gra->priv, gra->gc[0]->priv, pa, count, di->label); 2469 gra->meth.draw_image_warp(gra->priv, gra->gc[0]->priv, pa, count, di->label);
2513 else 2470 else
2514 { 2471 {
2515 // dbg(0,"draw_image_warp not supported by graphics driver drawing '%s'\n",di->label); 2472 // // dbg(0,"draw_image_warp not supported by graphics driver drawing '%s'\n",di->label);
2516 } 2473 }
2517 break; 2474 break;
2518 case element_arrows: 2475 case element_arrows:
2519 display_draw_arrows(gra, gc, pa, count); 2476 display_draw_arrows(gra, gc, pa, count);
2520 break; 2477 break;
2521 default: 2478 //default:
2522 printf("Unhandled element type %d\n", e->type); 2479 // printf("Unhandled element type %d\n", e->type);
2523
2524 } 2480 }
2525 di = di->next; 2481 di = di->next;
2526 } 2482 }
2527 2483
2528 //if (run_type > 100) dbg(0,"gg099\n"); 2484 //if (run_type > 100) // dbg(0,"gg099\n");
2529 2485
2530} 2486}
2531/** 2487/**
2532 * FIXME 2488 * FIXME
2533 * @param <> 2489 * @param <>
2534 * @returns <> 2490 * @returns <>
2535 * @author Martin Schaller (04/2008) 2491 * @author Martin Schaller (04/2008)
2536 */ 2492 */
2537static void xdisplay_draw_elements(struct graphics *gra, struct displaylist *display_list, struct itemgra *itm, int run_type) 2493static void xdisplay_draw_elements(struct graphics *gra, struct displaylist *display_list, struct itemgra *itm, int run_type)
2538{ 2494{
2539 // dbg(0,"Enter\n"); 2495 // // dbg(0,"Enter\n");
2540 2496
2541 struct element *e; 2497 struct element *e;
2542 GList *es, *types; 2498 GList *es, *types;
2543 struct display_context *dc = &display_list->dc; 2499 struct display_context *dc = &display_list->dc;
2544 struct hash_entry *entry; 2500 struct hash_entry *entry;
2549#endif 2505#endif
2550 2506
2551 es = itm->elements; 2507 es = itm->elements;
2552 while (es) 2508 while (es)
2553 { 2509 {
2554 //dbg(0,"*es\n"); 2510 //// dbg(0,"*es\n");
2555 e = es->data; 2511 e = es->data;
2556 dc->e = e; 2512 dc->e = e;
2557 types = itm->type; 2513 types = itm->type;
2558 while (types) 2514 while (types)
2559 { 2515 {
2560 draw_it = 1; 2516 draw_it = 1;
2561 2517
2518 // stop drawing is requested
2519 if (cancel_drawing_global == 1)
2520 {
2521 break;
2522 }
2523
2562 dc->type = GPOINTER_TO_INT(types->data); 2524 dc->type = GPOINTER_TO_INT(types->data);
2563 //dbg(0,"**type=%d\n", dc->type); 2525 //// dbg(0,"**type=%d\n", dc->type);
2564 2526
2565 if (dc->type == type_poly_water_from_relations) 2527 if (dc->type == type_poly_water_from_relations)
2566 { 2528 {
2567 // ok "poly_water_from_relations" is found, now what? 2529 // ok "poly_water_from_relations" is found, now what?
2568 if (enable_water_from_relations == 0) 2530 if (enable_water_from_relations == 0)
2574 if (draw_it == 1) 2536 if (draw_it == 1)
2575 { 2537 {
2576 entry = get_hash_entry(display_list, dc->type); 2538 entry = get_hash_entry(display_list, dc->type);
2577 if (entry && entry->di) 2539 if (entry && entry->di)
2578 { 2540 {
2579 // dbg(0,"++type=%s\n", item_to_name(dc->type)); 2541 // // dbg(0,"++type=%s\n", item_to_name(dc->type));
2580 //if (!strcmp(item_to_name(dc->type), "border_country")) 2542 //if (!strcmp(item_to_name(dc->type), "border_country"))
2581 //{ 2543 //{
2582 // displayitem_draw(entry->di, NULL, dc, display_list->order, 1, 101); 2544 // displayitem_draw(entry->di, NULL, dc, display_list->order, 1, 101);
2583 //} 2545 //}
2584 //else 2546 //else
2585 //{ 2547 //{
2586 displayitem_draw(entry->di, NULL, dc, display_list->order, 1, run_type); 2548 displayitem_draw(entry->di, NULL, dc, display_list->order, 1, run_type);
2587 //} 2549 //}
2588 // dbg(0,"**+gc free\n"); 2550 // // dbg(0,"**+gc free\n");
2589 display_context_free(dc); 2551 display_context_free(dc);
2590 } 2552 }
2591 } 2553 }
2592 types = g_list_next(types); 2554 types = g_list_next(types);
2593 draw_it = 1; 2555 draw_it = 1;
2600#endif 2562#endif
2601} 2563}
2602 2564
2603void graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t, char *label) 2565void graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t, char *label)
2604{ 2566{
2605 ////DBG dbg(0,"ooo enter ooo\n"); 2567 // dbg(0, "EEnter\n");
2606 2568
2607 // HINT: seems to only be called from vehicle.c (draw the vehicle on screen) 2569 // HINT: seems to only be called from vehicle.c (draw the vehicle on screen)
2608 2570
2609 GList *es; 2571 GList *es;
2610 struct display_context dc; 2572 struct display_context dc;
2626 dc.trans = t; 2588 dc.trans = t;
2627 dc.type = type_none; 2589 dc.type = type_none;
2628 dc.maxlen = max_coord; 2590 dc.maxlen = max_coord;
2629 while (es) 2591 while (es)
2630 { 2592 {
2593 // dbg(0, "while loop\n");
2631 struct element *e = es->data; 2594 struct element *e = es->data;
2632 if (e->coord_count) 2595 if (e->coord_count)
2633 { 2596 {
2634 if (e->coord_count > max_coord) 2597 if (e->coord_count > max_coord)
2635 { 2598 {
2636 //DBG dbg(0, "maximum number of coords reached: %d > %d\n", e->coord_count, max_coord); 2599 //DBG // dbg(0, "maximum number of coords reached: %d > %d\n", e->coord_count, max_coord);
2637 di->count = max_coord; 2600 di->count = max_coord;
2638 } 2601 }
2639 else 2602 else
2640 { 2603 {
2641 di->count = e->coord_count; 2604 di->count = e->coord_count;
2662 * @returns <> 2625 * @returns <>
2663 * @author Martin Schaller (04/2008) 2626 * @author Martin Schaller (04/2008)
2664 */ 2627 */
2665static void xdisplay_draw_layer(struct displaylist *display_list, struct graphics *gra, struct layer *lay, int order) 2628static void xdisplay_draw_layer(struct displaylist *display_list, struct graphics *gra, struct layer *lay, int order)
2666{ 2629{
2667 //DBG dbg(0,"ooo enter ooo\n"); 2630 //DBG // dbg(0,"ooo enter ooo\n");
2668 2631
2669 GList *itms; 2632 GList *itms;
2670 struct itemgra *itm; 2633 struct itemgra *itm;
2671 2634
2672 int run_type = 0; // 99 -> normal 2635 int run_type = 0; // 99 -> normal
2673 // 1 -> normal streets (except tunnels and bridges) 2636 // 1 -> normal streets (except tunnels and bridges)
2674 // 2 -> tunnel 2637 // 2 -> tunnel
2675 // 3 -> bridge 2638 // 3 -> bridge
2676 2639
2677 int send_refresh = 0; 2640 int send_refresh = 0;
2678 2641
2679 int order_corrected = order + shift_order; 2642 int order_corrected = order + shift_order;
2680 if (order_corrected < limit_order_corrected) 2643 if (order_corrected < limit_order_corrected)
2686 if (order < 0) 2649 if (order < 0)
2687 { 2650 {
2688 order_corrected_2 = 0; 2651 order_corrected_2 = 0;
2689 } 2652 }
2690 2653
2691 //dbg(0,"layer name=%s\n", lay->name); 2654 //// dbg(0,"layer name=%s\n", lay->name);
2692 2655
2693 if ((strncmp("streets_1", lay->name, 9) == 0)) 2656 if ((strncmp("streets_1", lay->name, 9) == 0))
2694 { 2657 {
2695 //dbg(0,"MT:7.3.1 - tunnel start\n"); 2658 //// dbg(0,"MT:7.3.1 - tunnel start\n");
2696 //draw_lines_count_2 = 0; 2659 //draw_lines_count_2 = 0;
2697 //draw_lines_count_3 = 0; 2660 //draw_lines_count_3 = 0;
2698 //draw_lines_count_4 = 0; 2661 //draw_lines_count_4 = 0;
2699 2662
2700 send_refresh = 1; 2663 send_refresh = 1;
2704 while (itms) 2667 while (itms)
2705 { 2668 {
2706 // stop drawing is requested 2669 // stop drawing is requested
2707 if (cancel_drawing_global == 1) 2670 if (cancel_drawing_global == 1)
2708 { 2671 {
2709 //DBG dbg(0, "** STOP MD 002 **\n"); 2672 //DBG // dbg(0, "** STOP MD 002 **\n");
2710 break; 2673 break;
2711 } 2674 }
2712 2675
2713 itm = itms->data; 2676 itm = itms->data;
2714 //if (order_corrected >= itm->order.min && order_corrected <= itm->order.max) 2677 //if (order_corrected >= itm->order.min && order_corrected <= itm->order.max)
2717 xdisplay_draw_elements(gra, display_list, itm, run_type); 2680 xdisplay_draw_elements(gra, display_list, itm, run_type);
2718 } 2681 }
2719 itms = g_list_next(itms); 2682 itms = g_list_next(itms);
2720 } 2683 }
2721 2684
2722 //dbg(0,"lines count2=%lld\n", draw_lines_count_2); 2685 //// dbg(0,"lines count2=%lld\n", draw_lines_count_2);
2723 //dbg(0,"lines count3=%lld\n", draw_lines_count_3); 2686 //// dbg(0,"lines count3=%lld\n", draw_lines_count_3);
2724 //dbg(0,"lines count4=%lld\n", draw_lines_count_4); 2687 //// dbg(0,"lines count4=%lld\n", draw_lines_count_4);
2725 //draw_lines_count_2 = 0; 2688 //draw_lines_count_2 = 0;
2726 //draw_lines_count_3 = 0; 2689 //draw_lines_count_3 = 0;
2727 //draw_lines_count_4 = 0; 2690 //draw_lines_count_4 = 0;
2728 //dbg(0,"MT:7.3.2 - streets start\n"); 2691 //// dbg(0,"MT:7.3.2 - streets start\n");
2729 2692
2730 run_type = 1; 2693 run_type = 1;
2731 itms = lay->itemgras; 2694 itms = lay->itemgras;
2732 while (itms) 2695 while (itms)
2733 { 2696 {
2734 // stop drawing is requested 2697 // stop drawing is requested
2735 if (cancel_drawing_global == 1) 2698 if (cancel_drawing_global == 1)
2736 { 2699 {
2737 //DBG dbg(0, "** STOP MD 002 **\n"); 2700 //DBG // dbg(0, "** STOP MD 002 **\n");
2738 break; 2701 break;
2739 } 2702 }
2740 2703
2741 itm = itms->data; 2704 itm = itms->data;
2742 //if (order_corrected >= itm->order.min && order_corrected <= itm->order.max) 2705 //if (order_corrected >= itm->order.min && order_corrected <= itm->order.max)
2746 } 2709 }
2747 itms = g_list_next(itms); 2710 itms = g_list_next(itms);
2748 } 2711 }
2749 2712
2750 /* 2713 /*
2751 dbg(0,"lines count2=%lld\n", draw_lines_count_2); 2714 // dbg(0,"lines count2=%lld\n", draw_lines_count_2);
2752 dbg(0,"lines count3=%lld\n", draw_lines_count_3); 2715 // dbg(0,"lines count3=%lld\n", draw_lines_count_3);
2753 dbg(0,"lines count4=%lld\n", draw_lines_count_4); 2716 // dbg(0,"lines count4=%lld\n", draw_lines_count_4);
2754 draw_lines_count_2 = 0; 2717 draw_lines_count_2 = 0;
2755 draw_lines_count_3 = 0; 2718 draw_lines_count_3 = 0;
2756 draw_lines_count_4 = 0; 2719 draw_lines_count_4 = 0;
2757 dbg(0,"MT:7.3.3 - bridges start\n"); 2720 // dbg(0,"MT:7.3.3 - bridges start\n");
2758 */ 2721 */
2759 2722
2760 run_type = 3; 2723 run_type = 3;
2761 itms = lay->itemgras; 2724 itms = lay->itemgras;
2762 while (itms) 2725 while (itms)
2763 { 2726 {
2764 // stop drawing is requested 2727 // stop drawing is requested
2765 if (cancel_drawing_global == 1) 2728 if (cancel_drawing_global == 1)
2766 { 2729 {
2767 //DBG dbg(0, "** STOP MD 002 **\n"); 2730 //DBG // dbg(0, "** STOP MD 002 **\n");
2768 break; 2731 break;
2769 } 2732 }
2770 2733
2771 itm = itms->data; 2734 itm = itms->data;
2772 //if (order_corrected >= itm->order.min && order_corrected <= itm->order.max) 2735 //if (order_corrected >= itm->order.min && order_corrected <= itm->order.max)
2776 } 2739 }
2777 itms = g_list_next(itms); 2740 itms = g_list_next(itms);
2778 } 2741 }
2779 2742
2780 /* 2743 /*
2781 dbg(0,"lines count2=%lld\n", draw_lines_count_2); 2744 // dbg(0,"lines count2=%lld\n", draw_lines_count_2);
2782 dbg(0,"lines count3=%lld\n", draw_lines_count_3); 2745 // dbg(0,"lines count3=%lld\n", draw_lines_count_3);
2783 dbg(0,"lines count4=%lld\n", draw_lines_count_4); 2746 // dbg(0,"lines count4=%lld\n", draw_lines_count_4);
2784 draw_lines_count_2 = 0; 2747 draw_lines_count_2 = 0;
2785 draw_lines_count_3 = 0; 2748 draw_lines_count_3 = 0;
2786 draw_lines_count_4 = 0; 2749 draw_lines_count_4 = 0;
2787 dbg(0,"MT:7.3.4 - ready\n"); 2750 // dbg(0,"MT:7.3.4 - ready\n");
2788 */ 2751 */
2789 2752
2790 } 2753 }
2791 else 2754 else
2792 { 2755 {
2793 run_type = 99; 2756 run_type = 99;
2795 while (itms) 2758 while (itms)
2796 { 2759 {
2797 // stop drawing is requested 2760 // stop drawing is requested
2798 if (cancel_drawing_global == 1) 2761 if (cancel_drawing_global == 1)
2799 { 2762 {
2800 //DBG dbg(0, "** STOP MD 002 **\n"); 2763 //DBG // dbg(0, "** STOP MD 002 **\n");
2801 break; 2764 break;
2802 } 2765 }
2803 2766
2804 itm = itms->data; 2767 itm = itms->data;
2805 //if (order_corrected >= itm->order.min && order_corrected <= itm->order.max) 2768 //if (order_corrected >= itm->order.min && order_corrected <= itm->order.max)
2847 if (curr_ < count_) 2810 if (curr_ < count_)
2848 { 2811 {
2849 struct route_info *dst = ldest->data; 2812 struct route_info *dst = ldest->data;
2850 pc77.x = dst->c.x; 2813 pc77.x = dst->c.x;
2851 pc77.y = dst->c.y; 2814 pc77.y = dst->c.y;
2852 //dbg(0, "draw1 curr=%d x y: %d %d\n", curr_, dst->c.x, dst->c.y); 2815 //// dbg(0, "draw1 curr=%d x y: %d %d\n", curr_, dst->c.x, dst->c.y);
2853 enum projection pro = transform_get_projection(global_navit->trans_cursor); 2816 enum projection pro = transform_get_projection(global_navit->trans_cursor);
2854 transform(global_navit->trans, pro, &pc77, &p2, 1, 0, 0, NULL); 2817 transform(global_navit->trans, pro, &pc77, &p2, 1, 0, 0, NULL);
2855 // transform(global_navit->trans, projection_mg, &pc77, &p2, 1, 0, 0, NULL); 2818 // transform(global_navit->trans, projection_mg, &pc77, &p2, 1, 0, 0, NULL);
2856 p2.x = p2.x - global_img_waypoint->hot.x; // hot = 29 2819 p2.x = p2.x - global_img_waypoint->hot.x; // hot = 29
2857 p2.y = p2.y - global_img_waypoint->hot.y; // hot = 29 2820 p2.y = p2.y - global_img_waypoint->hot.y; // hot = 29
2858 gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p2, global_img_waypoint->priv); 2821 gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p2, global_img_waypoint->priv);
2859 } 2822 }
2860 // next dest. / waypoint 2823 // next dest. / waypoint
2861 ldest=g_list_next(ldest); 2824 ldest = g_list_next(ldest);
2862 } 2825 }
2863 } 2826 }
2864 } 2827 }
2865 } 2828 }
2866 } 2829 }
2868 2831
2869 2832
2870 if (send_refresh == 1) 2833 if (send_refresh == 1)
2871 { 2834 {
2872 // dummy "ready" signal ------------------------------------------ 2835 // dummy "ready" signal ------------------------------------------
2873 dbg(0,"dummy \"ready\" signal (layers)\n"); 2836 // dbg(0, "dummy \"ready\" signal (layers)\n");
2874 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 96); 2837 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 96, 0, NULL);
2875 // dummy "ready" signal ------------------------------------------ 2838 // dummy "ready" signal ------------------------------------------
2876 } 2839 }
2877 2840
2878} 2841}
2879 2842
2883 * @returns <> 2846 * @returns <>
2884 * @author Martin Schaller (04/2008) 2847 * @author Martin Schaller (04/2008)
2885 */ 2848 */
2886static void xdisplay_draw(struct displaylist *display_list, struct graphics *gra, struct layout *l, int order) 2849static void xdisplay_draw(struct displaylist *display_list, struct graphics *gra, struct layout *l, int order)
2887{ 2850{
2888 ////DBG dbg(0,"ooo enter ooo\n"); 2851 ////DBG // dbg(0,"ooo enter ooo\n");
2889 2852
2890 GList *lays; 2853 GList *lays;
2891 struct layer *lay; 2854 struct layer *lay;
2892 2855
2893 int draw_vector_map = 1; 2856 int draw_vector_map = 1;
2922 //vehicle_get_cursor_data(global_navit->vehicle->vehicle, &pnt2, &a, &s); 2885 //vehicle_get_cursor_data(global_navit->vehicle->vehicle, &pnt2, &a, &s);
2923 2886
2924 //struct attr pos_attr; 2887 //struct attr pos_attr;
2925 //if (vehicle_get_attr(global_navit->vehicle->vehicle, attr_position_coord_geo, &pos_attr, NULL)) 2888 //if (vehicle_get_attr(global_navit->vehicle->vehicle, attr_position_coord_geo, &pos_attr, NULL))
2926 //{ 2889 //{
2927 // ////DBG dbg(0,"1 lat=%f, lng=%f\n",pos_attr.u.coord_geo->lat,pos_attr.u.coord_geo->lng); 2890 // ////DBG // dbg(0,"1 lat=%f, lng=%f\n",pos_attr.u.coord_geo->lat,pos_attr.u.coord_geo->lng);
2928 //} 2891 //}
2929 2892
2930 valid = 1; 2893 valid = 1;
2931 } 2894 }
2932 } 2895 }
2963 if (!gc22) 2926 if (!gc22)
2964 { 2927 {
2965 gc22 = graphics_gc_new(gra22); 2928 gc22 = graphics_gc_new(gra22);
2966 } 2929 }
2967 // graphics_draw_bigmap(gra22, gc22, -t->yaw, display_list->order, g22.lat, g22.lng, cursor_pnt.x, cursor_pnt.y, mcenter_pnt.x, mcenter_pnt.y, global_vehicle_pos_onscreen.x, global_vehicle_pos_onscreen.y, valid); 2930 // graphics_draw_bigmap(gra22, gc22, -t->yaw, display_list->order, g22.lat, g22.lng, cursor_pnt.x, cursor_pnt.y, mcenter_pnt.x, mcenter_pnt.y, global_vehicle_pos_onscreen.x, global_vehicle_pos_onscreen.y, valid);
2968 graphics_draw_bigmap(gra22, gc22, -t->yaw, (int)(my_scale / 100), g22.lat, g22.lng, cursor_pnt.x, cursor_pnt.y, mcenter_pnt.x, mcenter_pnt.y, global_vehicle_pos_onscreen.x, global_vehicle_pos_onscreen.y, valid); 2931 graphics_draw_bigmap(gra22, gc22, -t->yaw, (int) (my_scale / 100), g22.lat, g22.lng, cursor_pnt.x, cursor_pnt.y, mcenter_pnt.x, mcenter_pnt.y, global_vehicle_pos_onscreen.x, global_vehicle_pos_onscreen.y, valid);
2969 } 2932 }
2970 2933
2971 // reset value; --> not sure here, maybe it should NOT be reset here!!!??? 2934 // reset value; --> not sure here, maybe it should NOT be reset here!!!???
2972 cancel_drawing_global = 0; 2935 // cancel_drawing_global = 0;
2973 2936
2974 lays = l->layers; 2937 lays = l->layers;
2975 while (lays) 2938 while (lays)
2976 { 2939 {
2940 // stop drawing is requested
2941 if (cancel_drawing_global == 1)
2942 {
2943 break;
2944 }
2945
2977 lay = lays->data; 2946 lay = lays->data;
2978 if (lay->active) 2947 if (lay->active)
2979 { 2948 {
2980 xdisplay_draw_layer(display_list, gra, lay, order); 2949 xdisplay_draw_layer(display_list, gra, lay, order);
2981 } 2950 }
2982 lays = g_list_next(lays); 2951 lays = g_list_next(lays);
2983
2984 // stop drawing is requested
2985 if (cancel_drawing_global == 1)
2986 {
2987 break;
2988 }
2989 } 2952 }
2990 2953
2991 // reset value; 2954 // reset value;
2992 cancel_drawing_global = 0; 2955 // cancel_drawing_global = 0;
2993 2956
2994 // dummy "start" signal ------------------------------------------ 2957 // dummy "start" signal ------------------------------------------
2995 dbg(0,"dummy \"start\" signal\n"); 2958 // // dbg(0, "dummy \"start\" signal\n");
2996 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 97); 2959 // gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 97);
2997 // dummy "start" signal ------------------------------------------ 2960 // dummy "start" signal ------------------------------------------
2998 2961
2999
3000 // dummy "ready" signal ------------------------------------------
3001 dbg(0,"dummy \"ready\" signal\n");
3002 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 99);
3003 // dummy "ready" signal ------------------------------------------
3004
3005
3006
3007#ifdef HAVE_API_ANDROID
3008 android_return_generic_int(2, 1);
3009#endif
3010
3011} 2962}
3012 2963
3013/** 2964/**
3014 * FIXME 2965 * FIXME
3015 * @param <> 2966 * @param <>
3018 */ 2969 */
3019extern void *route_selection; 2970extern void *route_selection;
3020 2971
3021static void displaylist_update_layers(struct displaylist *displaylist, GList *layers, int order) 2972static void displaylist_update_layers(struct displaylist *displaylist, GList *layers, int order)
3022{ 2973{
3023 ////DBG dbg(0,"ooo enter ooo\n"); 2974 ////DBG // dbg(0,"ooo enter ooo\n");
3024 2975
3025 int order_corrected = order + shift_order; 2976 int order_corrected = order + shift_order;
3026 //int saved=displaylist->order; 2977 //int saved=displaylist->order;
3027 if (order < limit_order_corrected) 2978 if (order < limit_order_corrected)
3028 { 2979 {
3054 // displaylist->order=saved; 3005 // displaylist->order=saved;
3055} 3006}
3056 3007
3057static void displaylist_update_hash(struct displaylist *displaylist) 3008static void displaylist_update_hash(struct displaylist *displaylist)
3058{ 3009{
3059 ////DBG dbg(0,"ooo enter ooo\n"); 3010 ////DBG // dbg(0,"ooo enter ooo\n");
3060 3011
3061 displaylist->max_offset = 0; 3012 displaylist->max_offset = 0;
3062 clear_hash(displaylist); 3013 clear_hash(displaylist);
3063 displaylist_update_layers(displaylist, displaylist->layout->layers, displaylist->order); 3014 displaylist_update_layers(displaylist, displaylist->layout->layers, displaylist->order);
3064 // dbg(1, "max offset %d\n", displaylist->max_offset); 3015 // dbg(1, "max offset %d\n", displaylist->max_offset);
3066 3017
3067static void do_draw(struct displaylist *displaylist, int cancel, int flags) 3018static void do_draw(struct displaylist *displaylist, int cancel, int flags)
3068{ 3019{
3069 3020
3070#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3021#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3071 dbg(0,"+#+:enter\n"); 3022 // dbg(0,"+#+:enter\n");
3072#endif 3023#endif
3073 3024
3074 //dbg(0,"enter\n"); 3025 int rnd = rand();
3026
3027 // dbg(0, "DO__DRAW:%d enter\n", rnd);
3028
3029 // try to cancel any previous drawing that might be going on ...
3030 // try to cancel any previous drawing that might be going on ...
3031 // try to cancel any previous drawing that might be going on ...
3032 // dbg(0, "DO__DRAW:%d cancel_drawing_global 1=%d\n", rnd, cancel_drawing_global);
3033 cancel_drawing_global = 1;
3034 // dbg(0, "DO__DRAW:%d cancel_drawing_global 2=%d\n", rnd, cancel_drawing_global);
3035 // try to cancel any previous drawing that might be going on ...
3036 // try to cancel any previous drawing that might be going on ...
3037 // try to cancel any previous drawing that might be going on ...
3038
3039
3040 // dbg(0, "DO__DRAW:%d lock mutex\n", rnd);
3041 pthread_mutex_lock(&uiConditionMutex);
3042 // dbg(0, "DO__DRAW:%d OK lock mutex\n", rnd);
3043
3044 // drawing is now starting ...
3045 // drawing is now starting ...
3046 // drawing is now starting ...
3047 // dbg(0, "DO__DRAW:%d cancel_drawing_global 3=%d\n", rnd, cancel_drawing_global);
3048 cancel_drawing_global = 0;
3049 // dbg(0, "DO__DRAW:%d cancel_drawing_global 4=%d\n", rnd, cancel_drawing_global);
3050 // drawing is now starting ...
3051 // drawing is now starting ...
3052 // drawing is now starting ...
3053
3075 3054
3076#ifdef HAVE_API_ANDROID 3055#ifdef HAVE_API_ANDROID
3077 // ---- disable map view ----- 3056 // ---- disable map view -----
3078 // ---- disable map view ----- 3057 // ---- disable map view -----
3079 // ---- disable map view ----- 3058 // ---- disable map view -----
3080 if (disable_map_drawing == 1) 3059 if (disable_map_drawing == 1)
3081 { 3060 {
3082 android_return_generic_int(2, 0); 3061 //android_return_generic_int(2, 0);
3083 3062
3084 //dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy); 3063 //// dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy);
3085 displaylist->busy = 0; 3064 displaylist->busy = 0;
3086 3065
3087 //dbg(0,"return 001\n"); 3066 // dbg(0,"DO__DRAW:%d UN-lock mutex 001\n", rnd);
3067 pthread_mutex_unlock(&uiConditionMutex);
3068 // dbg(0,"DO__DRAW:%d OK UN-lock mutex 001\n", rnd);
3069
3070 // dbg(0,"DO__DRAW:%d return 001\n", rnd);
3088 return; 3071 return;
3089 } 3072 }
3090 // ---- disable map view ----- 3073 // ---- disable map view -----
3091 // ---- disable map view ----- 3074 // ---- disable map view -----
3092 // ---- disable map view ----- 3075 // ---- disable map view -----
3093#endif 3076#endif
3094 3077
3095
3096
3097 clock_t s_; 3078 clock_t s_;
3098#ifdef NAVIT_MEASURE_TIME_DEBUG 3079#ifdef NAVIT_MEASURE_TIME_DEBUG
3099 s_ = debug_measure_start(); 3080 s_ = debug_measure_start();
3100#endif 3081#endif
3101
3102 3082
3103 struct item *item; 3083 struct item *item;
3104 int count, max = displaylist->dc.maxlen, workload = 0; 3084 int count, max = displaylist->dc.maxlen, workload = 0;
3105 struct coord *ca = g_alloca(sizeof(struct coord) * max); 3085 struct coord *ca = g_alloca(sizeof(struct coord) * max);
3106 struct attr attr, attr2; 3086 struct attr attr, attr2;
3107 enum projection pro; 3087 enum projection pro;
3108 int draw_vector_map = 1; // do we draw the vecotor map, or not? 0=false, 1=true 3088 int draw_vector_map = 1; // do we draw the vecotor map, or not? 0=false, 1=true
3109 int mapset_counter = 0; 3089 int mapset_counter = 0;
3110 int mapset_need_draw = 0; 3090 int mapset_need_draw = 0;
3111 3091
3112 // dbg(0,"ooo enter ooo %d\n",displaylist->order); 3092 // // dbg(0,"ooo enter ooo %d\n",displaylist->order);
3113 3093
3114 int order_corrected = displaylist->order + shift_order; 3094 int order_corrected = displaylist->order + shift_order;
3115 int saved = displaylist->order; 3095 int saved = displaylist->order;
3116 if (order_corrected < limit_order_corrected) 3096 if (order_corrected < limit_order_corrected)
3117 { 3097 {
3133 draw_vector_map = 0; 3113 draw_vector_map = 0;
3134 } 3114 }
3135 3115
3136 displaylist->order = order_corrected; 3116 displaylist->order = order_corrected;
3137 3117
3138 //DBG dbg(0, "XXXXXYYYYYYY Draw: 003\n"); 3118 //DBG // dbg(0, "XXXXXYYYYYYY Draw: 003\n");
3139 3119
3140 // reset value; 3120 // reset value;
3141 cancel_drawing_global = 0; 3121 // cancel_drawing_global = 0;
3142 3122
3143 while (!cancel) 3123 while (!cancel)
3144 { 3124 {
3145 if (!displaylist->msh) 3125 if (!displaylist->msh)
3146 { 3126 {
3161 mapset_need_draw = 1; 3141 mapset_need_draw = 1;
3162 struct attr map_name_attr; 3142 struct attr map_name_attr;
3163 3143
3164 if (map_get_attr(displaylist->m, attr_name, &map_name_attr, NULL)) 3144 if (map_get_attr(displaylist->m, attr_name, &map_name_attr, NULL))
3165 { 3145 {
3166 //dbg(0,"#+* start reading map file #+*=%s\n",map_name_attr.u.str); 3146 //// dbg(0,"#+* start reading map file #+*=%s\n",map_name_attr.u.str);
3167 if (strncmp("_ms_sdcard_map:", map_name_attr.u.str, 15) == 0) 3147 if (strncmp("_ms_sdcard_map:", map_name_attr.u.str, 15) == 0)
3168 { 3148 {
3169 if (strncmp("_ms_sdcard_map:/sdcard/zanavi/maps/borders.bin", map_name_attr.u.str, 41) == 0) 3149 if (strncmp("_ms_sdcard_map:/sdcard/zanavi/maps/borders.bin", map_name_attr.u.str, 41) == 0)
3170 { 3150 {
3171 // if its the countryborder map, always draw it 3151 // if its the countryborder map, always draw it
3177 mapset_need_draw = 0; 3157 mapset_need_draw = 0;
3178 } 3158 }
3179 } 3159 }
3180 } 3160 }
3181 3161
3182 ////DBG dbg(0,"---------==============>>>>>>>>>> ***** %d ****",mapset_counter); 3162 ////DBG // dbg(0,"---------==============>>>>>>>>>> ***** %d ****",mapset_counter);
3183 3163
3184 displaylist->dc.pro = map_projection(displaylist->m); 3164 displaylist->dc.pro = map_projection(displaylist->m);
3185 displaylist->conv = map_requires_conversion(displaylist->m); 3165 displaylist->conv = map_requires_conversion(displaylist->m);
3186 if (route_selection) 3166 if (route_selection)
3187 { 3167 {
3195 } 3175 }
3196 3176
3197 if (displaylist->mr) 3177 if (displaylist->mr)
3198 { 3178 {
3199 // draw vector map, or not? 3179 // draw vector map, or not?
3200 //dbg(0,"draw_vector_map=%d mapset_need_draw=%d\n", draw_vector_map, mapset_need_draw); 3180 //// dbg(0,"draw_vector_map=%d mapset_need_draw=%d\n", draw_vector_map, mapset_need_draw);
3201 if ((draw_vector_map) || (mapset_need_draw == 1)) 3181 if ((draw_vector_map) || (mapset_need_draw == 1))
3202 { 3182 {
3203 3183
3204 //dbg(0, "XXXXXYYYYYYY Draw: A.01\n"); 3184 //// dbg(0, "XXXXXYYYYYYY Draw: A.01\n");
3205 3185
3206 3186
3207 // ------ READ all items in this map rectangle --------- 3187 // ------ READ all items in this map rectangle ---------
3208 // ------ READ all items in this map rectangle --------- 3188 // ------ READ all items in this map rectangle ---------
3209 // ------ READ all items in this map rectangle --------- 3189 // ------ READ all items in this map rectangle ---------
3210 // ------ READ all items in this map rectangle --------- 3190 // ------ READ all items in this map rectangle ---------
3211 // ------ READ all items in this map rectangle --------- 3191 // ------ READ all items in this map rectangle ---------
3212 //dbg(0,"#+* start reading map file #+*\n"); 3192 //// dbg(0,"#+* start reading map file #+*\n");
3213 int _item_counter_ = 0; 3193 int _item_counter_ = 0;
3214 while ((item = map_rect_get_item(displaylist->mr))) 3194 while ((item = map_rect_get_item(displaylist->mr)))
3215 { 3195 {
3216 _item_counter_++; 3196 _item_counter_++;
3217 3197
3220 struct hash_entry *entry; 3200 struct hash_entry *entry;
3221 3201
3222 if (cancel_drawing_global == 1) 3202 if (cancel_drawing_global == 1)
3223 { 3203 {
3224 // stop drawing map is requested 3204 // stop drawing map is requested
3225 //DBG dbg(0, "** STOP MD 001 **\n"); 3205 //DBG // dbg(0, "** STOP MD 001 **\n");
3226 break; 3206 break;
3227 } 3207 }
3228 3208
3229 if (item == &busy_item) 3209 if (item == &busy_item)
3230 { 3210 {
3231 if (displaylist->workload) 3211 if (displaylist->workload)
3232 { 3212 {
3233 // restore order :-) 3213 // restore order :-)
3234 displaylist->order = saved; 3214 displaylist->order = saved;
3235 3215
3236 //dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy); 3216 //// dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy);
3237 displaylist->busy = 0; 3217 displaylist->busy = 0;
3238 3218
3219 // dbg(0, "DO__DRAW:%d UN-lock mutex 002\n", rnd);
3220 pthread_mutex_unlock(&uiConditionMutex);
3221 // dbg(0, "DO__DRAW:%d OK UN-lock mutex 002\n", rnd);
3222
3239 //dbg(0,"return 002\n"); 3223 //// dbg(0,"return 002\n");
3224 // dbg(0, "DO__DRAW:%d return 002\n", rnd);
3240 return; 3225 return;
3241 } 3226 }
3242 else 3227 else
3243 { 3228 {
3244 continue; 3229 continue;
3245 } 3230 }
3246 } 3231 }
3247 3232
3248 entry = get_hash_entry(displaylist, item->type); 3233 entry = get_hash_entry(displaylist, item->type);
3249 3234
3250 //dbg(0, "XXXXXYYYYYYY Draw: A.item1 %p %i\n", entry, item->type); 3235 //// dbg(0, "XXXXXYYYYYYY Draw: A.item1 %p %i\n", entry, item->type);
3251 3236
3252 // DEBUG -------- zoffzoff 3237 // DEBUG -------- zoffzoff
3253 // DEBUG -------- zoffzoff 3238 // DEBUG -------- zoffzoff
3254 // DEBUG -------- zoffzoff 3239 // DEBUG -------- zoffzoff
3255 //item_dump_attr_stdout(item, displaylist->m); 3240 //item_dump_attr_stdout(item, displaylist->m);
3267 if (!count) 3252 if (!count)
3268 { 3253 {
3269 continue; 3254 continue;
3270 } 3255 }
3271 3256
3272 //dbg(0, "XXXXXYYYYYYY Draw: A.item2\n"); 3257 //// dbg(0, "XXXXXYYYYYYY Draw: A.item2\n");
3273 3258
3274 if (displaylist->dc.pro != pro) 3259 if (displaylist->dc.pro != pro)
3275 { 3260 {
3276 transform_from_to_count(ca, displaylist->dc.pro, ca, pro, count); 3261 transform_from_to_count(ca, displaylist->dc.pro, ca, pro, count);
3277 } 3262 }
3278 3263
3279 if (count == max) 3264 if (count == max)
3280 { 3265 {
3281 //DBG dbg(0,"point count overflow %d for %s "ITEM_ID_FMT"\n", count,item_to_name(item->type),ITEM_ID_ARGS(*item)); 3266 //DBG // dbg(0,"point count overflow %d for %s "ITEM_ID_FMT"\n", count,item_to_name(item->type),ITEM_ID_ARGS(*item));
3282 displaylist->dc.maxlen = max * 2; 3267 displaylist->dc.maxlen = max * 2;
3283 } 3268 }
3284 3269
3285 if (item_is_custom_poi(*item)) 3270 if (item_is_custom_poi(*item))
3286 { 3271 {
3318 // DEBUG -------- zoffzoff 3303 // DEBUG -------- zoffzoff
3319 3304
3320 struct attr attr_77; 3305 struct attr attr_77;
3321 if (item_attr_get(item, attr_flags, &attr_77)) 3306 if (item_attr_get(item, attr_flags, &attr_77))
3322 { 3307 {
3323 // dbg(0,"uuuuuuuuuuuuu %s uuuuu %d\n",item_to_name(item->type), attr_77.u.num); 3308 // // dbg(0,"uuuuuuuuuuuuu %s uuuuu %d\n",item_to_name(item->type), attr_77.u.num);
3324 item->flags = attr_77.u.num; 3309 item->flags = attr_77.u.num;
3325 } 3310 }
3326 else 3311 else
3327 { 3312 {
3328 item->flags = 0; 3313 item->flags = 0;
3329 } 3314 }
3330 3315
3331 //struct attr *attr88; 3316 //struct attr *attr88;
3332 //if (item_attr_get(item, attr_flags, &attr88)) 3317 //if (item_attr_get(item, attr_flags, &attr88))
3333 //{ 3318 //{
3334 ////DBG dbg(0,"item flags=%d\n",attr88->u.num); 3319 ////DBG // dbg(0,"item flags=%d\n",attr88->u.num);
3335 //} 3320 //}
3336 //attr88=NULL; 3321 //attr88=NULL;
3337 3322
3338 3323
3339 /* 3324 /*
3340 if (item->flags & AF_UNDERGROUND) 3325 if (item->flags & AF_UNDERGROUND)
3341 { 3326 {
3342 dbg(0,"is UNDERGROUND\n"); 3327 // dbg(0,"is UNDERGROUND\n");
3343 } 3328 }
3344 else if (item->flags & AF_BRIDGE) 3329 else if (item->flags & AF_BRIDGE)
3345 { 3330 {
3346 dbg(0,"is BRIDGE\n"); 3331 // dbg(0,"is BRIDGE\n");
3347 } 3332 }
3348 */ 3333 */
3349 3334
3350 if (displaylist->conv && label_count) 3335 if (displaylist->conv && label_count)
3351 { 3336 {
3352 labels[0] = map_convert_string(displaylist->m, labels[0]); 3337 labels[0] = map_convert_string(displaylist->m, labels[0]);
3353 display_add(entry, item, count, ca, labels, label_count); 3338 display_add(entry, item, count, ca, labels, label_count);
3363 map_convert_free(labels[1]); 3348 map_convert_free(labels[1]);
3364 } 3349 }
3365 3350
3366 //workload++; 3351 //workload++;
3367 /* 3352 /*
3368 if (workload == displaylist->workload) 3353 if (workload == displaylist->workload)
3369 { 3354 {
3370 // restore order :-) 3355 // restore order :-)
3371 displaylist->order = saved; 3356 displaylist->order = saved;
3372 // reset value; 3357 // reset value;
3373 cancel_drawing_global = 0; 3358 cancel_drawing_global = 0;
3374 3359
3375 dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy); 3360 // dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy);
3376 displaylist->busy = 0; 3361 displaylist->busy = 0;
3377 3362
3378 dbg(0,"return 003\n"); 3363 // dbg(0,"return 003\n");
3379 return; 3364 return;
3380 } 3365 }
3381 */ 3366 */
3382 } // while item=map_rect_get_item 3367 } // while item=map_rect_get_item
3383 // ------ READ all items in this map rectangle --------- 3368 // ------ READ all items in this map rectangle ---------
3384 // ------ READ all items in this map rectangle --------- 3369 // ------ READ all items in this map rectangle ---------
3385 // ------ READ all items in this map rectangle --------- 3370 // ------ READ all items in this map rectangle ---------
3386 // ------ READ all items in this map rectangle --------- 3371 // ------ READ all items in this map rectangle ---------
3387 // ------ READ all items in this map rectangle --------- 3372 // ------ READ all items in this map rectangle ---------
3388 3373
3389 3374
3390 ////DBG dbg(0, "XXXXXYYYYYYY Draw: A.02\n"); 3375 ////DBG // dbg(0, "XXXXXYYYYYYY Draw: A.02\n");
3391 3376
3392 map_rect_destroy(displaylist->mr); 3377 map_rect_destroy(displaylist->mr);
3393 } 3378 }
3394 } 3379 }
3395 3380
3402 displaylist->sel = NULL; 3387 displaylist->sel = NULL;
3403 displaylist->m = NULL; 3388 displaylist->m = NULL;
3404 } // while ---- 3389 } // while ----
3405 3390
3406 3391
3392 // dbg(0, "DO__DRAW:%d load ready\n", rnd);
3407 3393
3408#ifdef NAVIT_MEASURE_TIME_DEBUG 3394#ifdef NAVIT_MEASURE_TIME_DEBUG
3409 debug_mrp("do_draw:load", debug_measure_end(s_)); 3395 debug_mrp("do_draw:load", debug_measure_end(s_));
3410#endif 3396#endif
3411 s_ = debug_measure_start(); 3397 s_ = debug_measure_start();
3412 3398
3413
3414 // remove the "wait" screen 3399 // remove the "wait" screen
3415#ifdef HAVE_API_ANDROID 3400 //#ifdef HAVE_API_ANDROID
3416 android_return_generic_int(2, 0); 3401 // android_return_generic_int(2, 0);
3417#endif 3402 //#endif
3418 3403
3419
3420 //DBG dbg(0, "XXXXXYYYYYYY Draw: 004\n"); 3404 //DBG // dbg(0, "XXXXXYYYYYYY Draw: 004\n");
3421 3405
3422 // reset value; 3406 // reset value;
3423 cancel_drawing_global = 0; 3407 // cancel_drawing_global = 0;
3424 3408
3425 // restore order :-) 3409 // restore order :-)
3426 displaylist->order = saved; 3410 displaylist->order = saved;
3427 3411
3428 // profile(1,"process_selection\n"); 3412 // profile(1,"process_selection\n");
3429 3413
3414
3430 if (displaylist->idle_ev) 3415 if (displaylist->idle_ev)
3431 { 3416 {
3432 event_remove_idle(displaylist->idle_ev); 3417 event_remove_idle(displaylist->idle_ev);
3433 }
3434
3435 displaylist->idle_ev = NULL; 3418 displaylist->idle_ev = NULL;
3419 }
3420
3421 if (displaylist->idle_cb)
3422 {
3436 callback_destroy(displaylist->idle_cb); 3423 callback_destroy(displaylist->idle_cb);
3437 displaylist->idle_cb = NULL; 3424 displaylist->idle_cb = NULL;
3425 }
3426
3438 //dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy); 3427 //// dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy);
3439 //displaylist->busy = 0; 3428 //displaylist->busy = 0;
3440 3429
3441 // graphics_process_selection(displaylist->dc.gra, displaylist); 3430 // graphics_process_selection(displaylist->dc.gra, displaylist);
3442 3431
3443 //profile(1, "draw\n"); 3432 //profile(1, "draw\n");
3444 3433
3445 //DBG dbg(0, "XXXXXYYYYYYY Draw: 005\n"); 3434 //DBG // dbg(0, "XXXXXYYYYYYY Draw: 005\n");
3446 3435
3447 if (!cancel) 3436 if (!cancel)
3448 { 3437 {
3449 int flags2 = flags; 3438 int flags2 = flags;
3450 if (!(flags2 & 2)) 3439 if (!(flags2 & 2))
3453 { 3442 {
3454 // dont clean bg of screen when drawing prerendered tiles 3443 // dont clean bg of screen when drawing prerendered tiles
3455 flags2 = flags2 + 2; 3444 flags2 = flags2 + 2;
3456 } 3445 }
3457 } 3446 }
3458 //DBG dbg(0,"call graphics_displaylist_draw 3") 3447 //DBG // dbg(0,"call graphics_displaylist_draw 3")
3459 //dbg(0,"# MT:002 #\n"); 3448 //// dbg(0,"# MT:002 #\n");
3449
3450 // stop drawing is requested
3451 if (cancel_drawing_global != 1)
3452 {
3460 graphics_displaylist_draw(displaylist->dc.gra, displaylist, displaylist->dc.trans, displaylist->layout, flags2); 3453 graphics_displaylist_draw(displaylist->dc.gra, displaylist, displaylist->dc.trans, displaylist->layout, flags2);
3454 }
3461 //dbg(0,"# MT:003 #\n"); 3455 //// dbg(0,"# MT:003 #\n");
3462 } 3456 }
3463 3457
3464#ifdef NAVIT_MEASURE_TIME_DEBUG 3458#ifdef NAVIT_MEASURE_TIME_DEBUG
3465 debug_mrp("do_draw:draw", debug_measure_end(s_)); 3459 debug_mrp("do_draw:draw", debug_measure_end(s_));
3466#endif 3460#endif
3467 3461
3462 // dbg(0, "DO__DRAW:%d draw ready\n", rnd);
3463
3468#ifdef HAVE_API_ANDROID 3464#ifdef HAVE_API_ANDROID
3469 if (cur_mapdraw_time_index < 11) 3465 if (cur_mapdraw_time_index < 11)
3470 { 3466 {
3471 mapdraw_time[cur_mapdraw_time_index] = debug_measure_end_tsecs(s_); 3467 mapdraw_time[cur_mapdraw_time_index] = debug_measure_end_tsecs(s_);
3472 // dbg(0,"maptime: %d\n", mapdraw_time[cur_mapdraw_time_index]); 3468 // // dbg(0,"maptime: %d\n", mapdraw_time[cur_mapdraw_time_index]);
3473 cur_mapdraw_time_index++; 3469 cur_mapdraw_time_index++;
3474 } 3470 }
3475 3471
3476 if (cur_mapdraw_time_index > 10) 3472 if (cur_mapdraw_time_index > 10)
3477 { 3473 {
3484 } 3480 }
3485 android_return_generic_int(6, (int)((float)mean_time / (float)10)); 3481 android_return_generic_int(6, (int)((float)mean_time / (float)10));
3486 } 3482 }
3487#endif 3483#endif
3488 3484
3489
3490 //dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy); 3485 //// dbg(0,"set:0:displaylist->busy=%d\n",displaylist->busy);
3491 displaylist->busy = 0; 3486 displaylist->busy = 0;
3492 3487
3493 //DBG dbg(0, "XXXXXYYYYYYY Draw: 006\n"); 3488 //DBG // dbg(0, "XXXXXYYYYYYY Draw: 006\n");
3494 3489
3495 map_rect_destroy(displaylist->mr); 3490 map_rect_destroy(displaylist->mr);
3496 if (!route_selection) 3491 if (!route_selection)
3497 { 3492 {
3498 map_selection_destroy(displaylist->sel); 3493 map_selection_destroy(displaylist->sel);
3500 mapset_close(displaylist->msh); 3495 mapset_close(displaylist->msh);
3501 displaylist->mr = NULL; 3496 displaylist->mr = NULL;
3502 displaylist->sel = NULL; 3497 displaylist->sel = NULL;
3503 displaylist->m = NULL; 3498 displaylist->m = NULL;
3504 displaylist->msh = NULL; 3499 displaylist->msh = NULL;
3500
3505 //profile(1, "callback\n"); 3501 //dbg(0, "callback\n");
3502
3503 // only some old crap need this!! ----------
3504 // only some old crap need this!! ----------
3506 callback_call_1(displaylist->cb, cancel); 3505 /// **** callback_call_1(displaylist->cb, cancel);
3507 //profile(0, "end\n"); 3506 // only some old crap need this!! ----------
3507 // only some old crap need this!! ----------
3508 3508
3509 //dbg(0,"leave\n"); 3509
3510 // dbg(0, "DO__DRAW:%d UN-lock mutex leave\n", rnd);
3511 pthread_mutex_unlock(&uiConditionMutex);
3512 // dbg(0, "DO__DRAW:%d OK UN-lock mutex leave\n", rnd);
3513
3514 // dbg(0, "DO__DRAW:%d cancel_drawing_global 99=%d\n", rnd, cancel_drawing_global);
3515
3516 if (cancel_drawing_global != 1)
3517 {
3518 // dummy "ready" signal ------------------------------------------
3519 // dbg(0, "DO__DRAW:%d dummy \"ready\" signal\n", rnd);
3520 // gra->meth.draw_lines4(displaylist->dc.gra, NULL, NULL, NULL, 1, 1, 99);
3521#ifdef HAVE_API_ANDROID
3522 android_return_generic_int(2, 2);
3523#endif
3524 // dummy "ready" signal ------------------------------------------
3525 }
3526 else
3527 {
3528 // dummy "cancel" signal ------------------------------------------
3529 // dbg(0, "DO__DRAW:%d dummy \"cancel\" signal\n", rnd);
3530 //gra->meth.draw_lines4(displaylist->dc.gra, NULL, NULL, NULL, 1, 1, 95);
3531#ifdef HAVE_API_ANDROID
3532 android_return_generic_int(2, 3);
3533#endif
3534 // dummy "ready" signal ------------------------------------------
3535 }
3536
3537 // dbg(0, "DO__DRAW:%d leave\n", rnd);
3538 // dbg(0, "DO__DRAW:%d __\n", rnd);
3510 3539
3511#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3540#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3512 dbg(0,"+#+:leave\n"); 3541 // dbg(0,"+#+:leave\n");
3513#endif 3542#endif
3514 3543
3515} 3544}
3516 3545
3517/** 3546/**
3521 * @author Martin Schaller (04/2008) 3550 * @author Martin Schaller (04/2008)
3522 */ 3551 */
3523void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int flags) 3552void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int flags)
3524{ 3553{
3525#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3554#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3526 dbg(0,"+#+:enter\n"); 3555 // dbg(0,"+#+:enter\n");
3527#endif 3556#endif
3528 3557
3529 // dbg(0,"ooo enter ooo flags=%d\n", flags); 3558 // // dbg(0,"ooo enter ooo flags=%d\n", flags);
3559
3530 3560
3531 int order = transform_get_order(trans); 3561 int order = transform_get_order(trans);
3532 displaylist->dc.trans = trans; 3562 displaylist->dc.trans = trans;
3533 displaylist->dc.gra = gra; 3563 displaylist->dc.gra = gra;
3534
3535 3564
3536 // *********DISABLED******* 3565 // *********DISABLED*******
3537 // *********DISABLED******* 3566 // *********DISABLED*******
3538 // *********DISABLED******* 3567 // *********DISABLED*******
3539 // set min. distanct of 2 points on line at which a point will be left out when zoomed out too much!! 3568 // set min. distanct of 2 points on line at which a point will be left out when zoomed out too much!!
3540 // *********DISABLED******* displaylist->dc.mindist = transform_get_scale(trans) / 2; 3569 // *********DISABLED******* displaylist->dc.mindist = transform_get_scale(trans) / 2;
3541 //dbg(0,"mindist would be:%d\n", (int)(transform_get_scale(trans) / 2)); 3570 //// dbg(0,"mindist would be:%d\n", (int)(transform_get_scale(trans) / 2));
3542 displaylist->dc.mindist = 0; 3571 displaylist->dc.mindist = 0;
3543 if (order < 13) 3572 if (order < 13)
3544 { 3573 {
3545 displaylist->dc.mindist = transform_get_scale(trans); 3574 displaylist->dc.mindist = transform_get_scale(trans);
3546 } 3575 }
3547 // *********DISABLED******* 3576 // *********DISABLED*******
3548 // *********DISABLED******* 3577 // *********DISABLED*******
3549 // *********DISABLED******* 3578 // *********DISABLED*******
3550 3579
3551 3580
3552
3553 // FIXME find a better place to set the background color 3581 // FIXME find a better place to set the background color
3554 if (l) 3582 if (l)
3555 { 3583 {
3556 graphics_gc_set_background(gra->gc[0], &l->color); 3584 graphics_gc_set_background(gra->gc[0], &l->color);
3557 graphics_gc_set_foreground(gra->gc[0], &l->color); 3585 graphics_gc_set_foreground(gra->gc[0], &l->color);
3565 } 3593 }
3566 gra->meth.draw_mode(gra->priv, (flags & 8) ? draw_mode_begin_clear : draw_mode_begin); 3594 gra->meth.draw_mode(gra->priv, (flags & 8) ? draw_mode_begin_clear : draw_mode_begin);
3567 if (!(flags & 2)) 3595 if (!(flags & 2))
3568 { 3596 {
3569 // clear the gfx object pipeline ------------------------------ 3597 // clear the gfx object pipeline ------------------------------
3570 dbg(0,"clear the gfx object pipeline\n"); 3598 // // dbg(0, "clear the gfx object pipeline\n");
3571 gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 98); 3599 // gra->meth.draw_lines4(gra->priv, NULL, NULL, NULL, 1, 1, 98);
3572 3600
3573 // clear the display/screen/whatever here 3601 // clear the display/screen/whatever here
3602 // dbg(0, "clear the screen: rectangle=%d,%d - %d,%d\n", gra->r.lu.x, gra->r.lu.y, gra->r.rl.x, gra->r.rl.y);
3574 gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &gra->r.lu, gra->r.rl.x - gra->r.lu.x, gra->r.rl.y - gra->r.lu.y); 3603 gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &gra->r.lu, gra->r.rl.x - gra->r.lu.x, gra->r.rl.y - gra->r.lu.y);
3575 } 3604 }
3576 if (l) 3605 if (l)
3577 { 3606 {
3578 // draw the mapitems 3607 // draw the mapitems
3579 // dbg(0,"o , l->d = %d , %d\n",order,l->order_delta); 3608 // // dbg(0,"o , l->d = %d , %d\n",order,l->order_delta);
3580 xdisplay_draw(displaylist, gra, l, order + l->order_delta); 3609 xdisplay_draw(displaylist, gra, l, order + l->order_delta);
3581 } 3610 }
3582 if (flags & 1) 3611 if (flags & 1)
3583 { 3612 {
3584 callback_list_call_attr_0(gra->cbl, attr_postdraw); 3613 callback_list_call_attr_0(gra->cbl, attr_postdraw);
3587 { 3616 {
3588 gra->meth.draw_mode(gra->priv, draw_mode_end); 3617 gra->meth.draw_mode(gra->priv, draw_mode_end);
3589 } 3618 }
3590 3619
3591#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 3620#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
3592 dbg(0,"+#+:leave\n"); 3621 // dbg(0,"+#+:leave\n");
3593#endif 3622#endif
3594 3623
3595} 3624}
3596 3625
3597static void graphics_load_mapset(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags) 3626static void graphics_load_mapset(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags)
3598{ 3627{
3628 // dbg(0, "DO__DRAW:gl_ms enter\n");
3629
3599 int order = transform_get_order(trans); 3630 int order = transform_get_order(trans);
3600 3631
3601 //dbg(0,"enter displaylist->busy=%d\n",displaylist->busy); 3632 //// dbg(0,"enter displaylist->busy=%d\n",displaylist->busy);
3602 //dbg(0,"async=%d\n",async); 3633 //// dbg(0,"async=%d\n",async);
3603 if (displaylist->busy) 3634 if (displaylist->busy)
3604 { 3635 {
3605 if (async == 1) 3636 if (async == 1)
3606 { 3637 {
3607 //dbg(0,"**draw 1.a\n"); 3638 //// dbg(0,"**draw 1.a\n");
3639 // dbg(0, "DO__DRAW:gl_ms return 001\n");
3608 return; 3640 return;
3609 } 3641 }
3610 ///dbg(0,"**draw 1\n"); 3642 ///// dbg(0,"**draw 1\n");
3643 // dbg(0, "DO__DRAW:gl_ms return 002\n");
3611 return; 3644 return;
3612 //do_draw(displaylist, 1, flags); 3645 //do_draw(displaylist, 1, flags);
3613 } 3646 }
3614 xdisplay_free(displaylist); 3647 xdisplay_free(displaylist);
3615 3648
3623 if (l) 3656 if (l)
3624 { 3657 {
3625 order += l->order_delta; 3658 order += l->order_delta;
3626 } 3659 }
3627 displaylist->order = order; 3660 displaylist->order = order;
3628 //dbg(0,"set:1:displaylist->busy=%d\n",displaylist->busy); 3661 //// dbg(0,"set:1:displaylist->busy=%d\n",displaylist->busy);
3629 displaylist->busy = 1; 3662 displaylist->busy = 1;
3630 displaylist->layout = l; 3663 displaylist->layout = l;
3631 3664
3632
3633// ---------- DISABLED ------ no more async!! 3665 // ---------- DISABLED ------ no more async!!
3634/* 3666 /*
3667 if (async)
3668 {
3669 //DBG // dbg(0,"§§async");
3670 if (!displaylist->idle_cb)
3671 {
3672 //DBG // dbg(0,"§§async --> callback");
3673 displaylist->idle_cb = callback_new_3(callback_cast(do_draw), displaylist, 0, flags);
3674 }
3675 //DBG // dbg(0,"§§async --> add idle");
3676 displaylist->idle_ev = event_add_idle(50, displaylist->idle_cb);
3677 }
3678 else
3679 {
3680 //DBG // dbg(0,"@@sync");
3681 do_draw(displaylist, 0, flags);
3682 }
3683 */
3684
3635 if (async) 3685 if (async)
3636 { 3686 {
3637 //DBG dbg(0,"§§async");
3638 if (!displaylist->idle_cb) 3687 if (!displaylist->idle_cb)
3639 { 3688 {
3640 //DBG dbg(0,"§§async --> callback"); 3689 //dbg(0,"**draw 2.b1\n");
3641 displaylist->idle_cb = callback_new_3(callback_cast(do_draw), displaylist, 0, flags); 3690 displaylist->idle_cb = callback_new_3(callback_cast(do_draw), displaylist, 0, flags);
3691 callback_add_names(displaylist->idle_cb, "graphics_load_mapset", "do_draw");
3692 //// dbg(0,"**draw 2.b2\n");
3642 } 3693 }
3643 //DBG dbg(0,"§§async --> add idle"); 3694 //dbg(0,"**draw 2.b3\n");
3695 //dbg(0, "DO__DRAW:call 003 (async callback)\n");
3644 displaylist->idle_ev = event_add_idle(50, displaylist->idle_cb); 3696 displaylist->idle_ev = event_add_idle(1000, displaylist->idle_cb);
3697 // dbg(0, "**draw 2.b4 %p\n", displaylist->idle_ev);
3645 } 3698 }
3646 else 3699 else
3647 { 3700 {
3648 //DBG dbg(0,"@@sync"); 3701 //// dbg(0,"**draw 2.b5\n");
3702 // dbg(0, "DO__DRAW:call 001\n");
3649 do_draw(displaylist, 0, flags); 3703 do_draw(displaylist, 0, flags);
3650 } 3704 }
3651*/
3652 3705
3653 3706 // dbg(0, "DO__DRAW:gl_ms leave\n");
3654 if (async)
3655 {
3656 if (! displaylist->idle_cb)
3657 {
3658 //dbg(0,"**draw 2.b1\n");
3659 displaylist->idle_cb=callback_new_3(callback_cast(do_draw), displaylist, 0, flags);
3660 //dbg(0,"**draw 2.b2\n");
3661 }
3662 //dbg(0,"**draw 2.b3\n");
3663 displaylist->idle_ev = event_add_idle(1000, displaylist->idle_cb);
3664 dbg(0,"**draw 2.b4 %p\n", displaylist->idle_ev);
3665 }
3666 else
3667 {
3668 //dbg(0,"**draw 2.b5\n");
3669 do_draw(displaylist, 0, flags);
3670 }
3671} 3707}
3672 3708
3673/** 3709/**
3674 * FIXME 3710 * FIXME
3675 * @param <> 3711 * @param <>
3676 * @returns <> 3712 * @returns <>
3677 * @author Martin Schaller (04/2008) 3713 * @author Martin Schaller (04/2008)
3678 */ 3714 */
3679void graphics_draw(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags) 3715void graphics_draw(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb, int flags)
3680{ 3716{
3681 //dbg(0,"ooo enter ooo\n"); 3717 //// dbg(0,"ooo enter ooo\n");
3682 3718
3719 // dbg(0, "DO__DRAW:gras_draw enter\n");
3683 graphics_load_mapset(gra, displaylist, mapset, trans, l, async, cb, flags); 3720 graphics_load_mapset(gra, displaylist, mapset, trans, l, async, cb, flags);
3721 // dbg(0, "DO__DRAW:gras_draw leave\n");
3684} 3722}
3685 3723
3686int graphics_draw_cancel(struct graphics *gra, struct displaylist *displaylist) 3724int graphics_draw_cancel(struct graphics *gra, struct displaylist *displaylist)
3687{ 3725{
3688 //DBG dbg(0,"ooo enter ooo\n"); 3726 //DBG // dbg(0,"ooo enter ooo\n");
3689 3727
3690 if (!displaylist->busy) 3728 if (!displaylist->busy)
3729 {
3691 return 0; 3730 return 0;
3731 }
3732 // dbg(0, "DO__DRAW:call 002\n");
3692 do_draw(displaylist, 1, 0); 3733 do_draw(displaylist, 1, 0);
3693 return 1; 3734 return 1;
3694} 3735}
3695 3736
3696/** 3737/**

Legend:
Removed from v.29  
changed lines
  Added in v.30

   
Visit the ZANavi Wiki