... |
... |
@@ -945,7 +945,7 @@ |
945
|
945
|
PLong top;
|
946
|
946
|
|
947
|
947
|
|
948
|
|
- if ( y2 == y1 || y2 < miny || y1 > maxy )
|
|
948
|
+ if ( y2 < miny || y1 > maxy )
|
949
|
949
|
return SUCCESS;
|
950
|
950
|
|
951
|
951
|
e2 = y2 > maxy ? maxy : FLOOR( y2 );
|
... |
... |
@@ -1238,69 +1238,50 @@ |
1238
|
1238
|
Line_To( RAS_ARGS Long x,
|
1239
|
1239
|
Long y )
|
1240
|
1240
|
{
|
1241
|
|
- /* First, detect a change of direction */
|
|
1241
|
+ TStates state;
|
1242
|
1242
|
|
1243
|
|
- switch ( ras.state )
|
1244
|
|
- {
|
1245
|
|
- case Unknown_State:
|
1246
|
|
- if ( y > ras.lastY )
|
1247
|
|
- {
|
1248
|
|
- if ( New_Profile( RAS_VARS Ascending_State ) )
|
1249
|
|
- return FAILURE;
|
1250
|
|
- }
|
1251
|
|
- else if ( y < ras.lastY )
|
1252
|
|
- {
|
1253
|
|
- if ( New_Profile( RAS_VARS Descending_State ) )
|
1254
|
|
- return FAILURE;
|
1255
|
|
- }
|
1256
|
|
- break;
|
1257
|
1243
|
|
1258
|
|
- case Ascending_State:
|
1259
|
|
- if ( y < ras.lastY )
|
1260
|
|
- {
|
1261
|
|
- if ( End_Profile( RAS_VAR ) ||
|
1262
|
|
- New_Profile( RAS_VARS Descending_State ) )
|
1263
|
|
- return FAILURE;
|
1264
|
|
- }
|
1265
|
|
- break;
|
|
1244
|
+ if ( y == ras.lastY )
|
|
1245
|
+ goto Fin;
|
1266
|
1246
|
|
1267
|
|
- case Descending_State:
|
1268
|
|
- if ( y > ras.lastY )
|
1269
|
|
- {
|
1270
|
|
- if ( End_Profile( RAS_VAR ) ||
|
1271
|
|
- New_Profile( RAS_VARS Ascending_State ) )
|
1272
|
|
- return FAILURE;
|
1273
|
|
- }
|
1274
|
|
- break;
|
|
1247
|
+ /* First, detect a change of direction */
|
1275
|
1248
|
|
1276
|
|
- default:
|
1277
|
|
- ;
|
|
1249
|
+ state = ras.lastY < y ? Ascending_State : Descending_State;
|
|
1250
|
+
|
|
1251
|
+ if ( ras.state != state )
|
|
1252
|
+ {
|
|
1253
|
+ /* finalize current profile if any */
|
|
1254
|
+ if ( ras.state != Unknown_State &&
|
|
1255
|
+ End_Profile( RAS_VAR ) )
|
|
1256
|
+ goto Fail;
|
|
1257
|
+
|
|
1258
|
+ /* create a new profile */
|
|
1259
|
+ if ( New_Profile( RAS_VARS state ) )
|
|
1260
|
+ goto Fail;
|
1278
|
1261
|
}
|
1279
|
1262
|
|
1280
|
1263
|
/* Then compute the lines */
|
1281
|
1264
|
|
1282
|
|
- switch ( ras.state )
|
|
1265
|
+ if ( state == Ascending_State )
|
1283
|
1266
|
{
|
1284
|
|
- case Ascending_State:
|
1285
|
1267
|
if ( Line_Up( RAS_VARS ras.lastX, ras.lastY,
|
1286
|
1268
|
x, y, ras.minY, ras.maxY ) )
|
1287
|
|
- return FAILURE;
|
1288
|
|
- break;
|
1289
|
|
-
|
1290
|
|
- case Descending_State:
|
|
1269
|
+ goto Fail;
|
|
1270
|
+ }
|
|
1271
|
+ else
|
|
1272
|
+ {
|
1291
|
1273
|
if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,
|
1292
|
1274
|
x, y, ras.minY, ras.maxY ) )
|
1293
|
|
- return FAILURE;
|
1294
|
|
- break;
|
1295
|
|
-
|
1296
|
|
- default:
|
1297
|
|
- ;
|
|
1275
|
+ goto Fail;
|
1298
|
1276
|
}
|
1299
|
1277
|
|
|
1278
|
+ Fin:
|
1300
|
1279
|
ras.lastX = x;
|
1301
|
1280
|
ras.lastY = y;
|
1302
|
|
-
|
1303
|
1281
|
return SUCCESS;
|
|
1282
|
+
|
|
1283
|
+ Fail:
|
|
1284
|
+ return FAILURE;
|
1304
|
1285
|
}
|
1305
|
1286
|
|
1306
|
1287
|
|
... |
... |
@@ -1949,7 +1930,7 @@ |
1949
|
1930
|
{
|
1950
|
1931
|
current = *old;
|
1951
|
1932
|
if ( --current->height )
|
1952
|
|
- {
|
|
1933
|
+ {
|
1953
|
1934
|
current->offset += ( current->flags & Flow_Up ) ? 1 : -1;
|
1954
|
1935
|
current->X = current->x[current->offset];
|
1955
|
1936
|
old = ¤t->link;
|