CoreWindow * dfb_core_create_window( CoreDFB *core ) { CoreDFBShared *shared; D_ASSUME( core != NULL ); if (!core) core = core_dfb; D_MAGIC_ASSERT( core, CoreDFB ); shared = core->shared; D_MAGIC_ASSERT( shared, CoreDFBShared ); D_ASSERT( core->shared->window_pool != NULL ); return (CoreWindow*) fusion_object_create( core->shared->window_pool, core->world ); }
CoreGraphicsState * dfb_core_create_graphics_state( CoreDFB *core ) { CoreDFBShared *shared; D_ASSUME( core != NULL ); if (!core) core = core_dfb; D_MAGIC_ASSERT( core, CoreDFB ); shared = core->shared; D_MAGIC_ASSERT( shared, CoreDFBShared ); D_ASSERT( core->shared->graphics_state_pool != NULL ); return (CoreGraphicsState*) fusion_object_create( core->shared->graphics_state_pool, core->world ); }
CoreLayerRegion * dfb_core_create_layer_region( CoreDFB *core ) { CoreDFBShared *shared; D_ASSUME( core != NULL ); if (!core) core = core_dfb; D_MAGIC_ASSERT( core, CoreDFB ); shared = core->shared; D_MAGIC_ASSERT( shared, CoreDFBShared ); D_ASSERT( core->shared->layer_region_pool != NULL ); return (CoreLayerRegion*) fusion_object_create( core->shared->layer_region_pool, core->world ); }
DFBResult dfb_window_create( CoreWindowStack *stack, int x, int y, int width, int height, DFBWindowCapabilities caps, DFBSurfaceCapabilities surface_caps, DFBSurfacePixelFormat pixelformat, CoreWindow **window ) { DFBResult ret; CoreSurface *surface; CoreSurfacePolicy surface_policy; CoreWindow *w; DisplayLayer *layer = dfb_layer_at( stack->layer_id ); CoreSurface *layer_surface = dfb_layer_surface( layer ); surface_caps &= DSCAPS_INTERLACED | DSCAPS_SEPERATED | DSCAPS_STATIC_ALLOC | DSCAPS_SYSTEMONLY | DSCAPS_VIDEOONLY; if (caps & DWCAPS_ALPHACHANNEL) { if (pixelformat == DSPF_UNKNOWN) pixelformat = DSPF_ARGB; else if (! DFB_PIXELFORMAT_HAS_ALPHA(pixelformat)) return DFB_INVARG; surface_policy = stack->wsp_alpha; } else { surface_policy = stack->wsp_opaque; if (pixelformat == DSPF_UNKNOWN) pixelformat = layer_surface->format; } if (surface_caps & DSCAPS_VIDEOONLY) surface_policy = CSP_VIDEOONLY; else if (surface_caps & DSCAPS_SYSTEMONLY) surface_policy = CSP_SYSTEMONLY; else if (layer_surface->back_buffer->policy == CSP_SYSTEMONLY) surface_policy = CSP_SYSTEMONLY; if (caps & DWCAPS_DOUBLEBUFFER) surface_caps |= DSCAPS_FLIPPING; /* Create the window object. */ w = (CoreWindow*) fusion_object_create( stack->pool ); /* Create the window's surface using the layer's palette. */ if (! (caps & DWCAPS_INPUTONLY)) { ret = dfb_surface_create( width, height, pixelformat, surface_policy, surface_caps, layer_surface->palette, &surface ); if (ret) { fusion_object_destroy( &w->object ); return ret; } dfb_surface_link( &w->surface, surface ); dfb_surface_unref( surface ); } w->id = new_window_id( stack ); w->x = x; w->y = y; w->width = width; w->height = height; w->caps = caps; w->opacity = 0; if (caps & DWCAPS_ALPHACHANNEL) w->options = DWOP_ALPHACHANNEL; w->stack = stack; w->events = DWET_ALL; *window = w; return DFB_OK;; }