freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master a0e10a87f: [raster] Slightly improve the pool design.


From: Werner Lemberg
Subject: [freetype2] master a0e10a87f: [raster] Slightly improve the pool design.
Date: Mon, 23 Oct 2023 17:53:05 -0400 (EDT)

branch: master
commit a0e10a87f5d4f5e2cb9774f3f20ef3c8bd6b81b3
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [raster] Slightly improve the pool design.
    
    * src/raster/ftraster.c (TProfile): Include the variable array member
    and repackage with pointers first.
    (New_Profile): Advance the top using the variable array pointer.
---
 src/raster/ftraster.c | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 0c6acd20e..33689afd2 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -305,16 +305,6 @@
   typedef unsigned char   Byte, *PByte;
   typedef char            Bool;
 
-
-  typedef union  Alignment_
-  {
-    Long    l;
-    void*   p;
-    void  (*f)(void);
-
-  } Alignment, *PAlignment;
-
-
   typedef struct  TPoint_
   {
     Long  x;
@@ -345,31 +335,28 @@
 
   struct  TProfile_
   {
-    FT_F26Dot6  X;           /* current coordinate during sweep          */
     PProfile    link;        /* link to next profile (various purposes)  */
+    PProfile    next;        /* next profile in same contour, used       */
+                             /* during drop-out control                  */
     PLong       offset;      /* start of profile's data in render pool   */
+    Long        height;      /* profile's height in scanlines            */
+    Long        start;       /* profile's starting scanline              */
     UShort      flags;       /* Bit 0-2: drop-out mode                   */
                              /* Bit 3: profile orientation (up/down)     */
                              /* Bit 4: is top profile?                   */
                              /* Bit 5: is bottom profile?                */
-    Long        height;      /* profile's height in scanlines            */
-    Long        start;       /* profile's starting scanline              */
 
     Int         countL;      /* number of lines to step before this      */
                              /* profile becomes drawable                 */
-
-    PProfile    next;        /* next profile in same contour, used       */
-                             /* during drop-out control                  */
+    FT_F26Dot6  X;           /* current coordinate during sweep          */
+    Long        x[1];        /* actually variable array of scanline      */
+                             /* intersections with `height` elements     */
   };
 
   typedef PProfile   TProfileList;
   typedef PProfile*  PProfileList;
 
 
-#define AlignProfileSize \
-  ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( Long ) )
-
-
 #undef RAS_ARG
 #undef RAS_ARGS
 #undef RAS_VAR
@@ -670,7 +657,7 @@
     if ( !ras.cProfile || ras.cProfile->height )
     {
       ras.cProfile  = (PProfile)ras.top;
-      ras.top      += AlignProfileSize;
+      ras.top       = ras.cProfile->x;
 
       if ( ras.top >= ras.maxBuff )
       {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]