Exemplo n.º 1
0
static void AsyncLoadImage( LCUI_Widget widget, const char *path )
{
	ImageCache cache;
	LCUI_Task task = {0};
	LCUI_Style *s = &widget->cached_style->sheet[key_background_image];

	if( !is_inited ) {
		RBTree_Init( &images );
		RBTree_Init( &refs );
		RBTree_OnJudge( &refs, OnCompareWidget );
		RBTree_OnJudge( &images, OnComparePath );
		RBTree_OnDestroy( &refs, free );
		RBTree_OnDestroy( &images, OnDestroyCache );
		is_inited = TRUE;
	}
	if( s->is_valid && s->type == SVT_STRING ) {
		cache = RBTree_CustomGetData( &images, s->string );
		if( cache ) {
			DelRef( widget, cache );
		}
	}
	cache = RBTree_CustomGetData( &images, path );
	if( cache ) {
		AddRef( widget, cache );
		Graph_Quote( &widget->computed_style.background.image,
			     &cache->image, NULL );
		Widget_AddTask( widget, WTT_BODY );
		return;
	}
	task.func = ExecLoadImage;
	task.arg[0] = widget;
	task.arg[1] = strdup( path );
	LCUI_AddTask( &task );
}
Exemplo n.º 2
0
void    DelLblRef( ins_entry *instr )
/***********************************/
{
    label_handle    old;

    optbegin
    old = _Label( instr );
    DelRef( &old->refs, instr );
    TryScrapLabel( old );
    optend
}