comparison src/redraw_man.c @ 317:d0f8642d3508

Fix bug that images are lost after hidden & expose window. - It caused by forgeting to clear paths before setting paths for clipping.
author Thinker K.F. Li <thinker@branda.to>
date Thu, 05 Mar 2009 02:20:58 +0800
parents 6c350fc92ae3
children c1afd14caa85
comparison
equal deleted inserted replaced
316:535731374dfb 317:d0f8642d3508
1515 1515
1516 #ifndef UNITTEST 1516 #ifndef UNITTEST
1517 static void clear_canvas(canvas_t *canvas) { 1517 static void clear_canvas(canvas_t *canvas) {
1518 cairo_operator_t old_op; 1518 cairo_operator_t old_op;
1519 1519
1520 #if 1
1521 old_op = cairo_get_operator(canvas); 1520 old_op = cairo_get_operator(canvas);
1522 cairo_set_operator(canvas, CAIRO_OPERATOR_CLEAR); 1521 cairo_set_operator(canvas, CAIRO_OPERATOR_CLEAR);
1523 cairo_paint(canvas); 1522 cairo_paint(canvas);
1524 cairo_set_operator(canvas, old_op); 1523 cairo_set_operator(canvas, old_op);
1525 #else
1526 cairo_set_source_rgba(canvas, 0, 0, 0, 0);
1527 cairo_paint(canvas);
1528 #endif
1529 } 1524 }
1530 1525
1531 static void clean_canvas(cairo_t *cr, co_aix w, co_aix h) { 1526 static void clean_canvas(cairo_t *cr, co_aix w, co_aix h) {
1532 cairo_operator_t saved_op; 1527 cairo_operator_t saved_op;
1533 1528
1558 static void make_clip(cairo_t *cr, int n_dirty_areas, 1553 static void make_clip(cairo_t *cr, int n_dirty_areas,
1559 area_t **dirty_areas) { 1554 area_t **dirty_areas) {
1560 int i; 1555 int i;
1561 area_t *area; 1556 area_t *area;
1562 1557
1558 cairo_new_path(cr);
1563 for(i = 0; i < n_dirty_areas; i++) { 1559 for(i = 0; i < n_dirty_areas; i++) {
1564 area = dirty_areas[i]; 1560 area = dirty_areas[i];
1565 cairo_rectangle(cr, area->x, area->y, area->w, area->h); 1561 cairo_rectangle(cr, area->x, area->y, area->w, area->h);
1566 } 1562 }
1567 cairo_clip(cr); 1563 cairo_clip(cr);