comparison src/redraw_man.c @ 539:ce11e889ea4e Android_Skia

Simplify dirty area for coords that should be totally redraw
author Thinker K.F. Li <thinker@branda.to>
date Mon, 24 May 2010 16:27:25 +0800
parents a1d49b6355c3
children 43b26ac2f69b
comparison
equal deleted inserted replaced
538:a1d49b6355c3 539:ce11e889ea4e
1987 r = add_rdman_aggr_dirty_areas(rdman); 1987 r = add_rdman_aggr_dirty_areas(rdman);
1988 if(r != OK) 1988 if(r != OK)
1989 return ERR; 1989 return ERR;
1990 1990
1991 /* 1991 /*
1992 * Clear all flags setted by this function 1992 * Clear all flags setted by zeroing.
1993 */ 1993 */
1994 coords = rdman->dirty_coords.ds; 1994 coords = rdman->dirty_coords.ds;
1995 for(i = 0; i < rdman->dirty_coords.num; i++) 1995 for(i = 0; i < rdman->dirty_coords.num; i++)
1996 coord_clear_flags(coords[i], COF_JUST_CLEAN); 1996 coord_clear_flags(coords[i], COF_JUST_CLEAN);
1997 coords = rdman->zeroing_coords.ds; 1997 coords = rdman->zeroing_coords.ds;
2214 } 2214 }
2215 2215
2216 static int draw_dirty_cached_coord(redraw_man_t *rdman, 2216 static int draw_dirty_cached_coord(redraw_man_t *rdman,
2217 coord_t *coord) { 2217 coord_t *coord) {
2218 area_t **areas, *area; 2218 area_t **areas, *area;
2219 area_t full_area;
2219 int n_areas; 2220 int n_areas;
2220 mbe_t *canvas; 2221 mbe_t *canvas;
2222 mbe_surface_t *surface;
2221 int i; 2223 int i;
2222 int r; 2224 int r;
2223 2225
2226 canvas = _coord_get_canvas(coord);
2227
2228 if(IS_CACHE_REDRAW_ALL(coord)) {
2229 /*
2230 * full_area covers all dirty areas of the cached coord.
2231 */
2232 DARRAY_CLEAN(_coord_get_dirty_areas(coord));
2233 surface = mbe_get_target(canvas);
2234 full_area.x = 0;
2235 full_area.y = 0;
2236 full_area.w = mbe_image_surface_get_width(surface);
2237 full_area.h = mbe_image_surface_get_height(surface);
2238 add_dirty_area(rdman, coord, &full_area);
2239 }
2240
2224 areas = _coord_get_dirty_areas(coord)->ds; 2241 areas = _coord_get_dirty_areas(coord)->ds;
2225 n_areas = _coord_get_dirty_areas(coord)->num; 2242 n_areas = _coord_get_dirty_areas(coord)->num;
2226 2243
2227 for(i = 0; i < n_areas; i++) { 2244 for(i = 0; i < n_areas; i++) {
2228 area = areas[i]; 2245 area = areas[i];
2230 area->y = floorf(area->y); 2247 area->y = floorf(area->y);
2231 area->w = ceilf(area->w); 2248 area->w = ceilf(area->w);
2232 area->h = ceilf(area->h); 2249 area->h = ceilf(area->h);
2233 } 2250 }
2234 2251
2235 canvas = _coord_get_canvas(coord);
2236 make_clip(canvas, n_areas, areas); 2252 make_clip(canvas, n_areas, areas);
2237 clear_canvas(canvas); 2253 clear_canvas(canvas);
2238 2254
2239 r = draw_coord_shapes_in_dirty_areas(rdman, coord); 2255 r = draw_coord_shapes_in_dirty_areas(rdman, coord);
2240 2256
2249 coord_t *coord; 2265 coord_t *coord;
2250 int i; 2266 int i;
2251 2267
2252 zeroings = rdman->zeroing_coords.ds; 2268 zeroings = rdman->zeroing_coords.ds;
2253 num = rdman->zeroing_coords.num; 2269 num = rdman->zeroing_coords.num;
2270 /* Draw cached ones from leaves to root.
2271 * Since content of cached ones depend on descendants.
2272 */
2254 for(i = num - 1; i >= 0; i--) { 2273 for(i = num - 1; i >= 0; i--) {
2255 coord = zeroings[i]; 2274 coord = zeroings[i];
2275 if(coord_get_flags(coord, COF_TEMP_MARK))
2276 continue;
2256 draw_dirty_cached_coord(rdman, coord); 2277 draw_dirty_cached_coord(rdman, coord);
2257 } 2278 coord_set_flags(coord, COF_TEMP_MARK);
2279 }
2280 for(i = 0; i < num; i++)
2281 coord_clear_flags(coord, COF_TEMP_MARK);
2258 2282
2259 draw_dirty_cached_coord(rdman, rdman->root_coord); 2283 draw_dirty_cached_coord(rdman, rdman->root_coord);
2260 } 2284 }
2261 2285
2262 2286
2318 coord = rdman->zeroing_coords.ds[i]; 2342 coord = rdman->zeroing_coords.ds[i];
2319 DARRAY_CLEAN(_coord_get_dirty_areas(coord)); 2343 DARRAY_CLEAN(_coord_get_dirty_areas(coord));
2320 } 2344 }
2321 DARRAY_CLEAN(_coord_get_dirty_areas(rdman->root_coord)); 2345 DARRAY_CLEAN(_coord_get_dirty_areas(rdman->root_coord));
2322 rdman->n_dirty_areas = 0; 2346 rdman->n_dirty_areas = 0;
2323 }
2324
2325 /* clear COF_MUST_ZEROING flag for coords */
2326 coords = rdman->zeroing_coords.ds;
2327 for(i = 0; i < rdman->zeroing_coords.num; i++) {
2328 coord = coords[i];
2329 coord_clear_flags(coord, COF_MUST_ZEROING);
2330 } 2347 }
2331 2348
2332 DARRAY_CLEAN(&rdman->dirty_coords); 2349 DARRAY_CLEAN(&rdman->dirty_coords);
2333 DARRAY_CLEAN(&rdman->dirty_geos); 2350 DARRAY_CLEAN(&rdman->dirty_geos);
2334 DARRAY_CLEAN(&rdman->zeroing_coords); 2351 DARRAY_CLEAN(&rdman->zeroing_coords);