[base] Netpbm image tracing. * src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size. (FT_Render_Glyph_Internal): Trace bitmap in Netpbm format. * src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing.
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 104 105 106 107 108
diff --git a/ChangeLog b/ChangeLog
index 1ee88ca..6b4eca8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2017-10-14 Alexei Podtelezhnikov <apodtele@gmail.com>
+ [base] Netpbm image tracing.
+
+ * src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size.
+ (FT_Render_Glyph_Internal): Trace bitmap in Netpbm format.
+
+ * src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing.
+
+2017-10-14 Alexei Podtelezhnikov <apodtele@gmail.com>
+
* builds/windows/ftdebug.c (FT_Message): Print to stderr.
* builds/wince/ftdebug.c (FT_Message): Ditto.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 3569ca2..56277d6 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1004,6 +1004,10 @@
ft_glyphslot_preset_bitmap( slot, mode, NULL );
}
+ FT_TRACE5(( " bitmap pixel_mode: %d\n" , slot->bitmap.pixel_mode ));
+ FT_TRACE5(( " bitmap dimensions: %dx%d\n" , slot->bitmap.width,
+ slot->bitmap.rows ));
+
Exit:
return error;
}
@@ -4583,6 +4587,51 @@
}
}
+ /*
+ * Dump bitmap in Netpbm format (PBM or PGM).
+ */
+
+ /* we use FT_TRACE2 in this block */
+ if ( ft_trace_levels[trace_bitmap] >= 2 &&
+ !error &&
+ slot->bitmap.rows < 128U &&
+ slot->bitmap.width < 128U )
+ {
+ int rows = (int)slot->bitmap.rows;
+ int width = (int)slot->bitmap.width;
+ int pitch = slot->bitmap.pitch;
+ int i, j, m;
+ unsigned char* topleft = slot->bitmap.buffer;
+
+ if ( pitch < 0 )
+ topleft -= pitch * ( rows - 1 );
+
+ FT_TRACE2(( "Netpbm image: start\n" ));
+ switch ( slot->bitmap.pixel_mode )
+ {
+ case FT_PIXEL_MODE_MONO:
+ FT_TRACE2(( "P1 %d %d\n", width, rows ));
+ for ( i = 0; i < rows; i++ )
+ {
+ for ( j = 0; j < width; )
+ for ( m = 128; m > 0 && j < width; m >>= 1, j++ )
+ FT_TRACE2(( " %d", ( topleft[i * pitch + j / 8] & m ) != 0 ));
+ FT_TRACE2(( "\n" ));
+ }
+ break;
+
+ default:
+ FT_TRACE2(( "P2 %d %d 255\n", width, rows ));
+ for ( i = 0; i < rows; i++ )
+ {
+ for ( j = 0; j < width; j += 1 )
+ FT_TRACE2(( " %3u", topleft[i * pitch + j] ));
+ FT_TRACE2(( "\n" ));
+ }
+ }
+ FT_TRACE2(( "Netpbm image: end\n" ));
+ }
+
#undef FT_COMPONENT
#define FT_COMPONENT trace_objs
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index df645e6..e84e38d 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1300,8 +1300,6 @@ typedef ptrdiff_t FT_PtrDist;
int y;
- FT_TRACE7(( "gray_sweep: start\n" ));
-
for ( y = ras.min_ey; y < ras.max_ey; y++ )
{
PCell cell = ras.ycells[y - ras.min_ey];
@@ -1327,8 +1325,6 @@ typedef ptrdiff_t FT_PtrDist;
if ( cover != 0 )
gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x );
}
-
- FT_TRACE7(( "gray_sweep: end\n" ));
}