Commit 27bdb36cbe02f6c62e09ec973c791e6565f9d38b

Werner Lemberg 2016-12-10T09:56:03

[truetype, type1] Add `done_blend' to MM service. For internal use; we want to share code between the forthcoming CFF2 support and TrueType. * include/freetype/internal/services/svmm.h (FT_Done_Blend_Func): New typedef. (MultiMasters): Add `done_blend'. (FT_Service_MultiMasters): Updated. * src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttobjs.c (TT_Face_Done): Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated.

diff --git a/ChangeLog b/ChangeLog
index d67fc71..37478d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2016-12-10  Werner Lemberg  <wl@gnu.org>
+
+	[truetype, type1] Add `done_blend' to MM service.
+
+	For internal use; we want to share code between the forthcoming CFF2
+	support and TrueType.
+
+	* include/freetype/internal/services/svmm.h (FT_Done_Blend_Func):
+	New typedef.
+	(MultiMasters): Add `done_blend'.
+	(FT_Service_MultiMasters): Updated.
+
+	* src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument.
+	* src/truetype/ttgxvar.h: Updated.
+
+	* src/truetype/ttobjs.c (TT_Face_Done): Updated.
+
+	* src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated.
+	* src/type1/t1driver.c (t1_service_multi_masters): Updated.
+
 2016-12-09  Werner Lemberg  <wl@gnu.org>
 
 	[sfnt] Revert change from 2016-12-08.
diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h
index e4d34ba..51bce40 100644
--- a/include/freetype/internal/services/svmm.h
+++ b/include/freetype/internal/services/svmm.h
@@ -68,6 +68,9 @@ FT_BEGIN_HEADER
                            FT_UInt   num_coords,
                            FT_Long*  coords );
 
+  typedef void
+  (*FT_Done_Blend_Func)( FT_Face );
+
 
   FT_DEFINE_SERVICE( MultiMasters )
   {
@@ -78,6 +81,9 @@ FT_BEGIN_HEADER
     FT_Get_MM_Var_Func      get_mm_var;
     FT_Set_Var_Design_Func  set_var_design;
     FT_Get_Var_Design_Func  get_var_design;
+
+    /* for internal use; only needed for code sharing between modules */
+    FT_Done_Blend_Func      done_blend;
   };
 
 
@@ -90,7 +96,8 @@ FT_BEGIN_HEADER
                                            get_mm_blend_,    \
                                            get_mm_var_,      \
                                            set_var_design_,  \
-                                           get_var_design_ ) \
+                                           get_var_design_,  \
+                                           done_blend_     ) \
   static const FT_Service_MultiMastersRec  class_ =          \
   {                                                          \
     get_mm_,                                                 \
@@ -99,7 +106,8 @@ FT_BEGIN_HEADER
     get_mm_blend_,                                           \
     get_mm_var_,                                             \
     set_var_design_,                                         \
-    get_var_design_                                          \
+    get_var_design_,                                         \
+    done_blend_                                              \
   };
 
 #else /* FT_CONFIG_OPTION_PIC */
@@ -111,7 +119,8 @@ FT_BEGIN_HEADER
                                            get_mm_blend_,        \
                                            get_mm_var_,          \
                                            set_var_design_,      \
-                                           get_var_design_ )     \
+                                           get_var_design_,      \
+                                           done_blend_ )         \
   void                                                           \
   FT_Init_Class_ ## class_( FT_Service_MultiMastersRec*  clazz ) \
   {                                                              \
@@ -122,6 +131,7 @@ FT_BEGIN_HEADER
     clazz->get_mm_var     = get_mm_var_;                         \
     clazz->set_var_design = set_var_design_;                     \
     clazz->get_var_design = get_var_design_;                     \
+    clazz->done_blend     = done_blend_;                         \
   }
 
 #endif /* FT_CONFIG_OPTION_PIC */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 886f7a0..b7713d0 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -473,7 +473,9 @@
     (FT_Get_MM_Blend_Func)  TT_Get_MM_Blend,        /* get_mm_blend   */
     (FT_Get_MM_Var_Func)    TT_Get_MM_Var,          /* get_mm_var     */
     (FT_Set_Var_Design_Func)TT_Set_Var_Design,      /* set_var_design */
-    (FT_Get_Var_Design_Func)TT_Get_Var_Design       /* get_var_design */
+    (FT_Get_Var_Design_Func)TT_Get_Var_Design,      /* get_var_design */
+
+    (FT_Done_Blend_Func)    tt_done_blend           /* done_blend     */
   )
 #endif
 
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 461369f..212358c 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2242,9 +2242,12 @@
   /*    Free the blend internal data structure.                            */
   /*                                                                       */
   FT_LOCAL_DEF( void )
-  tt_done_blend( FT_Memory  memory,
-                 GX_Blend   blend )
+  tt_done_blend( TT_Face  face )
   {
+    FT_Memory  memory = FT_FACE_MEMORY( face );
+    GX_Blend   blend  = face->blend;
+
+
     if ( blend != NULL )
     {
       FT_UInt  i, num_axes;
diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h
index dd13bd8..f3fcfc7 100644
--- a/src/truetype/ttgxvar.h
+++ b/src/truetype/ttgxvar.h
@@ -180,8 +180,7 @@ FT_BEGIN_HEADER
 
 
   FT_LOCAL( void )
-  tt_done_blend( FT_Memory  memory,
-                 GX_Blend   blend );
+  tt_done_blend( TT_Face  face );
 
 
 FT_END_HEADER
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 3e60b55..758eaeb 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -739,7 +739,7 @@
     face->cvt_program_size  = 0;
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-    tt_done_blend( memory, face->blend );
+    tt_done_blend( face );
     face->blend = NULL;
 #endif
   }
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 639d7c0..ad46371 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -125,7 +125,9 @@
     (FT_Get_MM_Blend_Func)  T1_Get_MM_Blend,       /* get_mm_blend   */
     (FT_Get_MM_Var_Func)    T1_Get_MM_Var,         /* get_mm_var     */
     (FT_Set_Var_Design_Func)T1_Set_Var_Design,     /* set_var_design */
-    (FT_Get_Var_Design_Func)T1_Get_Var_Design      /* get_var_design */
+    (FT_Get_Var_Design_Func)T1_Get_Var_Design,     /* get_var_design */
+
+    (FT_Done_Blend_Func)    T1_Done_Blend          /* done_blend     */
   };
 #endif