From 7fe60435bce6595a9c58a9bfd8244d74b5320e96 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 15 Jan 2013 08:46:13 +0100 Subject: Import DirectFB141_2k11R3_beta5 --- Source/DirectFB/wm/unique/classes/root.c | 206 +++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100755 Source/DirectFB/wm/unique/classes/root.c (limited to 'Source/DirectFB/wm/unique/classes/root.c') diff --git a/Source/DirectFB/wm/unique/classes/root.c b/Source/DirectFB/wm/unique/classes/root.c new file mode 100755 index 0000000..72dcf87 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/root.c @@ -0,0 +1,206 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Root, "UniQuE/Root", "UniQuE's Root Region Class" ); + + +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; ibg.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; ibg.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; iclip; + + for (i=0; iconfig.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; iconfig.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; + } +} + +/* + * The root region is the desktop background. + */ +const StretRegionClass unique_root_region_class = { + .Update = root_update, +}; + -- cgit