[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master c0f1ade: [base] Fix bitmap copying where the new pitc
From: |
Werner LEMBERG |
Subject: |
[freetype2] master c0f1ade: [base] Fix bitmap copying where the new pitch is smaller. |
Date: |
Sun, 22 Apr 2018 10:53:38 -0400 (EDT) |
branch: master
commit c0f1adedcfaad4f7d2fe912ff4b2933845d61d93
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[base] Fix bitmap copying where the new pitch is smaller.
* src/base/ftbitmap.c (ft_bitmap_assure_buffer): Handle it.
---
ChangeLog | 6 ++++++
src/base/ftbitmap.c | 58 ++++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 50 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4dc8c55..5cdf5be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2018-04-22 Werner Lemberg <address@hidden>
+ [base] Fix bitmap copying where the new pitch is smaller.
+
+ * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Handle it.
+
+2018-04-22 Werner Lemberg <address@hidden>
+
Another fix for handling invalid format 2 cmaps.
The previous commit was incomplete.
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index 93efb09..4f5ca5a 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -237,20 +237,35 @@
unsigned char* out = buffer;
unsigned char* limit = bitmap->buffer + pitch * bitmap->rows;
- unsigned int delta = new_pitch - pitch;
FT_MEM_ZERO( out, new_pitch * ypixels );
out += new_pitch * ypixels;
- while ( in < limit )
+ if ( new_pitch > pitch )
{
- FT_MEM_COPY( out, in, len );
- in += pitch;
- out += pitch;
+ unsigned int delta = new_pitch - pitch;
- FT_MEM_ZERO( out, delta );
- out += delta;
+
+ while ( in < limit )
+ {
+ FT_MEM_COPY( out, in, len );
+ in += pitch;
+ out += pitch;
+
+ /* we have to zero out the new (unused) pitch bytes */
+ FT_MEM_ZERO( out, delta );
+ out += delta;
+ }
+ }
+ else
+ {
+ while ( in < limit )
+ {
+ FT_MEM_COPY( out, in, len );
+ in += pitch;
+ out += new_pitch;
+ }
}
}
else
@@ -261,17 +276,32 @@
unsigned char* out = buffer;
unsigned char* limit = bitmap->buffer + pitch * bitmap->rows;
- unsigned int delta = new_pitch - pitch;
- while ( in < limit )
+ if ( new_pitch > pitch )
{
- FT_MEM_COPY( out, in, len );
- in += pitch;
- out += pitch;
+ unsigned int delta = new_pitch - pitch;
- FT_MEM_ZERO( out, delta );
- out += delta;
+
+ while ( in < limit )
+ {
+ FT_MEM_COPY( out, in, len );
+ in += pitch;
+ out += pitch;
+
+ /* we have to zero out the new (unused) pitch bytes */
+ FT_MEM_ZERO( out, delta );
+ out += delta;
+ }
+ }
+ else
+ {
+ while ( in < limit )
+ {
+ FT_MEM_COPY( out, in, len );
+ in += pitch;
+ out += new_pitch;
+ }
}
FT_MEM_ZERO( out, new_pitch * ypixels );
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master c0f1ade: [base] Fix bitmap copying where the new pitch is smaller.,
Werner LEMBERG <=