/*-----------------------------------------------------------------------

	Wega 1.00 - Demonstrationsprogramm   (c) 1991 by D. Rabich
	==================================

	Redraw

-----------------------------------------------------------------------*/

/* Wegabibliothek */
#include <wega.h>
#include <stdio.h>

#include "redraw.h"


VOID win_objc_draw(WORD whandle, OBJECT *tree, WORD obj, GRECT *clip)
{
	GRECT	rect, inter, full;

	GBegUpdate();
	wind_get(0, WF_WORKXYWH,
				&full.g_x,
				&full.g_y,
				&full.g_w,
				&full.g_h);
	wind_get(whandle, WF_FIRSTXYWH,
				&rect.g_x,
				&rect.g_y,
				&rect.g_w,
				&rect.g_h);
	while(rect.g_w && rect.g_h)
	{
		if(GRectIntersect(&inter, &rect, clip))
		{
			if(GRectIntersect(&inter, &inter, &full))
				objc_draw(tree, obj, MAX_DEPTH,
							inter.g_x,
							inter.g_y,
							inter.g_w,
							inter.g_h);
		}
		wind_get(whandle, WF_NEXTXYWH,
					&rect.g_x,
					&rect.g_y,
					&rect.g_w,
					&rect.g_h);
	}
	GEndUpdate();
}

