DFBResult CoreGraphicsStateClient_FillRectangles( CoreGraphicsStateClient *client, const DFBRectangle *rects, unsigned int num ) { D_DEBUG_AT( Core_GraphicsStateClient, "%s( client %p )\n", __FUNCTION__, client ); D_MAGIC_ASSERT( client, CoreGraphicsStateClient ); D_ASSERT( rects != NULL ); if (!dfb_config->call_nodirect && (dfb_core_is_master( client->core ) || !fusion_config->secure_fusion)) { dfb_gfxcard_fillrectangles( rects, num, client->state ); } else { DFBResult ret; CoreGraphicsStateClient_Update( client, DFXL_FILLRECTANGLE, client->state ); ret = CoreGraphicsState_FillRectangles( client->gfx_state, rects, num ); if (ret) return ret; } return DFB_OK; }
DFBResult IGraphicsState_Real__FillRectangles( CoreGraphicsState *obj, const DFBRectangle *rects, u32 num ) { D_DEBUG_AT( DirectFB_CoreGraphicsState, "%s()\n", __FUNCTION__ ); if (!obj->state.destination) return DFB_NOCONTEXT; dfb_gfxcard_fillrectangles( rects, num, &obj->state ); return DFB_OK; }
void dfb_clear_depth( CoreSurface *surface, const DFBRegion *region ) { #if FIXME_SC_3 SurfaceBuffer *tmp; DFBRectangle rect = { 0, 0, surface->config.size.w - 1, surface->config.size.h - 1 }; if (region && !dfb_rectangle_intersect_by_region( &rect, region )) return; pthread_mutex_lock( &cd_lock ); if (!cd_state_inited) { dfb_state_init( &cd_state, NULL ); cd_state.color.r = 0xff; cd_state.color.g = 0xff; cd_state.color.b = 0xff; cd_state_inited = true; } cd_state.modified |= SMF_CLIP | SMF_DESTINATION; cd_state.clip.x2 = surface->config.size.w - 1; cd_state.clip.y2 = surface->config.size.h - 1; cd_state.destination = surface; dfb_surfacemanager_lock( surface->manager ); tmp = surface->back_buffer; surface->back_buffer = surface->depth_buffer; dfb_gfxcard_fillrectangles( &rect, 1, &cd_state ); surface->back_buffer = tmp; dfb_surfacemanager_unlock( surface->manager ); /* Signal end of sequence. */ dfb_state_stop_drawing( &cd_state ); pthread_mutex_unlock( &cd_lock ); #endif }
static DFBResult DisplaySurface( DFBX11 *x11, X11LayerData *lds, VdpPresentationQueue queue, CoreSurfaceBufferLock *lock ) { DirectResult ret; DFBX11Shared *shared = x11->shared; DFBX11CallPresentationQueueDisplay display; display.presentation_queue = queue; display.clip_width = 0; display.clip_height = 0; display.earliest_presentation_time = 0; if (lock && lds->config.dest.x == 0 && lds->config.dest.y == 0 && lds->config.dest.w == shared->screen_size.w && lds->config.dest.h == shared->screen_size.h) { display.surface = (VdpOutputSurface) (unsigned long) lock->handle; } else { CardState state; DFBRectangle rect; dfb_state_init( &state, x11->core ); state.destination = shared->vdp_core_surface; state.source = lock ? lock->buffer->surface : NULL; state.clip.x1 = 0; state.clip.y1 = 0; state.clip.x2 = shared->screen_size.w - 1; state.clip.y2 = shared->screen_size.h - 1; rect.x = 0; rect.y = 0; rect.w = shared->screen_size.w; rect.h = shared->screen_size.h; dfb_gfxcard_fillrectangles( &rect, 1, &state ); if (lock) dfb_gfxcard_stretchblit( &lds->config.source, &lds->config.dest, &state ); dfb_gfxcard_sync(); state.destination = NULL; state.source = NULL; dfb_state_destroy( &state ); display.surface = shared->vdp_surface; } ret = fusion_call_execute2( &x11->shared->call, FCEF_ONEWAY, X11_VDPAU_PRESENTATION_QUEUE_DISPLAY, &display, sizeof(display), NULL ); if (ret) { D_DERROR( ret, "DirectFB/X11/VDPAU: fusion_call_execute2() failed!\n" ); return ret; } return DFB_OK; }
static void root_update( StretRegion *region, void *region_data, void *update_data, unsigned long arg, int x, int y, const DFBRegion *updates, int num ) { int i; CoreWindowStack *stack; UniqueContext *context = region_data; CardState *state = update_data; D_ASSERT( region != NULL ); D_ASSERT( region_data != NULL ); D_ASSERT( update_data != NULL ); D_ASSERT( updates != NULL ); D_ASSERT( x == 0 ); D_ASSERT( y == 0 ); D_MAGIC_ASSERT( context, UniqueContext ); D_MAGIC_ASSERT( state, CardState ); stack = context->stack; D_ASSERT( stack != NULL ); D_ASSERT( stack->bg.image != NULL || (stack->bg.mode != DLBM_IMAGE && stack->bg.mode != DLBM_TILE) ); D_DEBUG_AT( UniQuE_Root, "root_update( region %p, num %d )\n", region, num ); #if D_DEBUG_ENABLED for (i=0; i<num; i++) { D_DEBUG_AT( UniQuE_Root, " (%d) %4d,%4d - %4dx%4d\n", i, DFB_RECTANGLE_VALS_FROM_REGION( &updates[i] ) ); } #endif switch (stack->bg.mode) { case DLBM_COLOR: { CoreSurface *dest = state->destination; DFBColor *color = &stack->bg.color; DFBRectangle rects[num]; /* Set the background color. */ if (DFB_PIXELFORMAT_IS_INDEXED( dest->config.format )) dfb_state_set_color_index( state, dfb_palette_search( dest->palette, color->r, color->g, color->b, color->a ) ); else dfb_state_set_color( state, color ); for (i=0; i<num; i++) dfb_rectangle_from_region( &rects[i], &updates[i] ); /* Simply fill the background. */ dfb_gfxcard_fillrectangles( rects, num, state ); break; } case DLBM_IMAGE: { CoreSurface *bg = stack->bg.image; /* Set blitting source. */ state->source = bg; state->modified |= SMF_SOURCE; /* Set blitting flags. */ dfb_state_set_blitting_flags( state, DSBLIT_NOFX ); /* Check the size of the background image. */ if (bg->config.size.w == stack->width && bg->config.size.h == stack->height) { for (i=0; i<num; i++) { DFBRectangle dst = DFB_RECTANGLE_INIT_FROM_REGION( &updates[i] ); /* Simple blit for 100% fitting background image. */ dfb_gfxcard_blit( &dst, dst.x, dst.y, state ); } } else { DFBRegion clip = state->clip; for (i=0; i<num; i++) { DFBRectangle src = { 0, 0, bg->config.size.w, bg->config.size.h }; DFBRectangle dst = { 0, 0, stack->width, stack->height }; /* Change clipping region. */ dfb_state_set_clip( state, &updates[i] ); /* Stretch blit for non fitting background images. */ dfb_gfxcard_stretchblit( &src, &dst, state ); } /* Restore clipping region. */ dfb_state_set_clip( state, &clip ); } /* Reset blitting source. */ state->source = NULL; state->modified |= SMF_SOURCE; break; } case DLBM_TILE: { CoreSurface *bg = stack->bg.image; DFBRegion clip = state->clip; /* Set blitting source. */ state->source = bg; state->modified |= SMF_SOURCE; /* Set blitting flags. */ dfb_state_set_blitting_flags( state, DSBLIT_NOFX ); for (i=0; i<num; i++) { DFBRectangle src = { 0, 0, bg->config.size.w, bg->config.size.h }; /* Change clipping region. */ dfb_state_set_clip( state, &updates[i] ); /* Tiled blit (aligned). */ dfb_gfxcard_tileblit( &src, 0, 0, stack->width, stack->height, state ); } /* Restore clipping region. */ dfb_state_set_clip( state, &clip ); /* Reset blitting source. */ state->source = NULL; state->modified |= SMF_SOURCE; break; } case DLBM_DONTCARE: break; default: D_BUG( "unknown background mode" ); break; } }