Revert "[base] Fix bitmap copying where the new pitch is smaller." This reverts commit c0f1adedcfaad4f7d2fe912ff4b2933845d61d93.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
diff --git a/ChangeLog b/ChangeLog
index 5cdf5be..4dc8c55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,5 @@
2018-04-22 Werner Lemberg <wl@gnu.org>
- [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 <wl@gnu.org>
-
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 4f5ca5a..93efb09 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -237,35 +237,20 @@
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;
- if ( new_pitch > pitch )
+ while ( in < limit )
{
- unsigned int delta = new_pitch - pitch;
+ FT_MEM_COPY( out, in, len );
+ in += pitch;
+ out += pitch;
-
- 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, delta );
+ out += delta;
}
}
else
@@ -276,32 +261,17 @@
unsigned char* out = buffer;
unsigned char* limit = bitmap->buffer + pitch * bitmap->rows;
+ unsigned int delta = new_pitch - pitch;
- if ( new_pitch > pitch )
+ while ( in < limit )
{
- unsigned int delta = new_pitch - pitch;
+ FT_MEM_COPY( out, in, len );
+ in += pitch;
+ out += pitch;
-
- 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, delta );
+ out += delta;
}
FT_MEM_ZERO( out, new_pitch * ypixels );