summaryrefslogtreecommitdiff
path: root/src/base/ftbitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/ftbitmap.c')
-rw-r--r--src/base/ftbitmap.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index 53f02ae55..99afbd976 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -67,8 +67,7 @@
FT_Memory memory;
FT_Error error = FT_Err_Ok;
FT_Int pitch;
-
- FT_Int source_pitch_sign, target_pitch_sign;
+ FT_Int flip;
if ( !library )
@@ -80,15 +79,15 @@
if ( source == target )
return FT_Err_Ok;
- source_pitch_sign = source->pitch < 0 ? -1 : 1;
- target_pitch_sign = target->pitch < 0 ? -1 : 1;
+ flip = ( source->pitch < 0 && target->pitch > 0 ) ||
+ ( source->pitch > 0 && target->pitch < 0 );
memory = library->memory;
FT_FREE( target->buffer );
*target = *source;
- if ( source_pitch_sign != target_pitch_sign )
+ if ( flip )
target->pitch = -target->pitch;
if ( !source->buffer )
@@ -102,10 +101,7 @@
if ( !error )
{
- if ( source_pitch_sign == target_pitch_sign )
- FT_MEM_COPY( target->buffer, source->buffer,
- (FT_Long)source->rows * pitch );
- else
+ if ( flip )
{
/* take care of bitmap flow */
FT_UInt i;
@@ -123,6 +119,9 @@
t -= pitch;
}
}
+ else
+ FT_MEM_COPY( target->buffer, source->buffer,
+ (FT_Long)source->rows * pitch );
}
return error;