示例#1
0
/** 标记指定范围内容的文本行的矩形为无效 */
void TextLayer_InvalidateRowsRect( LCUI_TextLayer layer,
				   int start_row, int end_row )
{
	int i, y;
	LCUI_Rect rect;

	if( end_row < 0 || end_row >= layer->rowlist.length ) {
		end_row = layer->rowlist.length - 1;
	}

	y = layer->offset_y;
	for( i = 0; i < layer->rowlist.length; ++i ) {
		y += layer->rowlist.rows[i]->height;
		if( i >= start_row && y >= 0 ) {
			y -= layer->rowlist.rows[i]->height;
			break;
		}
	}
	for( ; i <= end_row; ++i ) {
		TextLayer_GetRowRect( layer, i, 0, -1, &rect );
		RectList_Add( &layer->dirty_rect, &rect );
		y += layer->rowlist.rows[i]->height;
		if( y >= layer->max_height ) {
			break;
		}
	}
}
示例#2
0
/** 标记指定文本行的矩形区域为无效 */
static void TextLayer_InvalidateRowRect( LCUI_TextLayer layer, int row,
					 int start, int end )
{
	LCUI_Rect rect;
	if( TextLayer_GetRowRect( layer, row, start, end, &rect ) == 0 ) {
		RectList_Add( &layer->dirty_rect, &rect );
	}
}
示例#3
0
LCUI_BOOL Widget_InvalidateArea( LCUI_Widget widget,
				 LCUI_RectF *in_rect, int box_type )
{
	int mode;
	LCUI_Rect area;
	LCUI_RectF rect;
	LCUI_Widget w = widget;
	LCUI_Widget root = LCUIWidget_GetRoot();
	LCUI_RectGroup group;

	if( !w ) {
		w = root;
	}
	mode = LCUIDisplay_GetMode();
	Widget_AdjustArea( w, in_rect, &rect, box_type );
	rect.x += w->box.graph.x;
	rect.y += w->box.graph.y;
	while( w && w->parent ) {
		LCUIRectF_ValidateArea( &rect, w->parent->box.padding.width,
					w->parent->box.padding.height );
		if( rect.width <= 0 || rect.height <= 0 ) {
			return FALSE;
		}
		if( mode != LCDM_SEAMLESS && w->parent == root ) {
			break;
		}
		w = w->parent;
		rect.x += w->box.padding.x;
		rect.y += w->box.padding.y;
	}
	RectFToInvalidArea( &rect, &area );
	if( mode != LCDM_SEAMLESS ) {
		RectList_Add( &self.rects, &area );
		return TRUE;
	}
	group = RBTree_CustomGetData( &self.groups, w );
	if( !group ) {
		group = NEW( LCUI_RectGroupRec, 1 );
		group->widget = w;
		LinkedList_Init( &group->rects );
		RBTree_CustomInsert( &self.groups, w, group );
	}
	return RectList_Add( &group->rects, &area ) == 0;
}