Commit 84b2c63374cb5444e927285ece93a24084674e48

Alexei Podtelezhnikov 2016-03-17T00:53:09

[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.

diff --git a/ChangeLog b/ChangeLog
index f963c83..b6f165d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-03-17  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[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  <wl@gnu.org>
 
 	* src/autofit/aflatin.c (af_latin_compute_stem_width): Optimize.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 020af82..c02c009 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;
   }