... |
... |
@@ -412,6 +412,12 @@ |
412
|
412
|
{
|
413
|
413
|
FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] );
|
414
|
414
|
|
|
415
|
+ /* final amount to move edge or edge pair */
|
|
416
|
+ CF2_Fixed move = 0;
|
|
417
|
+
|
|
418
|
+ CF2_Fixed dsCoord_i;
|
|
419
|
+ CF2_Fixed dsCoord_j;
|
|
420
|
+
|
415
|
421
|
|
416
|
422
|
/* index of upper edge (same value for ghost hint) */
|
417
|
423
|
j = isPair ? i + 1 : i;
|
... |
... |
@@ -422,11 +428,14 @@ |
422
|
428
|
FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) ==
|
423
|
429
|
cf2_hint_isLocked( &hintmap->edge[j] ) );
|
424
|
430
|
|
|
431
|
+ dsCoord_i = hintmap->edge[i].dsCoord;
|
|
432
|
+ dsCoord_j = hintmap->edge[j].dsCoord;
|
|
433
|
+
|
425
|
434
|
if ( !cf2_hint_isLocked( &hintmap->edge[i] ) )
|
426
|
435
|
{
|
427
|
436
|
/* hint edge is not locked, we can adjust it */
|
428
|
|
- CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord );
|
429
|
|
- CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord );
|
|
437
|
+ CF2_Fixed fracDown = cf2_fixedFraction( dsCoord_i );
|
|
438
|
+ CF2_Fixed fracUp = cf2_fixedFraction( dsCoord_j );
|
430
|
439
|
|
431
|
440
|
/* calculate all four possibilities; moves down are negative */
|
432
|
441
|
CF2_Fixed downMoveDown = 0 - fracDown;
|
... |
... |
@@ -443,9 +452,6 @@ |
443
|
452
|
/* smallest move down */
|
444
|
453
|
CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown );
|
445
|
454
|
|
446
|
|
- /* final amount to move edge or edge pair */
|
447
|
|
- CF2_Fixed move;
|
448
|
|
-
|
449
|
455
|
CF2_Fixed downMinCounter = CF2_MIN_COUNTER;
|
450
|
456
|
CF2_Fixed upMinCounter = CF2_MIN_COUNTER;
|
451
|
457
|
FT_Bool saveEdge = FALSE;
|
... |
... |
@@ -467,16 +473,14 @@ |
467
|
473
|
/* is there room to move up? */
|
468
|
474
|
/* there is if we are at top of array or the next edge is at or */
|
469
|
475
|
/* beyond proposed move up? */
|
470
|
|
- if ( j >= hintmap->count - 1 ||
|
|
476
|
+ if ( j >= hintmap->count - 1 ||
|
471
|
477
|
hintmap->edge[j + 1].dsCoord >=
|
472
|
|
- ADD_INT32( hintmap->edge[j].dsCoord,
|
473
|
|
- moveUp + upMinCounter ) )
|
|
478
|
+ ADD_INT32( dsCoord_j, moveUp + upMinCounter ) )
|
474
|
479
|
{
|
475
|
480
|
/* there is room to move up; is there also room to move down? */
|
476
|
|
- if ( i == 0 ||
|
|
481
|
+ if ( i == 0 ||
|
477
|
482
|
hintmap->edge[i - 1].dsCoord <=
|
478
|
|
- ADD_INT32( hintmap->edge[i].dsCoord,
|
479
|
|
- moveDown - downMinCounter ) )
|
|
483
|
+ ADD_INT32( dsCoord_i, moveDown - downMinCounter ) )
|
480
|
484
|
{
|
481
|
485
|
/* move smaller absolute amount */
|
482
|
486
|
move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */
|
... |
... |
@@ -487,10 +491,9 @@ |
487
|
491
|
else
|
488
|
492
|
{
|
489
|
493
|
/* is there room to move down? */
|
490
|
|
- if ( i == 0 ||
|
|
494
|
+ if ( i == 0 ||
|
491
|
495
|
hintmap->edge[i - 1].dsCoord <=
|
492
|
|
- ADD_INT32( hintmap->edge[i].dsCoord,
|
493
|
|
- moveDown - downMinCounter ) )
|
|
496
|
+ ADD_INT32( dsCoord_i, moveDown - downMinCounter ) )
|
494
|
497
|
{
|
495
|
498
|
move = moveDown;
|
496
|
499
|
/* true if non-optimum move */
|
... |
... |
@@ -524,17 +527,21 @@ |
524
|
527
|
}
|
525
|
528
|
|
526
|
529
|
/* move the edge(s) */
|
527
|
|
- hintmap->edge[i].dsCoord = ADD_INT32( hintmap->edge[i].dsCoord,
|
528
|
|
- move );
|
|
530
|
+ hintmap->edge[i].dsCoord = ADD_INT32( dsCoord_i, move );
|
529
|
531
|
if ( isPair )
|
530
|
|
- hintmap->edge[j].dsCoord = ADD_INT32( hintmap->edge[j].dsCoord,
|
531
|
|
- move );
|
|
532
|
+ hintmap->edge[j].dsCoord = ADD_INT32( dsCoord_j, move );
|
532
|
533
|
}
|
533
|
534
|
|
534
|
|
- /* assert there are no overlaps in device space */
|
|
535
|
+ /* assert there are no overlaps in device space; */
|
|
536
|
+ /* ignore tests if there was overflow (that is, if */
|
|
537
|
+ /* operands have the same sign but the sum does not) */
|
535
|
538
|
FT_ASSERT( i == 0 ||
|
|
539
|
+ ( ( dsCoord_i ^ move ) >= 0 &&
|
|
540
|
+ ( dsCoord_i ^ hintmap->edge[i].dsCoord ) < 0 ) ||
|
536
|
541
|
hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord );
|
537
|
542
|
FT_ASSERT( i < j ||
|
|
543
|
+ ( ( dsCoord_j ^ move ) >= 0 &&
|
|
544
|
+ ( dsCoord_j ^ hintmap->edge[j].dsCoord ) < 0 ) ||
|
538
|
545
|
hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord );
|
539
|
546
|
|
540
|
547
|
/* adjust the scales, avoiding divide by zero */
|