nanogui: [patch] fix for zero width/height rectangles
Subject:
[patch] fix for zero width/height rectangles
From:
"Alexander Stohr" ####@####.####
Date:
15 Jul 2005 11:32:52 +0100
Message-Id: <000001c58928$62897580$9b01a8c0@starlightpc>
Hello,
font rendering (and possibly other callers)
made it to pass zero width values to the
fillrect function. in some grafics drivers
this lead later on to an assert since the
many routines for horizontal lines do only
accepts cases where "X2 >= X1" is valid
whilst the caller previousely did this:
X2 = X1 + width - 1;
Obviousely for width = 0 the X2 value will
become smaller than the X1 value and the
fillrect/horzline routine will stop by assert.
sinc zero width rectangles should not need
any drawing at all we can abort early.
same applies to zero height rectangles.
the attached patch resolves this.
see the attached patch for the details.
(Note: some grafics renderers do swapping of
X1 and X2 if those are wrongly ordered,
but i seems to me that will make it worser.)
(Note2: some internal locations might even allow
negative width/height values since the are coded
as GR_COORD instead of GR_SIZE - this could tourn
out much worser but thats byond my current scope.)
-Alex.
[Content type application/octet-stream not shown. Download]