コード例 #1
0
ファイル: element.c プロジェクト: artfwo/rutabaga
void
rtb_elem_draw(struct rtb_element *self, int clear_first)
{
	if (self->visibility == RTB_FULLY_OBSCURED)
		return;

	rtb_render_push(self);
	if (clear_first)
		rtb_render_clear(self);

	self->draw(self);
	LAYOUT_DEBUG_DRAW_BOX(self);

	rtb_render_pop(self);
}
コード例 #2
0
ファイル: window.c プロジェクト: wrl/rutabaga
int
rtb_window_draw(struct rtb_window *self, int force_redraw)
{
	const struct rtb_style_property_definition *prop;
	struct rtb_window_event ev;

	if (self->state == RTB_STATE_UNATTACHED
			|| self->visibility == RTB_FULLY_OBSCURED)
		return 0;

	ev.type = RTB_FRAME_START;
	ev.source = RTB_EVENT_GENUINE;
	ev.window = self;
	rtb_dispatch_raw(RTB_ELEMENT(self), RTB_EVENT(&ev));

	if (!self->dirty || force_redraw)
		return 0;

	glViewport(0, 0, self->w, self->h);

	prop = rtb_style_query_prop(RTB_ELEMENT(self),
			"background-color", RTB_STYLE_PROP_COLOR, 1);

	glEnable(GL_DITHER);
	glEnable(GL_BLEND);
	glEnable(GL_SCISSOR_TEST);

	glClearColor(
			prop->color.r,
			prop->color.g,
			prop->color.b,
			prop->color.a);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	rtb_render_push(RTB_ELEMENT(self));
	self->draw(RTB_ELEMENT(self));
	rtb_render_pop(RTB_ELEMENT(self));

	self->dirty = 0;

	ev.type = RTB_FRAME_END;
	rtb_dispatch_raw(RTB_ELEMENT(self), RTB_EVENT(&ev));

	return 1;
}