From 0358b21d8595e0ce6d07947d5f4c6d8e19021992 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 10 Feb 2005 16:59:37 +0000 Subject: [PATCH] Formatting. --- ChangeLog | 13 ++++++------- src/base/ftbitmap.c | 30 ++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac8f8c052..360861bef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,14 +1,13 @@ 2005-02-10 David Turner - * src/pfr/pfrgload.c (pfr_glyph_load): fixed an unbounded growing - dynamic array when loading a glyph from a PFR font. This fixes - bug #11921 + * src/pfr/pfrgload.c (pfr_glyph_load): Fix an unbounded growing + dynamic array when loading a glyph from a PFR font (Savannah bug + #11921). - * src/base/ftbitmap.c (FT_Bitmap_Convert): small improvements to the - conversion function (mainly stupid optimization, because I like - these... shame on me) + * src/base/ftbitmap.c (FT_Bitmap_Convert): Small improvements to the + conversion function (mainly stupid optimization). - * src/base/Jamfile: adding ftbitmap.c to the list of compiled files + * src/base/Jamfile: Adding ftbitmap.c to the list of compiled files. 2005-02-10 Werner Lemberg diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 1ad455613..9f8cbf755 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -63,6 +63,7 @@ FT_Int pad; FT_Long old_size; + old_size = target->rows * target->pitch; if ( old_size < 0 ) old_size = -old_size; @@ -81,7 +82,7 @@ target->pitch = source->width + pad; - if ( target->rows * target->pitch > old_size && + if ( target->rows * target->pitch > old_size && FT_QREALLOC( target->buffer, old_size, target->rows * target->pitch ) ) return error; @@ -100,6 +101,7 @@ FT_Byte* t = target->buffer; FT_Int i; + target->num_grays = 2; for ( i = source->rows; i > 0; i-- ) @@ -108,11 +110,13 @@ FT_Byte* tt = t; FT_Int j; + /* get the full bytes */ for ( j = source->width >> 3; j > 0; j-- ) { FT_Int val = ss[0]; /* avoid a byte->int cast on each line */ + tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 ); tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 ); tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 ); @@ -132,9 +136,10 @@ { FT_Int val = *ss; + for ( ; j > 0; j-- ) { - tt[0] = (FT_Byte)(( val & 0x80 ) >> 7); + tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7); val <<= 1; tt += 1; } @@ -156,6 +161,7 @@ FT_Int t_pitch = target->pitch; FT_Int i; + target->num_grays = 256; for ( i = source->rows; i > 0; i-- ) @@ -175,6 +181,7 @@ FT_Byte* t = target->buffer; FT_Int i; + target->num_grays = 4; for ( i = source->rows; i > 0; i-- ) @@ -183,15 +190,17 @@ FT_Byte* tt = t; FT_Int j; + /* get the full bytes */ for ( j = source->width >> 2; j > 0; j-- ) { FT_Int val = ss[0]; - tt[0] = (FT_Byte)( (val & 0xC0) >> 6 ); - tt[1] = (FT_Byte)( (val & 0x30) >> 4 ); - tt[2] = (FT_Byte)( (val & 0x0C) >> 2 ); - tt[3] = (FT_Byte)( (val & 0x03) ); + + tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 ); + tt[1] = (FT_Byte)( ( val & 0x30 ) >> 4 ); + tt[2] = (FT_Byte)( ( val & 0x0C ) >> 2 ); + tt[3] = (FT_Byte)( ( val & 0x03 ) ); ss += 1; tt += 4; @@ -202,6 +211,7 @@ { FT_Int val = ss[0]; + for ( ; j > 0; j-- ) { tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 ); @@ -223,6 +233,7 @@ FT_Byte* t = target->buffer; FT_Int i; + target->num_grays = 16; for ( i = source->rows; i > 0; i-- ) @@ -231,13 +242,15 @@ FT_Byte* tt = t; FT_Int j; + /* get the full bytes */ for ( j = source->width >> 1; j > 0; j-- ) { FT_Int val = ss[0]; - tt[0] = (FT_Byte)( (val & 0xF0) >> 4 ); - tt[1] = (FT_Byte)( (val & 0x0F) ); + + tt[0] = (FT_Byte)( ( val & 0xF0 ) >> 4 ); + tt[1] = (FT_Byte)( ( val & 0x0F ) ); ss += 1; tt += 2; @@ -252,6 +265,7 @@ } break; + default: ; }