97 |
/* Lock for the list above. */ |
/* Lock for the list above. */ |
98 |
pthread_mutex_t all_layers_lock = PTHREAD_MUTEX_INITIALIZER; |
pthread_mutex_t all_layers_lock = PTHREAD_MUTEX_INITIALIZER; |
99 |
|
|
100 |
|
void |
101 |
|
lock_all_layers (void) |
102 |
|
{ |
103 |
|
pthread_mutex_lock (&all_layers_lock); |
104 |
|
} |
105 |
|
|
106 |
|
void |
107 |
|
unlock_all_layers (void) |
108 |
|
{ |
109 |
|
pthread_mutex_unlock (&all_layers_lock); |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
/* Insert LAYER into the list of all layers. We insert it at the |
/* Insert LAYER into the list of all layers. We insert it at the |
114 |
front. The list should be locked when this is called. */ |
front. The list should be locked when this is called. */ |
115 |
static __inline__ void |
static __inline__ void |
339 |
|
|
340 |
if (surface->map_count || surface->opaque == 0.0) |
if (surface->map_count || surface->opaque == 0.0) |
341 |
continue; |
continue; |
342 |
|
|
343 |
if (x >= (layer->absolute_x + surface->x + surface->width) |
if (x >= (layer->absolute_x + surface->x + surface->width) |
344 |
|| y >= (layer->absolute_y + surface->y + surface->height) |
|| y >= (layer->absolute_y + surface->y + surface->height) |
345 |
|| (x + width) < (layer->absolute_x + surface->x) |
|| (x + width) < (layer->absolute_x + surface->x) |
441 |
sud->region.height |
sud->region.height |
442 |
}; |
}; |
443 |
struct surface *surface = sud->surface; |
struct surface *surface = sud->surface; |
444 |
|
struct powder_state *target_state; |
445 |
|
|
446 |
|
target_state = flag_nodoublebuffering ? display_state : screen_state; |
447 |
|
|
448 |
|
powder_state_set_src_surface (target_state, surface->surface); |
449 |
|
|
|
powder_state_set_src_surface (screen_state, surface->surface); |
|
|
powder_state_set_dst_surface (screen_state, screen_surface); |
|
450 |
|
|
451 |
/* Do clipping against screen. */ |
/* Do clipping against screen. */ |
452 |
if (sud->region.px + rect.w > crust_current_mode->hdisplay) |
if (sud->region.px + rect.w > crust_current_mode->hdisplay) |
461 |
|
|
462 |
if (ignore_alpha) |
if (ignore_alpha) |
463 |
{ |
{ |
464 |
powder_state_set_blitting_flags (screen_state, TARGET_BLIT_NONE); |
powder_state_set_blitting_flags (target_state, TARGET_BLIT_NONE); |
465 |
} |
} |
466 |
else |
else |
467 |
{ |
{ |
468 |
if (surface->opaque != 1.0) |
if (surface->opaque != 1.0) |
469 |
{ |
{ |
470 |
powder_state_set_argb (screen_state, MAX_255 ((int) (surface->opaque * 255)), |
powder_state_set_argb (target_state, MAX_255 ((int) (surface->opaque * 255)), |
471 |
0, 0, 0); |
0, 0, 0); |
472 |
powder_state_set_blitting_flags (screen_state, TARGET_BLIT_BLEND_COLORALPHA |
powder_state_set_blitting_flags (target_state, TARGET_BLIT_BLEND_COLORALPHA |
473 |
| TARGET_BLIT_BLEND_ALPHACHANNEL); |
| TARGET_BLIT_BLEND_ALPHACHANNEL); |
474 |
|
|
475 |
powder_state_set_src_bfn (screen_state, TARGET_BLEND_FN_SRCALPHA); |
powder_state_set_src_bfn (target_state, TARGET_BLEND_FN_SRCALPHA); |
476 |
powder_state_set_dst_bfn (screen_state, TARGET_BLEND_FN_INVSRCALPHA); |
powder_state_set_dst_bfn (target_state, TARGET_BLEND_FN_INVSRCALPHA); |
477 |
} |
} |
478 |
else |
else |
479 |
{ |
{ |
480 |
if (surface->surface->format == SURFACE_PFMT_ARGB) |
if (surface->surface->format == SURFACE_PFMT_ARGB) |
481 |
{ |
{ |
482 |
powder_state_set_blitting_flags (screen_state, TARGET_BLIT_BLEND_ALPHACHANNEL); |
powder_state_set_blitting_flags (target_state, TARGET_BLIT_BLEND_ALPHACHANNEL); |
483 |
|
|
484 |
powder_state_set_src_bfn (screen_state, TARGET_BLEND_FN_SRCALPHA); |
powder_state_set_src_bfn (target_state, TARGET_BLEND_FN_SRCALPHA); |
485 |
powder_state_set_dst_bfn (screen_state, TARGET_BLEND_FN_INVSRCALPHA); |
powder_state_set_dst_bfn (target_state, TARGET_BLEND_FN_INVSRCALPHA); |
486 |
} |
} |
487 |
else |
else |
488 |
powder_state_set_blitting_flags (screen_state, TARGET_BLIT_NONE); |
powder_state_set_blitting_flags (target_state, TARGET_BLIT_NONE); |
489 |
|
|
490 |
} |
} |
491 |
} |
} |
492 |
powder_blit (crust_powder_target, screen_state, &rect, sud->region.px, |
powder_blit (crust_powder_target, target_state, &rect, sud->region.px, |
493 |
sud->region.py); |
sud->region.py); |
494 |
} |
} |
495 |
|
|
520 |
for (i = shortcut_index; i < n_surfaces; i++) |
for (i = shortcut_index; i < n_surfaces; i++) |
521 |
paint_surface (&update_array [i], i ? false : true); |
paint_surface (&update_array [i], i ? false : true); |
522 |
|
|
523 |
if (flush) |
if (flush && ! flag_nodoublebuffering ) |
524 |
flush_region (x, y, width, height); |
flush_region (x, y, width, height); |
525 |
} |
} |
526 |
|
|
709 |
move_layer (struct layer *layer, int x, int y) |
move_layer (struct layer *layer, int x, int y) |
710 |
{ |
{ |
711 |
int current_x, current_y; |
int current_x, current_y; |
712 |
|
int rx = layer->absolute_x; |
713 |
|
int ry = layer->absolute_y; |
714 |
|
int rw = layer->width; |
715 |
|
int rh = layer->height; |
716 |
|
int dx = x - rx; |
717 |
|
int dy = y - ry; |
718 |
|
|
719 |
pthread_mutex_lock (&all_layers_lock); |
pthread_mutex_lock (&all_layers_lock); |
720 |
|
|
731 |
|
|
732 |
if (layer->map_count == 0) |
if (layer->map_count == 0) |
733 |
{ |
{ |
734 |
|
#if 1 |
735 |
|
if (dx > 0) |
736 |
|
rw += dx; |
737 |
|
else if (dx < 0) |
738 |
|
{ |
739 |
|
rw -= dx; |
740 |
|
rx += dx; |
741 |
|
} |
742 |
|
|
743 |
|
if (dy > 0) |
744 |
|
rh += dy; |
745 |
|
else if (dy < 0) |
746 |
|
{ |
747 |
|
rh -= dy; |
748 |
|
ry += dy; |
749 |
|
} |
750 |
|
|
751 |
|
if (rx < 0) |
752 |
|
{ |
753 |
|
rw -= (-rx); |
754 |
|
rx = 0; |
755 |
|
} |
756 |
|
|
757 |
|
if (ry < 0) |
758 |
|
{ |
759 |
|
rh -= (-ry); |
760 |
|
ry = 0; |
761 |
|
} |
762 |
|
|
763 |
|
issue_repaint (layer, rx, ry, rw, rh, false, true); |
764 |
|
#else |
765 |
issue_repaint (layer, current_x, current_y, layer->width, |
issue_repaint (layer, current_x, current_y, layer->width, |
766 |
layer->height, false, true); |
layer->height, false, true); |
767 |
issue_repaint (layer, layer->absolute_x, layer->absolute_y, layer->width, |
issue_repaint (layer, layer->absolute_x, layer->absolute_y, layer->width, |
768 |
layer->height, false, true); |
layer->height, false, true); |
769 |
|
#endif |
770 |
} |
} |
771 |
pthread_mutex_unlock (&all_layers_lock); |
pthread_mutex_unlock (&all_layers_lock); |
772 |
} |
} |
865 |
powder_create_state (&display_state); |
powder_create_state (&display_state); |
866 |
powder_state_set_dst_surface (display_state, display_surface); |
powder_state_set_dst_surface (display_state, display_surface); |
867 |
powder_state_set_blitting_flags (display_state, TARGET_BLIT_NONE); |
powder_state_set_blitting_flags (display_state, TARGET_BLIT_NONE); |
868 |
|
powder_state_set_src_bfn (display_state, TARGET_BLEND_FN_SRCCOLOR); |
869 |
|
powder_state_set_dst_bfn (display_state, TARGET_BLEND_FN_INVSRCCOLOR); |
870 |
display_state->modified = TARGET_STATE_MFLAGS_ALL; |
display_state->modified = TARGET_STATE_MFLAGS_ALL; |
871 |
|
|
872 |
|
|