Skip to content

Commit e424514

Browse files
committed
remove debug
1 parent 2e70b59 commit e424514

2 files changed

Lines changed: 27 additions & 28 deletions

File tree

Prima/Drawable/Basic.pm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ sub draw_underline
282282
$canvas->lineWidth($lw1) if $lw0 != $lw1;
283283
my $r = $canvas->render_underline($string, $x, $y);
284284
if ( $r ) {
285-
print "LINES @$r\n";
286285
$canvas->lines($r);
287286
} elsif ( $r = $canvas->get_text_box($string)) {
288287
$canvas->line(

class/Drawable/wrap.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
#define dLIBTHAI(tb)
1313
#endif
1414

15+
#if 0
16+
#define _DEBUG
17+
#define DEBUG if(1)printf
18+
#else
19+
#define DEBUG if(0)printf
20+
#endif
21+
1522
#ifdef __cplusplus
1623
extern "C" {
1724
#endif
@@ -89,7 +96,6 @@ Drawable_call_get_font_abc( Handle self, unsigned int from, unsigned int to, int
8996
Fill the 2-int array meaning:
9097
9198
(-1,-1) - glyph doesn't intersect the descent line
92-
(0,-1) - glyph intersects the line wholly XXX
9399
(A,B) - glyph intersects the line from A to B
94100
95101
*/
@@ -98,7 +104,8 @@ static Bool
98104
check_intersections( Point a, Point b, int y0, int y1, int *x_margins)
99105
{
100106
int i;
101-
warn("? %d.%d - %d.%d x (%d %d)\n", a.x, a.y, b.x, b.y, y0, y1);
107+
108+
DEBUG("? %d.%d - %d.%d x (%d %d)\n", a.x, a.y, b.x, b.y, y0, y1);
102109
if ( a.y > b.y ) {
103110
Point s = a;
104111
a = b;
@@ -122,7 +129,7 @@ check_intersections( Point a, Point b, int y0, int y1, int *x_margins)
122129
} else if ( x_margins[0] < 0 )
123130
x_margins[0] = x_margins[1] = x;
124131
}
125-
warn("x> %d %d\n", x_margins[0], x_margins[1]);
132+
DEBUG("x> %d %d\n", x_margins[0], x_margins[1]);
126133

127134
/* mark whole line */
128135
//x_margins[0] = 0;
@@ -145,7 +152,7 @@ check_intersections( Point a, Point b, int y0, int y1, int *x_margins)
145152
x_margins[0] = x_margins[1] = x;
146153
}
147154
}
148-
warn("y> %d %d\n", x_margins[0], x_margins[1]);
155+
DEBUG("y> %d %d\n", x_margins[0], x_margins[1]);
149156
return false;
150157
}
151158

@@ -207,7 +214,7 @@ Drawable_call_get_glyph_descents( Handle self, unsigned int from, unsigned int t
207214

208215
if ( y0 >= 0 ) y0 = -1;
209216
if ( y1 >= 0 ) y1 = -1;
210-
warn("d=%d up=%d ut=%d b=%d/ y=%d %d\n", var->font.descent, up, ut, breakout, y0, y1);
217+
DEBUG("d=%d up=%d ut=%d b=%d/ y=%d %d\n", var->font.descent, up, ut, breakout, y0, y1);
211218
}
212219

213220

@@ -221,7 +228,7 @@ Drawable_call_get_glyph_descents( Handle self, unsigned int from, unsigned int t
221228

222229
/* query glyph outlines, check intersections with the underline */
223230
for ( i = j = 0; i < len; i++, j += 2) {
224-
warn("GLY %d a=%g\n", i, abc[i].a);
231+
DEBUG("GLY %d a=%g\n", i, abc[i].a);
225232
if ( abc[i].a >= breakout )
226233
continue;
227234

@@ -242,7 +249,7 @@ Drawable_call_get_glyph_descents( Handle self, unsigned int from, unsigned int t
242249
int n_subcmd = *(p++);
243250
int *p_sub, sub;
244251
k += n_subcmd * 2 + 2;
245-
warn("cmd %d\n", n_subcmd);
252+
DEBUG("cmd %d\n", n_subcmd);
246253
switch ( cmd ) {
247254
case ggoMove:
248255
anchor.x = POINT(p[0]);
@@ -285,7 +292,7 @@ Drawable_call_get_glyph_descents( Handle self, unsigned int from, unsigned int t
285292
check_intersections( curr_point, anchor, y0, y1, descents + j);
286293

287294
STOP:
288-
warn("%d => %d %d\n", i, descents[j], descents[j+1]);
295+
DEBUG("%d => %d %d\n", i, descents[j], descents[j+1]);
289296
if ( buffer )
290297
free(buffer);
291298
} else {
@@ -1495,7 +1502,7 @@ render_underline(Handle self, int x, int y, GlyphsOutRec *t, int * n_points)
14951502
float xx = x - hw; \
14961503
float this_a = ( abc[o].a < 0 ) ? -abc[o].a : 0; \
14971504
float last_c = (last_abc.c < 0) ? -last_abc.c : 0; \
1498-
warn("x %g/%d a %g c %g hw %g = %g\n", xx, hw, this_a, last_c, half_widths[hw], half_widths[hw]+xx);\
1505+
DEBUG("x %g/%d a %g c %g hw %g = %g\n", xx, hw, this_a, last_c, half_widths[hw], half_widths[hw]+xx);\
14991506
xx -= this_a + last_c; \
15001507
xx += half_widths[hw]; \
15011508
ret[ *n_points ].x = xx; \
@@ -1504,7 +1511,7 @@ render_underline(Handle self, int x, int y, GlyphsOutRec *t, int * n_points)
15041511
#define LAST_X ret[(*n_points) - 1].x
15051512
#define CHECK_POINT \
15061513
if ( *n_points > 1 && LAST_X - ret[(*n_points)-2].x <= ut ) { \
1507-
warn("skipsie!\n");\
1514+
DEBUG("skip\n");\
15081515
*n_points -= 2;\
15091516
}
15101517

@@ -1527,7 +1534,7 @@ render_underline(Handle self, int x, int y, GlyphsOutRec *t, int * n_points)
15271534

15281535
from = descents[o * 2];
15291536
to = descents[o * 2 + 1];
1530-
warn("C %d (%g %g %g = %g) => %d %d\n", t->glyphs[i], abc[o].a, abc[o].b, abc[o].c, abc[o].a+abc[o].b+abc[o].c, from, to);
1537+
DEBUG("C %d (%g %g %g = %g) => %d %d\n", t->glyphs[i], abc[o].a, abc[o].b, abc[o].c, abc[o].a+abc[o].b+abc[o].c, from, to);
15311538

15321539
if ( from < 0 ) {
15331540
if ( !line_is_on ) {
@@ -1537,55 +1544,48 @@ render_underline(Handle self, int x, int y, GlyphsOutRec *t, int * n_points)
15371544
line_is_on = true;
15381545
}
15391546
/* else continue the existing line */
1540-
} else if ( to < 0 ) {
1541-
if ( line_is_on ) {
1542-
/* stop the line */
1543-
ADD_POINT(1)
1544-
CHECK_POINT;
1545-
line_is_on = false;
1546-
}
1547-
/* else continue skipping line */
15481547
} else if ( from == 0 ) {
15491548
/* line wanted after a skip */
15501549
if ( line_is_on ) {
15511550
ADD_POINT(1)
15521551
CHECK_POINT;
1553-
warn("a0: %g\n", LAST_X);
1552+
DEBUG("a0: %g\n", LAST_X);
15541553
} else
15551554
line_is_on = true;
15561555
ADD_POINT(0)
15571556
LAST_X += to + 1;
1558-
warn("b: %g\n", LAST_X);
1557+
DEBUG("b: %g\n", LAST_X);
15591558
CHECK_POINT;
15601559
} else if ( to + 1 >= abc[o].a + abc[o].b + abc[o].c ) {
15611560
/* line wanted but not until the end */
15621561
if ( line_is_on ) {
15631562
line_is_on = false;
15641563
} else {
15651564
ADD_POINT(0)
1566-
warn("d0: %g\n", LAST_X);
1565+
DEBUG("d0: %g\n", LAST_X);
15671566
CHECK_POINT;
15681567
}
15691568
ADD_POINT(1)
15701569
LAST_X += from - 1;
15711570
CHECK_POINT;
1572-
warn("d1: %g\n", LAST_X);
1571+
DEBUG("d1: %g\n", LAST_X);
15731572
} else {
1573+
/* glyph descent breaks the line */
15741574
if ( !line_is_on ) {
15751575
ADD_POINT(0)
1576-
warn("f0: %g\n", LAST_X);
1576+
DEBUG("f0: %g\n", LAST_X);
15771577
CHECK_POINT;
15781578
line_is_on = true;
15791579
}
15801580

15811581
ADD_POINT(1);
15821582
LAST_X += from - 1;
1583-
warn("f1: %g\n", LAST_X);
1583+
DEBUG("f1: %g\n", LAST_X);
15841584
CHECK_POINT;
15851585

15861586
ADD_POINT(0)
15871587
LAST_X += to + 1;
1588-
warn("f2: %g\n", LAST_X);
1588+
DEBUG("f2: %g\n", LAST_X);
15891589
CHECK_POINT;
15901590
}
15911591

@@ -1604,7 +1604,7 @@ render_underline(Handle self, int x, int y, GlyphsOutRec *t, int * n_points)
16041604

16051605
if ((( *n_points ) % 2) == 1 ) {
16061606
int o = t->glyphs[t->len - 1] & 0xff;
1607-
warn("FINO\n");
1607+
DEBUG("FINO\n");
16081608
ADD_POINT(1)
16091609
CHECK_POINT;
16101610
}

0 commit comments

Comments
 (0)