Re: [ft-devel] [patch] tweaks to make ftraster.c compile in _STANDALONE_ mode

2005-05-19 Thread Werner LEMBERG
  this looks nice!  Can you change your patch slightly to put
  ftmisc.h into the same directory as ftraster.c?  Similarly,
  `ftimage.h' should be expected in the same directory as ftraster.c
  if _STANDALONE_ is active.
 
 Sure

Applied, thanks.


Werner


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] [patch] tweaks to make ftraster.c compile in _STANDALONE_ mode

2005-05-14 Thread Kirill Smelkov
Hello up there!

I tweaked ftraster.c a bit to make it more _STANDALONE_ friendly.

However the old rasterizer depends not only on ftimage.h, but also
on fttypes.h  ftcalc.c 

As fttypes.h depends on 'platform dependent' types sych as FT_UInt32,
I've created small excerpt from it and other places named ftmisc.h

-- 
 



Sat May 14 15:29:58 MSD 2005  Kirill Smelkov [EMAIL PROTECTED]
  * (ftraster.c) tweaks to compile in standalone mode
diff -rN -N -u old-ftraster-standalone/ftraster.c new-ftraster-standalone/ftraster.c
--- old-ftraster-standalone/ftraster.c	2005-05-14 15:32:02.0 +0400
+++ new-ftraster-standalone/ftraster.c	2005-05-14 15:23:26.0 +0400
@@ -21,11 +21,19 @@
   /*   */
   /*/
 
+#ifdef _STANDALONE_
+
+#include priv/ftmisc.h
+#include priv/ftimage.h
+
+#else /* _STANDALONE_ */
 
 #include ft2build.h
 #include ftraster.h
 #include FT_INTERNAL_CALC_H   /* for FT_MulDiv only */
 
+#endif /* _STANDALONE_ */
+
 
   /*/
   /*   */
@@ -154,6 +162,8 @@
 
 #ifndef FT_TRACE
 #define FT_TRACE( x )  do ; while ( 0 ) /* nothing */
+#define FT_TRACE6( x ) do ; while ( 0 ) /* nothing */
+#define FT_TRACE1( x ) do ; while ( 0 ) /* nothing */
 #endif
 
 #define Raster_Err_None  0
@@ -163,6 +173,7 @@
 #define Raster_Err_Invalid  -4
 #define Raster_Err_Unsupported  -5
 
+#define ft_memset   memset
 
 #else /* _STANDALONE_ */
 
@@ -187,6 +198,9 @@
 #define FT_MEM_SET( d, s, c )  ft_memset( d, s, c )
 #endif
 
+#ifndef FT_MEM_ZERO
+#define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )
+#endif
 
   /* FMulDiv means `Fast MulDiv'; it is used in case where `b' is   */
   /* typically a small value and the result of a*b is known to fit into */
@@ -3020,7 +3034,7 @@
 return error;
 }
 
-return Raster_Err_Ok;
+return Raster_Err_None;
   }
 
 
@@ -3096,7 +3110,7 @@
 return error;
 }
 
-return Raster_Err_Ok;
+return Raster_Err_None;
   }
 
 #else /* !FT_RASTER_OPTION_ANTI_ALIASING */
@@ -3106,7 +3120,7 @@
   {
 FT_UNUSED_RASTER;
 
-return Raster_Err_Cannot_Render_Glyph;
+return Raster_Err_Unsupported;
   }
 
 #endif /* !FT_RASTER_OPTION_ANTI_ALIASING */
@@ -3155,10 +3169,10 @@
   ft_black_new( void*  memory,
 FT_Raster  *araster )
   {
- static FT_RasterRec_  the_raster;
+ static TRaster_Instance  the_raster;
 
 
- *araster = the_raster;
+ *araster = (FT_Raster)the_raster;
  FT_MEM_ZERO( the_raster, sizeof ( the_raster ) );
  ft_black_init( the_raster );
 
@@ -3170,7 +3184,7 @@
   ft_black_done( FT_Raster  raster )
   {
 /* nothing */
-raster-init = 0;
+FT_UNUSED( raster );
   }
 
 
diff -rN -N -u old-ftraster-standalone/priv/ftmisc.h new-ftraster-standalone/priv/ftmisc.h
--- old-ftraster-standalone/priv/ftmisc.h	1970-01-01 03:00:00.0 +0300
+++ new-ftraster-standalone/priv/ftmisc.h	2005-05-14 15:26:30.0 +0400
@@ -0,0 +1,47 @@
+/* Tiny addon to make standalone ftraster.c compile */
+/* XXX: not portable*/
+
+#ifndef _PRIV_FT_MISC_H
+#define _PRIV_FT_MISC_H
+
+#include string.h /* memset */
+
+#define FT_BEGIN_HEADER
+#define FT_END_HEADER
+
+#define FT_LOCAL_DEF( x )   static x
+
+/* include/freetype2/fttypes.h */
+  typedef unsigned char FT_Byte;
+  typedef signed intFT_Int;
+  typedef unsigned int  FT_UInt;
+  typedef signed long   FT_Long;
+  typedef unsigned long FT_ULong;
+  typedef signed long   FT_F26Dot6;
+  typedef int   FT_Error;
+
+/* src/ftcalc.c */
+#include inttypes.h
+  typedef int64_t  FT_Int64;
+
+  static FT_Long
+  FT_MulDiv( FT_Long  a,
+ FT_Long  b,
+ FT_Long  c )
+  {
+FT_Int   s;
+FT_Long  d;
+
+
+s = 1;
+if ( a  0 ) { a = -a; s = -1; }
+if ( b  0 ) { b = -b; s = -s; }
+if ( c  0 ) { c = -c; s = -s; }
+
+d = (FT_Long)( c  0 ? ( (FT_Int64)a * b + ( c  1 ) ) / c
+ : 0x7FFFL );
+
+return ( s  0 ) ? d : -d;
+  }
+
+#endif
diff -rN -N -u old-ftraster-standalone/README new-ftraster-standalone/README
--- old-ftraster-standalone/README	2005-05-14 15:32:02.0 +0400
+++ new-ftraster-standalone/README	2005-05-14 15:29:06.0 +0400
@@ -4,3 +4,4 @@
 ftraster.h  1.5 2001/06/28 17:48:56
 ftraster.c  1.342005/05/11 20:04:35
 ftimage.h   1.432005/05/11 20:04:34 + constify.patch
+ftmisc.h  hand made

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel