From ab97e11919927d38bfc2be990d2b4dd1327083ea Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 17 Aug 2010 15:15:31 +0200 Subject: qgrayraster: Remove unnecessary indirection in QT_FT_Outline_Decompose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since this function is only used inside qgrayraster.c, we can call the gray_* functions directly instead of going through function pointers. This allows inlining trivial methods like gray_line_to() et al. Reviewed-by: Samuel Rødal --- src/gui/painting/qgrayraster.c | 44 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 539a33c..94039fb 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -1355,10 +1355,6 @@ /* */ /* 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 */ @@ -1369,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; @@ -1392,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++ ) @@ -1451,7 +1436,7 @@ tags--; } - error = func_interface->move_to( &v_start, user ); + error = gray_move_to( &v_start, user ); if ( error ) goto Exit; @@ -1471,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; @@ -1498,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; @@ -1511,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; @@ -1520,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; } @@ -1551,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 ) @@ -1592,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 -- cgit v0.12