From 84b2c63374cb5444e927285ece93a24084674e48 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 17 Mar 2016 00:53:09 -0400 Subject: [PATCH] [smooth] Minor refactoring. * src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move upscaling from here... (gray_conic_to, gray_cubic_to):... to here. --- ChangeLog | 8 ++++++ src/smooth/ftgrays.c | 58 ++++++++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index f963c83b3..b6f165dfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-03-17 Alexei Podtelezhnikov + + [smooth] Minor refactoring. + + * src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move + upscaling from here... + (gray_conic_to, gray_cubic_to):... to here. + 2016-03-15 Werner Lemberg * src/autofit/aflatin.c (af_latin_compute_stem_width): Optimize. diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 020af82b2..c02c00934 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1063,25 +1063,15 @@ typedef ptrdiff_t FT_PtrDist; static void - gray_render_conic( RAS_ARG_ const FT_Vector* control, - const FT_Vector* to ) + gray_render_conic( RAS_ARG ) { TPos dx, dy; TPos min, max, y; int top, level; - int* levels; - FT_Vector* arc; + int* levels = ras.lev_stack; + FT_Vector* arc = ras.bez_stack; - levels = ras.lev_stack; - - arc = ras.bez_stack; - arc[0].x = UPSCALE( to->x ); - arc[0].y = UPSCALE( to->y ); - arc[1].x = UPSCALE( control->x ); - arc[1].y = UPSCALE( control->y ); - arc[2].x = ras.x; - arc[2].y = ras.y; top = 0; dx = FT_ABS( arc[2].x + arc[0].x - 2 * arc[1].x ); @@ -1165,24 +1155,12 @@ typedef ptrdiff_t FT_PtrDist; static void - gray_render_cubic( RAS_ARG_ const FT_Vector* control1, - const FT_Vector* control2, - const FT_Vector* to ) + gray_render_cubic( RAS_ARG ) { - FT_Vector* arc; + FT_Vector* arc = ras.bez_stack; TPos min, max, y; - arc = ras.bez_stack; - arc[0].x = UPSCALE( to->x ); - arc[0].y = UPSCALE( to->y ); - arc[1].x = UPSCALE( control2->x ); - arc[1].y = UPSCALE( control2->y ); - arc[2].x = UPSCALE( control1->x ); - arc[2].y = UPSCALE( control1->y ); - arc[3].x = ras.x; - arc[3].y = ras.y; - /* Short-cut the arc that crosses the current band. */ min = max = arc[0].y; @@ -1313,7 +1291,17 @@ typedef ptrdiff_t FT_PtrDist; const FT_Vector* to, gray_PWorker worker ) { - gray_render_conic( RAS_VAR_ control, to ); + FT_Vector* arc = ras.bez_stack; + + + arc[0].x = UPSCALE( to->x ); + arc[0].y = UPSCALE( to->y ); + arc[1].x = UPSCALE( control->x ); + arc[1].y = UPSCALE( control->y ); + arc[2].x = ras.x; + arc[2].y = ras.y; + + gray_render_conic( RAS_VAR ); return 0; } @@ -1324,7 +1312,19 @@ typedef ptrdiff_t FT_PtrDist; const FT_Vector* to, gray_PWorker worker ) { - gray_render_cubic( RAS_VAR_ control1, control2, to ); + FT_Vector* arc = ras.bez_stack; + + + arc[0].x = UPSCALE( to->x ); + arc[0].y = UPSCALE( to->y ); + arc[1].x = UPSCALE( control2->x ); + arc[1].y = UPSCALE( control2->y ); + arc[2].x = UPSCALE( control1->x ); + arc[2].y = UPSCALE( control1->y ); + arc[3].x = ras.x; + arc[3].y = ras.y; + + gray_render_cubic( RAS_VAR ); return 0; }