diff options
author | Werner Lemberg <wl@gnu.org> | 2005-02-10 16:59:37 +0000 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2005-02-10 16:59:37 +0000 |
commit | 0358b21d8595e0ce6d07947d5f4c6d8e19021992 (patch) | |
tree | 1d30c6f94e9da1ac46f475507226fdcfe79ba5b1 /src/base/ftbitmap.c | |
parent | e99b9a99d7ff1025d6b8694c5be81c7871811a8e (diff) | |
download | freetype2-0358b21d8595e0ce6d07947d5f4c6d8e19021992.tar.gz |
Formatting.
Diffstat (limited to 'src/base/ftbitmap.c')
-rw-r--r-- | src/base/ftbitmap.c | 30 |
1 files changed, 22 insertions, 8 deletions
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: ; } |