comparison src/redraw_man.c @ 873:881efcd8a18f abs_n_rel_center

Merge from default branch
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 24 Sep 2010 16:06:42 +0800
parents 85f22a771e4a 4f8d53be9488
children a17c4e231e54
comparison
equal deleted inserted replaced
862:3ce9daa9558b 873:881efcd8a18f
642 static void mouse_event_root_dummy(event_t *evt, void *arg) { 642 static void mouse_event_root_dummy(event_t *evt, void *arg) {
643 } 643 }
644 644
645 int redraw_man_init(redraw_man_t *rdman, mbe_t *cr, mbe_t *backend) { 645 int redraw_man_init(redraw_man_t *rdman, mbe_t *cr, mbe_t *backend) {
646 extern void redraw_man_destroy(redraw_man_t *rdman); 646 extern void redraw_man_destroy(redraw_man_t *rdman);
647 extern int _sh_path_size;
648 extern int _sh_rect_size;
647 extern int _paint_color_size; 649 extern int _paint_color_size;
650 extern int _paint_linear_size;
651 extern int _paint_radial_size;
652 extern int _paint_image_size;
648 observer_t *addrm_ob; 653 observer_t *addrm_ob;
649 extern void addrm_monitor_hdlr(event_t *evt, void *arg); 654 extern void addrm_monitor_hdlr(event_t *evt, void *arg);
650 655
651 memset(rdman, 0, sizeof(redraw_man_t)); 656 memset(rdman, 0, sizeof(redraw_man_t));
652 657
656 DARRAY_INIT(&rdman->zeroing_coords); 661 DARRAY_INIT(&rdman->zeroing_coords);
657 662
658 rdman->geo_pool = elmpool_new(sizeof(geo_t), 128); 663 rdman->geo_pool = elmpool_new(sizeof(geo_t), 128);
659 rdman->coord_pool = elmpool_new(sizeof(coord_t), 16); 664 rdman->coord_pool = elmpool_new(sizeof(coord_t), 16);
660 rdman->shnode_pool = elmpool_new(sizeof(shnode_t), 16); 665 rdman->shnode_pool = elmpool_new(sizeof(shnode_t), 16);
666 rdman->sh_path_pool = elmpool_new(_sh_path_size, 16);
667 rdman->sh_rect_pool = elmpool_new(_sh_rect_size, 16);
661 rdman->observer_pool = elmpool_new(sizeof(observer_t), 32); 668 rdman->observer_pool = elmpool_new(sizeof(observer_t), 32);
662 rdman->subject_pool = elmpool_new(sizeof(subject_t), 32); 669 rdman->subject_pool = elmpool_new(sizeof(subject_t), 32);
663 rdman->paint_color_pool = elmpool_new(_paint_color_size, 64); 670 rdman->paint_color_pool = elmpool_new(_paint_color_size, 64);
671 rdman->paint_linear_pool = elmpool_new(_paint_linear_size, 64);
672 rdman->paint_radial_pool = elmpool_new(_paint_radial_size, 64);
673 rdman->paint_image_pool = elmpool_new(_paint_image_size, 64);
664 rdman->pent_pool = elmpool_new(sizeof(mb_prop_entry_t), 128); 674 rdman->pent_pool = elmpool_new(sizeof(mb_prop_entry_t), 128);
665 rdman->coord_canvas_pool = elmpool_new(sizeof(coord_canvas_info_t), 16); 675 rdman->coord_canvas_pool = elmpool_new(sizeof(coord_canvas_info_t), 16);
666 if(!(rdman->geo_pool && rdman->coord_pool && rdman->shnode_pool && 676 if(!(rdman->geo_pool && rdman->coord_pool && rdman->shnode_pool &&
667 rdman->observer_pool && rdman->subject_pool && 677 rdman->observer_pool && rdman->subject_pool &&
668 rdman->paint_color_pool && rdman->coord_canvas_pool)) 678 rdman->paint_color_pool && rdman->coord_canvas_pool))
723 elmpool_free(rdman->geo_pool); 733 elmpool_free(rdman->geo_pool);
724 if(rdman->coord_pool) 734 if(rdman->coord_pool)
725 elmpool_free(rdman->coord_pool); 735 elmpool_free(rdman->coord_pool);
726 if(rdman->shnode_pool) 736 if(rdman->shnode_pool)
727 elmpool_free(rdman->shnode_pool); 737 elmpool_free(rdman->shnode_pool);
738 if(rdman->sh_path_pool)
739 elmpool_free(rdman->sh_path_pool);
740 if(rdman->sh_rect_pool)
741 elmpool_free(rdman->sh_rect_pool);
728 if(rdman->observer_pool) 742 if(rdman->observer_pool)
729 elmpool_free(rdman->observer_pool); 743 elmpool_free(rdman->observer_pool);
730 if(rdman->subject_pool) 744 if(rdman->subject_pool)
731 elmpool_free(rdman->subject_pool); 745 elmpool_free(rdman->subject_pool);
732 if(rdman->paint_color_pool) 746 if(rdman->paint_color_pool)
733 elmpool_free(rdman->paint_color_pool); 747 elmpool_free(rdman->paint_color_pool);
748 if(rdman->paint_linear_pool)
749 elmpool_free(rdman->paint_linear_pool);
750 if(rdman->paint_radial_pool)
751 elmpool_free(rdman->paint_radial_pool);
752 if(rdman->paint_image_pool)
753 elmpool_free(rdman->paint_image_pool);
734 if(rdman->pent_pool) 754 if(rdman->pent_pool)
735 elmpool_free(rdman->pent_pool); 755 elmpool_free(rdman->pent_pool);
736 if(rdman->coord_canvas_pool) 756 if(rdman->coord_canvas_pool)
737 elmpool_free(rdman->coord_canvas_pool); 757 elmpool_free(rdman->coord_canvas_pool);
738 DARRAY_DESTROY(&rdman->dirty_coords); 758 DARRAY_DESTROY(&rdman->dirty_coords);
782 */ 802 */
783 803
784 elmpool_free(rdman->coord_pool); 804 elmpool_free(rdman->coord_pool);
785 elmpool_free(rdman->geo_pool); 805 elmpool_free(rdman->geo_pool);
786 elmpool_free(rdman->shnode_pool); 806 elmpool_free(rdman->shnode_pool);
807 elmpool_free(rdman->sh_path_pool);
808 elmpool_free(rdman->sh_rect_pool);
787 elmpool_free(rdman->observer_pool); 809 elmpool_free(rdman->observer_pool);
788 elmpool_free(rdman->subject_pool); 810 elmpool_free(rdman->subject_pool);
789 elmpool_free(rdman->paint_color_pool); 811 elmpool_free(rdman->paint_color_pool);
812 elmpool_free(rdman->paint_linear_pool);
813 elmpool_free(rdman->paint_radial_pool);
814 elmpool_free(rdman->paint_image_pool);
790 elmpool_free(rdman->pent_pool); 815 elmpool_free(rdman->pent_pool);
791 elmpool_free(rdman->coord_canvas_pool); 816 elmpool_free(rdman->coord_canvas_pool);
792 817
793 DARRAY_DESTROY(&rdman->dirty_coords); 818 DARRAY_DESTROY(&rdman->dirty_coords);
794 DARRAY_DESTROY(&rdman->dirty_geos); 819 DARRAY_DESTROY(&rdman->dirty_geos);
1366 1391
1367 /*! \brief Compute area of a coord. 1392 /*! \brief Compute area of a coord.
1368 */ 1393 */
1369 static int 1394 static int
1370 compute_area(coord_t *coord) { 1395 compute_area(coord_t *coord) {
1371 static co_aix (*poses)[2]; 1396 static co_aix (*poses)[2] = NULL;
1372 static int max_poses = 0; 1397 static int max_poses = 0;
1373 geo_t *geo; 1398 geo_t *geo;
1374 int cnt, pos_cnt; 1399 int cnt, pos_cnt;
1375 1400
1376 cnt = 0; 1401 cnt = 0;
1377 FORMEMBERS(coord, geo) { 1402 FORMEMBERS(coord, geo) {
1378 cnt++; 1403 cnt++;
1379 } 1404 }
1380 1405
1381 if(max_poses < (cnt * 2)) { 1406 if(max_poses < (cnt * 2)) {
1382 free(poses); 1407 if(poses)
1408 free(poses);
1383 max_poses = cnt * 2; 1409 max_poses = cnt * 2;
1384 poses = (co_aix (*)[2])malloc(sizeof(co_aix [2]) * max_poses); 1410 poses = (co_aix (*)[2])malloc(sizeof(co_aix [2]) * max_poses);
1385 if(poses == NULL) 1411 if(poses == NULL)
1386 return ERR; 1412 return ERR;
1387 } 1413 }