summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qgrayraster.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qgrayraster.c')
-rw-r--r--src/gui/painting/qgrayraster.c80
1 files changed, 25 insertions, 55 deletions
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 5e7c67a13a..94039fb71e 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -956,53 +956,49 @@
const QT_FT_Vector* control2,
const QT_FT_Vector* to )
{
- TPos dx, dy, da, db;
int top, level;
int* levels;
QT_FT_Vector* arc;
+ int mid_x = ( DOWNSCALE( ras.x ) + to->x +
+ 3 * (control1->x + control2->x ) ) / 8;
+ int mid_y = ( DOWNSCALE( ras.y ) + to->y +
+ 3 * (control1->y + control2->y ) ) / 8;
+ TPos dx = DOWNSCALE( ras.x ) + to->x - ( mid_x << 1 );
+ TPos dy = DOWNSCALE( ras.y ) + to->y - ( mid_y << 1 );
- dx = DOWNSCALE( ras.x ) + to->x - ( control1->x << 1 );
if ( dx < 0 )
dx = -dx;
- dy = DOWNSCALE( ras.y ) + to->y - ( control1->y << 1 );
if ( dy < 0 )
dy = -dy;
if ( dx < dy )
dx = dy;
- da = dx;
-
- dx = DOWNSCALE( ras.x ) + to->x - 3 * ( control1->x + control2->x );
- if ( dx < 0 )
- dx = -dx;
- dy = DOWNSCALE( ras.y ) + to->y - 3 * ( control1->x + control2->y );
- if ( dy < 0 )
- dy = -dy;
- if ( dx < dy )
- dx = dy;
- db = dx;
level = 1;
- da = da / ras.cubic_level;
- db = db / ras.conic_level;
- while ( da > 0 || db > 0 )
+ dx /= ras.cubic_level;
+ while ( dx > 0 )
{
- da >>= 2;
- db >>= 3;
+ dx >>= 2;
level++;
}
if ( level <= 1 )
{
- TPos to_x, to_y, mid_x, mid_y;
+ TPos to_x, to_y;
to_x = UPSCALE( to->x );
to_y = UPSCALE( to->y );
+
+ /* Recalculation of midpoint is needed only if */
+ /* UPSCALE and DOWNSCALE have any effect. */
+
+#if ( PIXEL_BITS != 6 )
mid_x = ( ras.x + to_x +
3 * UPSCALE( control1->x + control2->x ) ) / 8;
mid_y = ( ras.y + to_y +
3 * UPSCALE( control1->y + control2->y ) ) / 8;
+#endif
gray_render_line( RAS_VAR_ mid_x, mid_y );
gray_render_line( RAS_VAR_ to_x, to_y );
@@ -1359,10 +1355,6 @@
/* <Input> */
/* outline :: A pointer to the source target. */
/* */
- /* func_interface :: A table of `emitters', i.e,. function pointers */
- /* called during decomposition to indicate path */
- /* operations. */
- /* */
/* user :: A typeless pointer which is passed to each */
/* emitter during the decomposition. It can be */
/* used to store the state during the */
@@ -1373,15 +1365,10 @@
/* */
static
int QT_FT_Outline_Decompose( const QT_FT_Outline* outline,
- const QT_FT_Outline_Funcs* func_interface,
void* user )
{
#undef SCALED
-#if 0
-#define SCALED( x ) ( ( (x) << shift ) - delta )
-#else
#define SCALED( x ) (x)
-#endif
QT_FT_Vector v_last;
QT_FT_Vector v_control;
@@ -1396,12 +1383,6 @@
int error;
char tag; /* current point's state */
-#if 0
- int shift = func_interface->shift;
- TPos delta = func_interface->delta;
-#endif
-
-
first = 0;
for ( n = 0; n < outline->n_contours; n++ )
@@ -1455,7 +1436,7 @@
tags--;
}
- error = func_interface->move_to( &v_start, user );
+ error = gray_move_to( &v_start, user );
if ( error )
goto Exit;
@@ -1475,7 +1456,7 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
- error = func_interface->line_to( &vec, user );
+ error = gray_line_to( &vec, user );
if ( error )
goto Exit;
continue;
@@ -1502,7 +1483,7 @@
if ( tag == QT_FT_CURVE_TAG_ON )
{
- error = func_interface->conic_to( &v_control, &vec,
+ error = gray_conic_to( &v_control, &vec,
user );
if ( error )
goto Exit;
@@ -1515,7 +1496,7 @@
v_middle.x = ( v_control.x + vec.x ) / 2;
v_middle.y = ( v_control.y + vec.y ) / 2;
- error = func_interface->conic_to( &v_control, &v_middle,
+ error = gray_conic_to( &v_control, &v_middle,
user );
if ( error )
goto Exit;
@@ -1524,7 +1505,7 @@
goto Do_Conic;
}
- error = func_interface->conic_to( &v_control, &v_start,
+ error = gray_conic_to( &v_control, &v_start,
user );
goto Close;
}
@@ -1555,20 +1536,20 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
- error = func_interface->cubic_to( &vec1, &vec2, &vec, user );
+ error = gray_cubic_to( &vec1, &vec2, &vec, user );
if ( error )
goto Exit;
continue;
}
- error = func_interface->cubic_to( &vec1, &vec2, &v_start, user );
+ error = gray_cubic_to( &vec1, &vec2, &v_start, user );
goto Close;
}
}
}
/* close the contour with a line segment */
- error = func_interface->line_to( &v_start, user );
+ error = gray_line_to( &v_start, user );
Close:
if ( error )
@@ -1596,22 +1577,11 @@
static int
gray_convert_glyph_inner( RAS_ARG )
{
- static
- const QT_FT_Outline_Funcs func_interface =
- {
- (QT_FT_Outline_MoveTo_Func) gray_move_to,
- (QT_FT_Outline_LineTo_Func) gray_line_to,
- (QT_FT_Outline_ConicTo_Func)gray_conic_to,
- (QT_FT_Outline_CubicTo_Func)gray_cubic_to,
- 0,
- 0
- };
-
volatile int error = 0;
if ( qt_ft_setjmp( ras.jump_buffer ) == 0 )
{
- error = QT_FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
+ error = QT_FT_Outline_Decompose( &ras.outline, &ras );
gray_record_cell( RAS_VAR );
}
else