void dfb_state_update_destination( CardState *state ) { CoreSurface *destination; D_DEBUG_AT( Core_GfxState, "%s( %p )\n", __FUNCTION__, state ); D_MAGIC_ASSERT( state, CardState ); DFB_REGION_ASSERT( &state->clip ); destination = state->destination; if (D_FLAGS_IS_SET( state->flags, CSF_DESTINATION )) { D_DEBUG_AT( Core_GfxState, " -> CSF_DESTINATION is set\n" ); D_ASSERT( destination != NULL ); if (direct_serial_update( &state->dst_serial, &destination->serial )) { D_DEBUG_AT( Core_GfxState, " -> serial is updated\n" ); validate_clip( state, destination->config.size.w - 1, destination->config.size.h - 1, true ); state->modified |= SMF_DESTINATION; } } else if (destination) validate_clip( state, destination->config.size.w - 1, destination->config.size.h - 1, true ); }
void dfb_state_update( CardState *state, bool update_sources ) { CoreSurface *destination; D_MAGIC_ASSERT( state, CardState ); DFB_REGION_ASSERT( &state->clip ); destination = state->destination; if (D_FLAGS_IS_SET( state->flags, CSF_DESTINATION )) { D_ASSERT( destination != NULL ); if (direct_serial_update( &state->dst_serial, &destination->serial )) { validate_clip( state, destination->config.size.w - 1, destination->config.size.h - 1, true ); state->modified |= SMF_DESTINATION; } } else if (destination) validate_clip( state, destination->config.size.w - 1, destination->config.size.h - 1, true ); if (update_sources && D_FLAGS_IS_SET( state->flags, CSF_SOURCE )) { CoreSurface *source = state->source; D_ASSERT( source != NULL ); if (direct_serial_update( &state->src_serial, &source->serial )) state->modified |= SMF_SOURCE; } if (update_sources && D_FLAGS_IS_SET( state->flags, CSF_SOURCE_MASK )) { CoreSurface *source_mask = state->source_mask; D_ASSERT( source_mask != NULL ); if (direct_serial_update( &state->src_mask_serial, &source_mask->serial )) state->modified |= SMF_SOURCE_MASK; } if (update_sources && D_FLAGS_IS_SET( state->flags, CSF_SOURCE2 )) { CoreSurface *source2 = state->source2; D_ASSERT( source2 != NULL ); if (direct_serial_update( &state->src2_serial, &source2->serial )) state->modified |= SMF_SOURCE2; } }
DFBResult dfb_state_set_destination( CardState *state, CoreSurface *destination ) { D_MAGIC_ASSERT( state, CardState ); dfb_state_lock( state ); D_ASSUME( !(state->flags & CSF_DRAWING) ); if (state->destination != destination) { if (destination) { if (dfb_surface_ref( destination )) { D_WARN( "could not ref() destination" ); dfb_state_unlock( state ); return DFB_DEAD; } validate_clip( state, destination->config.size.w - 1, destination->config.size.h - 1, false ); } if (state->destination) { D_ASSERT( D_FLAGS_IS_SET( state->flags, CSF_DESTINATION ) ); dfb_surface_unref( state->destination ); } state->destination = destination; state->modified |= SMF_DESTINATION; if (destination) { direct_serial_copy( &state->dst_serial, &destination->serial ); D_FLAGS_SET( state->flags, CSF_DESTINATION ); } else D_FLAGS_CLEAR( state->flags, CSF_DESTINATION ); } dfb_state_unlock( state ); return DFB_OK; }