diff options
author | Alexei Podtelezhnikov <apodtele@gmail.com> | 2022-09-20 03:15:42 +0000 |
---|---|---|
committer | Alexei Podtelezhnikov <apodtele@gmail.com> | 2022-09-20 03:15:42 +0000 |
commit | 4dba6795b6eebd2a139b557f1dc7094b10873338 (patch) | |
tree | 74de87e81c0906ba85fb1396c69674bb4088b463 /src/base/ftbitmap.c | |
parent | 33ceac2afc3608be2d12b3dece071a91e34c3062 (diff) | |
download | freetype2-4dba6795b6eebd2a139b557f1dc7094b10873338.tar.gz |
* src/base/ftbitmap.c (FT_Bitmap_Convert): Recreate target.
There is no need to preserve bits before overwriting them.
Therefore, free-malloc could be faster than realloc.
Diffstat (limited to 'src/base/ftbitmap.c')
-rw-r--r-- | src/base/ftbitmap.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 7825895ad..2dcade968 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -542,15 +542,10 @@ case FT_PIXEL_MODE_LCD_V: case FT_PIXEL_MODE_BGRA: { - FT_Int pad, old_target_pitch, target_pitch; - FT_ULong old_size; + FT_Int pad, target_pitch; - old_target_pitch = target->pitch; - if ( old_target_pitch < 0 ) - old_target_pitch = -old_target_pitch; - - old_size = target->rows * (FT_UInt)old_target_pitch; + FT_Bitmap_Done( library, target ); target->pixel_mode = FT_PIXEL_MODE_GRAY; target->rows = source->rows; @@ -566,12 +561,7 @@ target_pitch = (FT_Int)source->width + pad; - if ( target_pitch > 0 && - (FT_ULong)target->rows > FT_ULONG_MAX / (FT_ULong)target_pitch ) - return FT_THROW( Invalid_Argument ); - - if ( FT_QREALLOC( target->buffer, - old_size, target->rows * (FT_UInt)target_pitch ) ) + if ( FT_QALLOC_MULT( target->buffer, target->rows, target_pitch ) ) return error; target->pitch = target->pitch < 0 ? -target_pitch : target_pitch; |