[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master aec7e717f: [raster] Stylistic changes.
From: |
Werner Lemberg |
Subject: |
[freetype2] master aec7e717f: [raster] Stylistic changes. |
Date: |
Tue, 14 Nov 2023 11:47:44 -0500 (EST) |
branch: master
commit aec7e717fb9fd962cef5302609af0cf423db7499
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Stylistic changes.
* src/raster/ftraster.c (Line_To): Code it similar to curves;
shortcut the flat lines here...
(Line_Up): ... instead of here.
---
src/raster/ftraster.c | 75 +++++++++++++++++++--------------------------------
1 file changed, 28 insertions(+), 47 deletions(-)
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index cd87b9592..5adae0bee 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -945,7 +945,7 @@
PLong top;
- if ( y2 == y1 || y2 < miny || y1 > maxy )
+ if ( y2 < miny || y1 > maxy )
return SUCCESS;
e2 = y2 > maxy ? maxy : FLOOR( y2 );
@@ -1238,69 +1238,50 @@
Line_To( RAS_ARGS Long x,
Long y )
{
- /* First, detect a change of direction */
+ TStates state;
- switch ( ras.state )
- {
- case Unknown_State:
- if ( y > ras.lastY )
- {
- if ( New_Profile( RAS_VARS Ascending_State ) )
- return FAILURE;
- }
- else if ( y < ras.lastY )
- {
- if ( New_Profile( RAS_VARS Descending_State ) )
- return FAILURE;
- }
- break;
- case Ascending_State:
- if ( y < ras.lastY )
- {
- if ( End_Profile( RAS_VAR ) ||
- New_Profile( RAS_VARS Descending_State ) )
- return FAILURE;
- }
- break;
+ if ( y == ras.lastY )
+ goto Fin;
- case Descending_State:
- if ( y > ras.lastY )
- {
- if ( End_Profile( RAS_VAR ) ||
- New_Profile( RAS_VARS Ascending_State ) )
- return FAILURE;
- }
- break;
+ /* First, detect a change of direction */
- default:
- ;
+ state = ras.lastY < y ? Ascending_State : Descending_State;
+
+ if ( ras.state != state )
+ {
+ /* finalize current profile if any */
+ if ( ras.state != Unknown_State &&
+ End_Profile( RAS_VAR ) )
+ goto Fail;
+
+ /* create a new profile */
+ if ( New_Profile( RAS_VARS state ) )
+ goto Fail;
}
/* Then compute the lines */
- switch ( ras.state )
+ if ( state == Ascending_State )
{
- case Ascending_State:
if ( Line_Up( RAS_VARS ras.lastX, ras.lastY,
x, y, ras.minY, ras.maxY ) )
- return FAILURE;
- break;
-
- case Descending_State:
+ goto Fail;
+ }
+ else
+ {
if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,
x, y, ras.minY, ras.maxY ) )
- return FAILURE;
- break;
-
- default:
- ;
+ goto Fail;
}
+ Fin:
ras.lastX = x;
ras.lastY = y;
-
return SUCCESS;
+
+ Fail:
+ return FAILURE;
}
@@ -1949,7 +1930,7 @@
{
current = *old;
if ( --current->height )
- {
+ {
current->offset += ( current->flags & Flow_Up ) ? 1 : -1;
current->X = current->x[current->offset];
old = ¤t->link;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master aec7e717f: [raster] Stylistic changes.,
Werner Lemberg <=