* ============================================================================ *
*	NormalizeRect: Fix up IBox with negative dimensions
*
*	struct IBox *NormalizeRect(struct IBox *b);
*                      a0
* ============================================================================ *

			include		'intuition/intuition.i'

			SECTION		normalrect.asm,CODE

			xdef		_NormalizeRect

_NormalizeRect
			move.w		ibox_Width(a0),d0		; get width of box
			bpl.s		1$						; if negative
			add.w		d0,ibox_Left(a0)		; adjust left edge
			neg.w		d0						; negate width
			move.w		d0,ibox_Width(a0)		; store back
1$			
			move.w		ibox_Height(a0),d0		; get height of box
			bpl.s		2$						; if negative
			add.w		d0,ibox_Top(a0)			; adjust top edge
			neg.w		d0						; negate height
			move.w		d0,ibox_Height(a0)		; store back
2$			
			move.l		a0,d0					; return address of box
			rts
			
			end
