From b346790cf67d5bda40ed06c035f02d0af414361a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 6 Sep 2017 18:23:14 +0100 Subject: update plotter logging to use a catagory --- frontends/windows/plot.c | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) (limited to 'frontends/windows') diff --git a/frontends/windows/plot.c b/frontends/windows/plot.c index f38fe7522..376d37252 100644 --- a/frontends/windows/plot.c +++ b/frontends/windows/plot.c @@ -41,16 +41,6 @@ #include "windows/gui.h" #include "windows/plot.h" - -/* set NSWS_PLOT_DEBUG to 0 for no debugging, 1 for debugging */ -/* #define NSWS_PLOT_DEBUG */ - -#ifdef NSWS_PLOT_DEBUG -#define PLOT_LOG(x...) LOG(x) -#else -#define PLOT_LOG(x...) ((void) 0) -#endif - HDC plot_hdc; /** currently set clipping rectangle */ @@ -159,9 +149,9 @@ plot_alpha_bitmap(HDC hdc, BITMAPINFO *bmi; HBITMAP MemBMh; - PLOT_LOG("%p bitmap %d,%d width %d height %d", + NSLOG(plot, DEEPDEBUG, "%p bitmap %d,%d width %d height %d", bitmap, x, y, width, height); - PLOT_LOG("clipped %ld,%ld to %ld,%ld", + NSLOG(plot, DEEPDEBUG, "clipped %ld,%ld to %ld,%ld", plot_clip.left, plot_clip.top, plot_clip.right, plot_clip.bottom); @@ -172,7 +162,7 @@ plot_alpha_bitmap(HDC hdc, if ((bitmap->width != width) || (bitmap->height != height)) { - PLOT_LOG("scaling from %d,%d to %d,%d", + NSLOG(plot, DEEPDEBUG, "scaling from %d,%d to %d,%d", bitmap->width, bitmap->height, width, height); bitmap = bitmap_scale(bitmap, width, height); if (bitmap == NULL) { @@ -344,7 +334,7 @@ plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height) if (bltres == 0) { res = NSERROR_INVALID; } - PLOT_LOG("bltres = %d", bltres); + NSLOG(plot, DEEPDEBUG, "bltres = %d", bltres); } else { /* Bitmap with alpha.*/ res = plot_alpha_bitmap(plot_hdc, bitmap, x, y, width, height); @@ -366,7 +356,7 @@ plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height) */ static nserror clip(const struct redraw_context *ctx, const struct rect *clip) { - PLOT_LOG("clip %d,%d to %d,%d", clip->x0, clip->y0, clip->x1, clip->y1); + NSLOG(plot, DEEPDEBUG, "clip %d,%d to %d,%d", clip->x0, clip->y0, clip->x1, clip->y1); plot_clip.left = clip->x0; plot_clip.top = clip->y0; @@ -399,7 +389,7 @@ arc(const struct redraw_context *ctx, int x, int y, int radius, int angle1, int angle2) { - PLOT_LOG("arc centre %d,%d radius %d from %d to %d", x, y, radius, + NSLOG(plot, DEEPDEBUG, "arc centre %d,%d radius %d from %d to %d", x, y, radius, angle1, angle2); /* ensure the plot HDC is set */ @@ -511,7 +501,7 @@ disc(const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius) { - PLOT_LOG("disc at %d,%d radius %d", x, y, radius); + NSLOG(plot, DEEPDEBUG, "disc at %d,%d radius %d", x, y, radius); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { @@ -590,7 +580,7 @@ line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line) { - PLOT_LOG("from %d,%d to %d,%d", x0, y0, x1, y1); + NSLOG(plot, DEEPDEBUG, "from %d,%d to %d,%d", x0, y0, x1, y1); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { @@ -656,7 +646,7 @@ rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect) { - PLOT_LOG("rectangle from %d,%d to %d,%d", + NSLOG(plot, DEEPDEBUG, "rectangle from %d,%d to %d,%d", rect->x0, rect->y0, rect->x1, rect->y1); /* ensure the plot HDC is set */ @@ -740,7 +730,7 @@ polygon(const struct redraw_context *ctx, const int *p, unsigned int n) { - PLOT_LOG("polygon %d points", n); + NSLOG(plot, DEEPDEBUG, "polygon %d points", n); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { @@ -788,7 +778,7 @@ polygon(const struct redraw_context *ctx, points[i].x = (long) p[2 * i]; points[i].y = (long) p[2 * i + 1]; - PLOT_LOG("%ld,%ld ", points[i].x, points[i].y); + NSLOG(plot, DEEPDEBUG, "%ld,%ld ", points[i].x, points[i].y); } SelectClipRgn(plot_hdc, clipregion); @@ -831,7 +821,7 @@ path(const struct redraw_context *ctx, float width, const float transform[6]) { - PLOT_LOG("path unimplemented"); + NSLOG(plot, DEEPDEBUG, "path unimplemented"); return NSERROR_OK; } @@ -875,7 +865,7 @@ bitmap(const struct redraw_context *ctx, /* Bail early if we can */ - PLOT_LOG("Plotting %p at %d,%d by %d,%d",bitmap, x,y,width,height); + NSLOG(plot, DEEPDEBUG, "Plotting %p at %d,%d by %d,%d",bitmap, x,y,width,height); if (bitmap == NULL) { NSLOG(netsurf, INFO, "Passed null bitmap!"); @@ -937,8 +927,8 @@ bitmap(const struct redraw_context *ctx, } } - PLOT_LOG("Tiled plotting %d,%d by %d,%d", x, y, width, height); - PLOT_LOG("clipped %ld,%ld to %ld,%ld", + NSLOG(plot, DEEPDEBUG, "Tiled plotting %d,%d by %d,%d", x, y, width, height); + NSLOG(plot, DEEPDEBUG, "clipped %ld,%ld to %ld,%ld", plot_clip.left, plot_clip.top, plot_clip.right, plot_clip.bottom); @@ -952,7 +942,7 @@ bitmap(const struct redraw_context *ctx, for (; y > plot_clip.top; y -= height); } - PLOT_LOG("repeat from %d,%d to %ld,%ld", + NSLOG(plot, DEEPDEBUG, "repeat from %d,%d to %ld,%ld", x, y, plot_clip.right, plot_clip.bottom); /* tile down and across to extents */ @@ -989,7 +979,7 @@ text(const struct redraw_context *ctx, const char *text, size_t length) { - PLOT_LOG("words %s at %d,%d", text, x, y); + NSLOG(plot, DEEPDEBUG, "words %s at %d,%d", text, x, y); /* ensure the plot HDC is set */ if (plot_hdc == NULL) { -- cgit v1.2.3