diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-07-27 17:26:17 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-08-08 17:55:37 +0200 |
commit | c070aff6e41582b432e96dfcc0f5c6d48b961d3f (patch) | |
tree | 38e4e236ff715ed2adb7fa96f0dca7822a0db2a1 | |
parent | b3193c6d5f620a7cebb748b360692fcde01127ec (diff) | |
download | mupdf-c070aff6e41582b432e96dfcc0f5c6d48b961d3f.tar.xz |
Consistent use of whitespace in XML in trace device. Also print image size.
-rw-r--r-- | fitz/dev_trace.c | 86 |
1 files changed, 44 insertions, 42 deletions
diff --git a/fitz/dev_trace.c b/fitz/dev_trace.c index b3c73ff2..514ee780 100644 --- a/fitz/dev_trace.c +++ b/fitz/dev_trace.c @@ -3,14 +3,14 @@ static void fz_trace_matrix(fz_matrix ctm) { - printf("matrix=\"%g %g %g %g %g %g\" ", + printf(" matrix=\"%g %g %g %g %g %g\"", ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f); } static void fz_trace_trm(fz_matrix trm) { - printf("trm=\"%g %g %g %g\" ", + printf(" trm=\"%g %g %g %g\"", trm.a, trm.b, trm.c, trm.d); } @@ -18,12 +18,12 @@ static void fz_trace_color(fz_colorspace *colorspace, float *color, float alpha) { int i; - printf("colorspace=\"%s\" color=\"", colorspace->name); + printf(" colorspace=\"%s\" color=\"", colorspace->name); for (i = 0; i < colorspace->n; i++) printf("%s%g", i == 0 ? "" : " ", color[i]); - printf("\" "); + printf("\""); if (alpha < 1) - printf("alpha=\"%g\" ", alpha); + printf(" alpha=\"%g\"", alpha); } static void @@ -41,26 +41,26 @@ fz_trace_path(fz_path *path, int indent) case FZ_MOVETO: x = path->items[i++].v; y = path->items[i++].v; - printf("<moveto x=\"%g\" y=\"%g\" />\n", x, y); + printf("<moveto x=\"%g\" y=\"%g\"/>\n", x, y); break; case FZ_LINETO: x = path->items[i++].v; y = path->items[i++].v; - printf("<lineto x=\"%g\" y=\"%g\" />\n", x, y); + printf("<lineto x=\"%g\" y=\"%g\"/>\n", x, y); break; case FZ_CURVETO: x = path->items[i++].v; y = path->items[i++].v; - printf("<curveto x1=\"%g\" y1=\"%g\" ", x, y); + printf("<curveto x1=\"%g\" y1=\"%g\"", x, y); x = path->items[i++].v; y = path->items[i++].v; - printf("x2=\"%g\" y2=\"%g\" ", x, y); + printf(" x2=\"%g\" y2=\"%g\"", x, y); x = path->items[i++].v; y = path->items[i++].v; - printf("x3=\"%g\" y3=\"%g\" />\n", x, y); + printf(" x3=\"%g\" y3=\"%g\"/>\n", x, y); break; case FZ_CLOSE_PATH: - printf("<closepath />\n"); + printf("<closepath/>\n"); break; } } @@ -70,11 +70,11 @@ static void fz_trace_fill_path(fz_device *dev, fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) { - printf("<fill_path "); + printf("<fill_path"); if (even_odd) - printf("winding=\"eofill\" "); + printf(" winding=\"eofill\""); else - printf("winding=\"nonzero\" "); + printf(" winding=\"nonzero\""); fz_trace_color(colorspace, color, alpha); fz_trace_matrix(ctm); printf(">\n"); @@ -88,17 +88,17 @@ fz_trace_stroke_path(fz_device *dev, fz_path *path, fz_stroke_state *stroke, fz_ { int i; - printf("<stroke_path "); - printf("linewidth=\"%g\" ", stroke->linewidth); - printf("miterlimit=\"%g\" ", stroke->miterlimit); - printf("linecap=\"%d,%d,%d\" ", stroke->start_cap, stroke->dash_cap, stroke->end_cap); - printf("linejoin=\"%d\" ", stroke->linejoin); + printf("<stroke_path"); + printf(" linewidth=\"%g\"", stroke->linewidth); + printf(" miterlimit=\"%g\"", stroke->miterlimit); + printf(" linecap=\"%d,%d,%d\"", stroke->start_cap, stroke->dash_cap, stroke->end_cap); + printf(" linejoin=\"%d\"", stroke->linejoin); if (stroke->dash_len) { - printf("dash_phase=\"%g\" dash=\"", stroke->dash_phase); + printf(" dash_phase=\"%g\" dash=\"", stroke->dash_phase); for (i = 0; i < stroke->dash_len; i++) - printf("%g ", stroke->dash_list[i]); + printf("%s%g", i > 0 ? " " : "", stroke->dash_list[i]); printf("\""); } @@ -116,12 +116,11 @@ fz_trace_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, f { printf("<clip_path "); if (even_odd) - printf("winding=\"eofill\" "); + printf(" winding=\"eofill\""); else - printf("winding=\"nonzero\" "); + printf(" winding=\"nonzero\""); fz_trace_matrix(ctm); - printf("contentbbox=\"%g %g %g %g\">\n", - rect->x0, rect->y0, rect->x1, rect->y1); + printf(" contentbbox=\"%g %g %g %g\">\n", rect->x0, rect->y0, rect->x1, rect->y1); fz_trace_path(path, 0); printf("</clip_path>\n"); } @@ -129,7 +128,7 @@ fz_trace_clip_path(fz_device *dev, fz_path *path, fz_rect *rect, int even_odd, f static void fz_trace_clip_stroke_path(fz_device *dev, fz_path *path, fz_rect *rect, fz_stroke_state *stroke, fz_matrix ctm) { - printf("<clip_stroke_path "); + printf("<clip_stroke_path"); fz_trace_matrix(ctm); printf(">\n"); fz_trace_path(path, 0); @@ -140,7 +139,7 @@ static void fz_trace_fill_text(fz_device *dev, fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) { - printf("<fill_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode); + printf("<fill_text font=\"%s\" wmode=\"%d\"", text->font->name, text->wmode); fz_trace_color(colorspace, color, alpha); fz_trace_matrix(ctm); fz_trace_trm(text->trm); @@ -153,7 +152,7 @@ static void fz_trace_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) { - printf("<stroke_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode); + printf("<stroke_text font=\"%s\" wmode=\"%d\"", text->font->name, text->wmode); fz_trace_color(colorspace, color, alpha); fz_trace_matrix(ctm); fz_trace_trm(text->trm); @@ -165,8 +164,8 @@ fz_trace_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke, fz_ static void fz_trace_clip_text(fz_device *dev, fz_text *text, fz_matrix ctm, int accumulate) { - printf("<clip_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode); - printf("accumulate=\"%d\" ", accumulate); + printf("<clip_text font=\"%s\" wmode=\"%d\"", text->font->name, text->wmode); + printf(" accumulate=\"%d\"", accumulate); fz_trace_matrix(ctm); fz_trace_trm(text->trm); printf(">\n"); @@ -177,7 +176,7 @@ fz_trace_clip_text(fz_device *dev, fz_text *text, fz_matrix ctm, int accumulate) static void fz_trace_clip_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm) { - printf("<clip_stroke_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode); + printf("<clip_stroke_text font=\"%s\" wmode=\"%d\"", text->font->name, text->wmode); fz_trace_matrix(ctm); fz_trace_trm(text->trm); printf(">\n"); @@ -188,7 +187,7 @@ fz_trace_clip_stroke_text(fz_device *dev, fz_text *text, fz_stroke_state *stroke static void fz_trace_ignore_text(fz_device *dev, fz_text *text, fz_matrix ctm) { - printf("<ignore_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode); + printf("<ignore_text font=\"%s\" wmode=\"%d\"", text->font->name, text->wmode); fz_trace_matrix(ctm); fz_trace_trm(text->trm); printf(">\n"); @@ -199,15 +198,16 @@ fz_trace_ignore_text(fz_device *dev, fz_text *text, fz_matrix ctm) static void fz_trace_fill_image(fz_device *dev, fz_image *image, fz_matrix ctm, float alpha) { - printf("<fill_image alpha=\"%g\" ", alpha); + printf("<fill_image alpha=\"%g\"", alpha); fz_trace_matrix(ctm); + printf(" width=\"%d\" height=\"%d\"", image->w, image->h); printf("/>\n"); } static void fz_trace_fill_shade(fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha) { - printf("<fill_shade alpha=\"%g\" ", alpha); + printf("<fill_shade alpha=\"%g\"", alpha); fz_trace_matrix(ctm); printf("/>\n"); } @@ -216,30 +216,32 @@ static void fz_trace_fill_image_mask(fz_device *dev, fz_image *image, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) { - printf("<fill_image_mask "); + printf("<fill_image_mask"); fz_trace_matrix(ctm); fz_trace_color(colorspace, color, alpha); + printf(" width=\"%d\" height=\"%d\"", image->w, image->h); printf("/>\n"); } static void fz_trace_clip_image_mask(fz_device *dev, fz_image *image, fz_rect *rect, fz_matrix ctm) { - printf("<clip_image_mask "); + printf("<clip_image_mask"); fz_trace_matrix(ctm); + printf(" width=\"%d\" height=\"%d\"", image->w, image->h); printf("/>\n"); } static void fz_trace_pop_clip(fz_device *dev) { - printf("<pop_clip />\n"); + printf("<pop_clip/>\n"); } static void fz_trace_begin_mask(fz_device *dev, fz_rect bbox, int luminosity, fz_colorspace *colorspace, float *color) { - printf("<mask bbox=\"%g %g %g %g\" s=\"%s\" ", + printf("<mask bbox=\"%g %g %g %g\" s=\"%s\"", bbox.x0, bbox.y0, bbox.x1, bbox.y1, luminosity ? "luminosity" : "alpha"); printf(">\n"); @@ -268,10 +270,10 @@ fz_trace_end_group(fz_device *dev) static void fz_trace_begin_tile(fz_device *dev, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm) { - printf("<tile "); - printf("area=\"%g %g %g %g\" ", area.x0, area.y0, area.x1, area.y1); - printf("view=\"%g %g %g %g\" ", view.x0, view.y0, view.x1, view.y1); - printf("xstep=\"%g\" ystep=\"%g\" ", xstep, ystep); + printf("<tile"); + printf(" area=\"%g %g %g %g\"", area.x0, area.y0, area.x1, area.y1); + printf(" view=\"%g %g %g %g\"", view.x0, view.y0, view.x1, view.y1); + printf(" xstep=\"%g\" ystep=\"%g\"", xstep, ystep); fz_trace_matrix(ctm); printf(">\n"); } |