Commit 465ab99585cb748f9de0087d369677cc9e196785

Alexei Podtelezhnikov 2014-10-29T23:45:23

[smooth] Improve code readability. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Rearrange code.

diff --git a/ChangeLog b/ChangeLog
index 78dd95e..4a09f59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-10-29  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
+	[smooth] Improve code readability.
+
+	* src/smooth/ftsmooth.c (ft_smooth_render_generic): Rearrange code.
+
+2014-10-29  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
 	Unify hypotenuse approximations.
 
 	* include/internal/ftcalc.h (FT_HYPOT): Move macro from here...
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 89088cd..fce42cf 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -182,14 +182,6 @@
     height_org = height;
 #endif
 
-    /* release old bitmap buffer */
-    if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
-    {
-      FT_FREE( bitmap->buffer );
-      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
-    }
-
-    /* allocate new one */
     pitch = width;
     if ( hmul )
     {
@@ -250,10 +242,14 @@
     bitmap->rows       = height;
     bitmap->pitch      = pitch;
 
-    /* translate outline to render it into the bitmap */
-    FT_Outline_Translate( outline, -x_shift, -y_shift );
-    have_outline_shifted = TRUE;
+    /* release old bitmap buffer */
+    if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
+    {
+      FT_FREE( bitmap->buffer );
+      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
+    }
 
+    /* allocate new one */
     if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
       goto Exit;
     else
@@ -261,6 +257,10 @@
 
     slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
 
+    /* translate outline to render it into the bitmap */
+    FT_Outline_Translate( outline, -x_shift, -y_shift );
+    have_outline_shifted = TRUE;
+
     /* set up parameters */
     params.target = bitmap;
     params.source = outline;