freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 2e68785: * src/cache/ftcsbits.c (ftc_snode_load): Pro


From: Werner Lemberg
Subject: [freetype2] master 2e68785: * src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch.
Date: Sat, 17 Apr 2021 09:01:27 -0400 (EDT)

branch: master
commit 2e68785e08a409ca16427924b1e34740339f09a7
Author: Daniel Welty <@danielwelty>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch.
---
 ChangeLog            | 4 ++++
 src/cache/ftcsbits.c | 7 ++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 44ba980..a6d8f80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-16  Daniel Welty  <@danielwelty>
+
+       * src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch.
+
 2021-04-16  Werner Lemberg  <wl@gnu.org>
 
        * builds/unix/freetype2.m4: Fix help string formatting.
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 8ec76c5..93d5367 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -143,12 +143,13 @@
         goto BadGlyph;
       }
 
-      /* Check whether our values fit into 8-bit containers!    */
+      /* Check whether our values fit into 8/16-bit containers! */
       /* If this is not the case, our bitmap is too large       */
       /* and we will leave it as `missing' with sbit.buffer = 0 */
 
 #define CHECK_CHAR( d )  ( temp = (FT_Char)d, (FT_Int) temp == (FT_Int) d )
 #define CHECK_BYTE( d )  ( temp = (FT_Byte)d, (FT_UInt)temp == (FT_UInt)d )
+#define CHECK_SHRT( d )  ( temp = (FT_Short)d, (FT_Int)temp == (FT_Int) d )
 
       /* horizontal advance in pixels */
       xadvance = ( slot->advance.x + 32 ) >> 6;
@@ -156,7 +157,7 @@
 
       if ( !CHECK_BYTE( bitmap->rows  )     ||
            !CHECK_BYTE( bitmap->width )     ||
-           !CHECK_CHAR( bitmap->pitch )     ||
+           !CHECK_SHRT( bitmap->pitch )     ||
            !CHECK_CHAR( slot->bitmap_left ) ||
            !CHECK_CHAR( slot->bitmap_top  ) ||
            !CHECK_CHAR( xadvance )          ||
@@ -169,7 +170,7 @@
 
       sbit->width     = (FT_Byte)bitmap->width;
       sbit->height    = (FT_Byte)bitmap->rows;
-      sbit->pitch     = (FT_Char)bitmap->pitch;
+      sbit->pitch     = (FT_Short)bitmap->pitch;
       sbit->left      = (FT_Char)slot->bitmap_left;
       sbit->top       = (FT_Char)slot->bitmap_top;
       sbit->xadvance  = (FT_Char)xadvance;



reply via email to

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