Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers...
[reactos.git] / sdk / lib / 3rdparty / freetype / freetype_ros.diff
diff --git a/sdk/lib/3rdparty/freetype/freetype_ros.diff b/sdk/lib/3rdparty/freetype/freetype_ros.diff
new file mode 100644 (file)
index 0000000..7091ffc
--- /dev/null
@@ -0,0 +1,473 @@
+diff -prudN e:\freetype-2.6\src/autofit/afcjk.c e:\reactos\lib\3rdparty\freetype\src/autofit/afcjk.c
+--- e:\freetype-2.6\src/autofit/afcjk.c        2015-04-20 21:52:41 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/autofit/afcjk.c       2015-09-07 22:38:13 +0100
+@@ -71,7 +71,11 @@
+                               FT_Face        face )
+   {
+     /* scan the array of segments in each direction */
++#ifdef __REACTOS__
++    AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
++#else
+     AF_GlyphHintsRec  hints[1];
++#endif
+     FT_TRACE5(( "\n"
+@@ -90,7 +94,11 @@
+       FT_ULong          glyph_index;
+       FT_Long           y_offset;
+       int               dim;
++#ifdef __REACTOS__
++      AF_CJKMetricsRec *dummy = malloc(sizeof(AF_CJKMetricsRec));
++#else
+       AF_CJKMetricsRec  dummy[1];
++#endif
+       AF_Scaler         scaler = &dummy->root.scaler;
+ #ifdef FT_CONFIG_OPTION_PIC
+@@ -243,11 +251,18 @@
+         }
+ #endif
+       }
++#ifdef __REACTOS__
++      free(dummy);
++#endif
+     }
+     FT_TRACE5(( "\n" ));
+     af_glyph_hints_done( hints );
++
++#ifdef __REACTOS__
++    free(hints);
++#endif
+   }
+diff -prudN e:\freetype-2.6\src/autofit/aflatin.c e:\reactos\lib\3rdparty\freetype\src/autofit/aflatin.c
+--- e:\freetype-2.6\src/autofit/aflatin.c      2015-04-20 21:52:58 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/autofit/aflatin.c     2015-09-08 11:08:25 +0100
+@@ -58,7 +58,11 @@
+                                 FT_Face          face )
+   {
+     /* scan the array of segments in each direction */
++#ifdef __REACTOS__
++    AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
++#else
+     AF_GlyphHintsRec  hints[1];
++#endif
+     FT_TRACE5(( "\n"
+@@ -77,7 +81,11 @@
+       FT_ULong            glyph_index;
+       FT_Long             y_offset;
+       int                 dim;
++#ifdef __REACTOS__
++      AF_LatinMetricsRec *dummy = malloc(sizeof(AF_LatinMetricsRec));
++#else
+       AF_LatinMetricsRec  dummy[1];
++#endif
+       AF_Scaler           scaler = &dummy->root.scaler;
+ #ifdef FT_CONFIG_OPTION_PIC
+@@ -243,11 +251,19 @@
+         }
+ #endif
+       }
++#ifdef __REACTOS__
++      free(dummy);
++#endif
+     }
+     FT_TRACE5(( "\n" ));
+     af_glyph_hints_done( hints );
++
++#ifdef __REACTOS__
++    free(hints);
++#endif
++
+   }
+diff -prudN e:\freetype-2.6\src/autofit/afmodule.c e:\reactos\lib\3rdparty\freetype\src/autofit/afmodule.c
+--- e:\freetype-2.6\src/autofit/afmodule.c     2015-06-07 05:44:38 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/autofit/afmodule.c    2015-09-07 20:58:52 +0100
+@@ -351,9 +351,13 @@
+     return error;
+ #else /* !FT_DEBUG_AUTOFIT */
+-
++#ifdef __REACTOS__
++    AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
++    AF_LoaderRec *loader = malloc(sizeof(AF_LoaderRec));
++#else
+     AF_GlyphHintsRec  hints[1];
+     AF_LoaderRec      loader[1];
++#endif
+     FT_UNUSED( size );
+@@ -367,6 +371,11 @@
+     af_loader_done( loader );
+     af_glyph_hints_done( hints );
++#ifdef __REACTOS__
++    free(hints);
++    free(loader);
++#endif
++
+     return error;
+ #endif /* !FT_DEBUG_AUTOFIT */
+diff -prudN e:\freetype-2.6\src/base/ftbitmap.c e:\reactos\lib\3rdparty\freetype\src/base/ftbitmap.c
+--- e:\freetype-2.6\src/base/ftbitmap.c        2015-03-11 06:47:11 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/base/ftbitmap.c       2015-09-07 17:20:37 +0100
+@@ -577,7 +577,16 @@
+           {
+             FT_Int  val = ss[0]; /* avoid a byte->int cast on each line */
+-
++#ifdef __REACTOS__
++            tt[0] = (FT_Byte)( ( val & 0x80 ) ? 0xff : 0);
++            tt[1] = (FT_Byte)( ( val & 0x40 ) ? 0xff : 0);
++            tt[2] = (FT_Byte)( ( val & 0x20 ) ? 0xff : 0);
++            tt[3] = (FT_Byte)( ( val & 0x10 ) ? 0xff : 0);
++            tt[4] = (FT_Byte)( ( val & 0x08 ) ? 0xff : 0);
++            tt[5] = (FT_Byte)( ( val & 0x04 ) ? 0xff : 0);
++            tt[6] = (FT_Byte)( ( val & 0x02 ) ? 0xff : 0);
++            tt[7] = (FT_Byte)( ( val & 0x01 ) ? 0xff : 0);
++#else
+             tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 );
+             tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 );
+             tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 );
+@@ -586,6 +595,7 @@
+             tt[5] = (FT_Byte)( ( val & 0x04 ) >> 2 );
+             tt[6] = (FT_Byte)( ( val & 0x02 ) >> 1 );
+             tt[7] = (FT_Byte)(   val & 0x01 );
++#endif
+             tt += 8;
+             ss += 1;
+@@ -600,7 +610,11 @@
+             for ( ; j > 0; j-- )
+             {
++#ifdef __REACTOS__
++              tt[0] = (FT_Byte)( ( val & 0x80 ) ? 0xff : 0);
++#else
+               tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7);
++#endif
+               val <<= 1;
+               tt   += 1;
+             }
+diff -prudN e:\freetype-2.6\src/cff/cf2intrp.c e:\reactos\lib\3rdparty\freetype\src/cff/cf2intrp.c
+--- e:\freetype-2.6\src/cff/cf2intrp.c 2015-05-12 06:22:36 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/cff/cf2intrp.c        2015-09-08 10:46:46 +0100
+@@ -463,7 +463,13 @@
+     CF2_ArrStackRec  vStemHintArray;
+     CF2_HintMaskRec   hintMask;
++#ifdef __REACTOS__
++    CF2_GlyphPathRec *glyphPath = malloc(sizeof(CF2_GlyphPathRec));
++/* Ugly but it allows us to reduce the diff */
++#define glyphPath (*glyphPath)
++#else
+     CF2_GlyphPathRec  glyphPath;
++#endif
+     /* initialize the remaining objects */
+@@ -1197,7 +1203,13 @@
+            * discard `counterMask' and `counterHintMap'.
+            *
+            */
++#ifdef __REACTOS__
++          CF2_HintMapRec *counterHintMap = malloc(sizeof(CF2_HintMapRec));
++/* Ugly but it allows us to reduce the diff */
++#define counterHintMap (*counterHintMap)
++#else
+           CF2_HintMapRec   counterHintMap;
++#endif
+           CF2_HintMaskRec  counterMask;
+@@ -1218,6 +1230,9 @@
+                              &counterMask,
+                              0,
+                              FALSE );
++#ifdef __REACTOS__
++          free(&counterHintMap);
++#endif
+         }
+         break;
+@@ -1564,6 +1579,12 @@
+     FT_TRACE4(( "\n" ));
++#ifdef __REACTOS__
++    free(&glyphPath);
++#undef counterHintMap
++#undef glyphPath
++#endif
++
+     return;
+   }
+diff -prudN e:\freetype-2.6\src/cid/cidgload.c e:\reactos\lib\3rdparty\freetype\src/cid/cidgload.c
+--- e:\freetype-2.6\src/cid/cidgload.c 2015-04-16 06:02:23 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/cid/cidgload.c        2015-09-08 10:59:15 +0100
+@@ -273,7 +273,13 @@
+   {
+     CID_GlyphSlot  glyph = (CID_GlyphSlot)cidglyph;
+     FT_Error       error;
++#ifdef __REACTOS__
++    T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
++/* Ugly but it allows us to reduce the diff */
++#define decoder (*decoder)
++#else
+     T1_DecoderRec  decoder;
++#endif
+     CID_Face       face = (CID_Face)cidglyph->face;
+     FT_Bool        hinting;
+@@ -435,6 +441,10 @@
+     }
+   Exit:
++#ifdef __REACTOS__
++    free(&decoder);
++#undef decoder
++#endif
+     return error;
+   }
+diff -prudN e:\freetype-2.6\src/raster/ftraster.c e:\reactos\lib\3rdparty\freetype\src/raster/ftraster.c
+--- e:\freetype-2.6\src/raster/ftraster.c      2015-06-02 10:21:17 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/raster/ftraster.c     2015-09-08 11:09:33 +0100
+@@ -3136,9 +3136,15 @@
+     const FT_Outline*  outline    = (const FT_Outline*)params->source;
+     const FT_Bitmap*   target_map = params->target;
++#ifdef __REACTOS__
++    FT_Error ret;
++    black_TWorker *worker;
++    Long *buffer;
++#else
+     black_TWorker  worker[1];
+     Long  buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( Long )];
++#endif
+     if ( !raster )
+@@ -3175,13 +3181,29 @@
+     if ( !target_map->buffer )
+       return FT_THROW( Invalid );
++#ifdef __REACTOS__
++    worker = malloc(sizeof(black_TWorker));
++    buffer = malloc(FT_MAX(FT_RENDER_POOL_SIZE, 2048));
++#endif
++
+     ras.outline = *outline;
+     ras.target  = *target_map;
+     worker->buff     = buffer;
++#ifdef __REACTOS__
++    worker->sizeBuff = buffer + (FT_MAX(FT_RENDER_POOL_SIZE, 2048) / sizeof(Long));
++#else
+     worker->sizeBuff = (&buffer)[1]; /* Points to right after buffer. */
++#endif
++#ifdef __REACTOS__
++    ret = Render_Glyph(RAS_VAR);
++    free(worker);
++    free(buffer);
++    return ret;
++#else
+     return Render_Glyph( RAS_VAR );
++#endif
+   }
+diff -prudN e:\freetype-2.6\src/smooth/ftgrays.c e:\reactos\lib\3rdparty\freetype\src/smooth/ftgrays.c
+--- e:\freetype-2.6\src/smooth/ftgrays.c       2015-03-11 06:47:11 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/smooth/ftgrays.c      2015-09-08 09:57:56 +0100
+@@ -1940,10 +1940,17 @@ typedef ptrdiff_t  FT_PtrDist;
+     const FT_Outline*  outline     = (const FT_Outline*)params->source;
+     const FT_Bitmap*   target_map  = params->target;
++#ifdef __REACTOS__
++    gray_TWorker *worker;
++    int ret;
++    TCell *buffer;
++    long buffer_size = FT_MAX(FT_RENDER_POOL_SIZE, 2048);
++#else
+     gray_TWorker  worker[1];
+     TCell  buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( TCell )];
+     long   buffer_size = sizeof ( buffer );
++#endif
+     int    band_size   = (int)( buffer_size /
+                                 (long)( sizeof ( TCell ) * 8 ) );
+@@ -1983,6 +1990,10 @@ typedef ptrdiff_t  FT_PtrDist;
+     if ( !( params->flags & FT_RASTER_FLAG_AA ) )
+       return FT_THROW( Invalid_Mode );
++#ifdef __REACTOS__
++    worker = malloc(sizeof(gray_TWorker));
++#endif
++
+     /* compute clipping box */
+     if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
+     {
+@@ -2002,6 +2013,10 @@ typedef ptrdiff_t  FT_PtrDist;
+       ras.clip_box.yMax =  32767L;
+     }
++#ifdef __REACTOS__
++    buffer = malloc(buffer_size);
++#endif
++
+     gray_init_cells( RAS_VAR_ buffer, buffer_size );
+     ras.outline        = *outline;
+@@ -2023,7 +2038,14 @@ typedef ptrdiff_t  FT_PtrDist;
+       ras.render_span_data = &ras;
+     }
++#ifdef __REACTOS__
++    ret = gray_convert_glyph(RAS_VAR);
++    free(worker);
++    free(buffer);
++    return ret;
++#else
+     return gray_convert_glyph( RAS_VAR );
++#endif
+   }
+diff -prudN e:\freetype-2.6\src/type1/t1gload.c e:\reactos\lib\3rdparty\freetype\src/type1/t1gload.c
+--- e:\freetype-2.6\src/type1/t1gload.c        2015-04-13 17:14:02 +0100
++++ e:\reactos\lib\3rdparty\freetype\src/type1/t1gload.c       2015-09-08 10:55:18 +0100
+@@ -154,7 +154,13 @@
+                           FT_Pos*  max_advance )
+   {
+     FT_Error       error;
++#ifdef __REACTOS__
++    T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
++/* Ugly but it allows us to reduce the diff */
++#define decoder (*decoder)
++#else
+     T1_DecoderRec  decoder;
++#endif
+     FT_Int         glyph_index;
+     T1_Font        type1 = &face->type1;
+     PSAux_Service  psaux = (PSAux_Service)face->psaux;
+@@ -175,7 +181,14 @@
+                                            FT_RENDER_MODE_NORMAL,
+                                            T1_Parse_Glyph );
+     if ( error )
++#ifdef __REACTOS__
++    {
++        free(&decoder);
++        return error;
++    }
++#else
+       return error;
++#endif
+     decoder.builder.metrics_only = 1;
+     decoder.builder.load_points  = 0;
+@@ -202,7 +215,10 @@
+     }
+     psaux->t1_decoder_funcs->done( &decoder );
+-
++#ifdef __REACTOS__
++    free(&decoder);
++#undef decoder
++#endif
+     return FT_Err_Ok;
+   }
+@@ -215,7 +231,13 @@
+                    FT_Fixed*  advances )
+   {
+     T1_Face        face  = (T1_Face)t1face;
++#ifdef __REACTOS__
++    T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
++/* Ugly but it allows us to reduce the diff */
++#define decoder (*decoder)
++#else
+     T1_DecoderRec  decoder;
++#endif
+     T1_Font        type1 = &face->type1;
+     PSAux_Service  psaux = (PSAux_Service)face->psaux;
+     FT_UInt        nn;
+@@ -227,6 +249,9 @@
+       for ( nn = 0; nn < count; nn++ )
+         advances[nn] = 0;
++#ifdef __REACTOS__
++      free(&decoder);
++#endif
+       return FT_Err_Ok;
+     }
+@@ -240,7 +265,14 @@
+                                            FT_RENDER_MODE_NORMAL,
+                                            T1_Parse_Glyph );
+     if ( error )
++#ifdef __REACTOS__
++    {
++        free(&decoder);
++        return error;
++    }
++#else
+       return error;
++#endif
+     decoder.builder.metrics_only = 1;
+     decoder.builder.load_points  = 0;
+@@ -260,7 +292,10 @@
+       else
+         advances[nn] = 0;
+     }
+-
++#ifdef __REACTOS__
++    free(&decoder);
++#undef decoder
++#endif
+     return FT_Err_Ok;
+   }
+@@ -273,7 +308,13 @@
+   {
+     T1_GlyphSlot            glyph = (T1_GlyphSlot)t1glyph;
+     FT_Error                error;
++#ifdef __REACTOS__
++    T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
++/* Ugly but it allows us to reduce the diff */
++#define decoder (*decoder)
++#else
+     T1_DecoderRec           decoder;
++#endif
+     T1_Face                 face = (T1_Face)t1glyph->face;
+     FT_Bool                 hinting;
+     T1_Font                 type1         = &face->type1;
+@@ -512,6 +553,10 @@
+     if ( must_finish_decoder )
+       decoder_funcs->done( &decoder );
++#ifdef __REACTOS__
++    free(&decoder);
++#undef decoder
++#endif
+     return error;
+   }