[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 09ae6eb67: * src/raster/ftraster.c (Insert_Y_Turn): I
From: |
Werner Lemberg |
Subject: |
[freetype2] master 09ae6eb67: * src/raster/ftraster.c (Insert_Y_Turn): Improve flow. |
Date: |
Sun, 22 Oct 2023 08:20:43 -0400 (EDT) |
branch: master
commit 09ae6eb6778d2d12e46dcccc1e7fe4618a249181
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Insert_Y_Turn): Improve flow.
---
src/raster/ftraster.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index e5698e18a..1db45db38 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -609,19 +609,24 @@
static Bool
Insert_Y_Turn( RAS_ARGS Int y )
{
- PLong y_turns;
- Int n;
+ Int n = ras.numTurns;
+ PLong y_turns = ras.maxBuff;
- n = ras.numTurns - 1;
- y_turns = ras.sizeBuff - ras.numTurns;
-
/* look for first y value that is <= */
- while ( n >= 0 && y < y_turns[n] )
- n--;
+ while ( n-- && y < y_turns[n] )
+ ;
/* if it is <, simply insert it, ignore if == */
- if ( n >= 0 && y > y_turns[n] )
+ if ( n < 0 || y > y_turns[n] )
+ {
+ ras.maxBuff--;
+ if ( ras.maxBuff <= ras.top )
+ {
+ ras.error = FT_THROW( Raster_Overflow );
+ return FAILURE;
+ }
+
do
{
Int y2 = (Int)y_turns[n];
@@ -629,18 +634,9 @@
y_turns[n] = y;
y = y2;
- } while ( --n >= 0 );
+ } while ( n-- >= 0 );
- if ( n < 0 )
- {
- ras.maxBuff--;
- if ( ras.maxBuff <= ras.top )
- {
- ras.error = FT_THROW( Raster_Overflow );
- return FAILURE;
- }
ras.numTurns++;
- ras.sizeBuff[-ras.numTurns] = y;
}
return SUCCESS;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 09ae6eb67: * src/raster/ftraster.c (Insert_Y_Turn): Improve flow.,
Werner Lemberg <=