From b346790cf67d5bda40ed06c035f02d0af414361a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 6 Sep 2017 18:23:14 +0100 Subject: [PATCH] update plotter logging to use a catagory --- frontends/amiga/plotters.c | 34 ++++++++++------------------- frontends/windows/plot.c | 44 +++++++++++++++----------------------- utils/log.c | 1 + utils/log.h | 1 + 4 files changed, 30 insertions(+), 50 deletions(-) diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c index dc2c16724..7c5df4678 100644 --- a/frontends/amiga/plotters.c +++ b/frontends/amiga/plotters.c @@ -53,15 +53,6 @@ #include "amiga/rtg.h" #include "amiga/utf8.h" -/* set AMI_PLOTTER_DEBUG to 0 for no debugging, 1 for debugging */ -//#define AMI_PLOTTER_DEBUG 1 - -#ifdef AMI_PLOTTER_DEBUG -#define PLOT_LOG(x...) LOG(x) -#else -#define PLOT_LOG(x...) ((void) 0) -#endif - HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *); struct bfbitmap { @@ -119,9 +110,6 @@ static bool palette_mapped = true; /* palette-mapped state for the screen */ */ #define AREA_SIZE 25000 -/* Define the below to get additional debug */ -#undef AMI_PLOTTER_DEBUG - struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit, bool alloc_pen_list) { /* init shared bitmaps */ @@ -438,7 +426,7 @@ static void ami_arc_gfxlib(struct RastPort *rp, int x, int y, int radius, int an static nserror ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, struct bitmap *bitmap) { - PLOT_LOG("[ami_plotter] Entered ami_bitmap()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap()"); struct BitMap *tbm; @@ -458,7 +446,7 @@ ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, struct return NSERROR_OK; } - PLOT_LOG("[ami_plotter] ami_bitmap() got native bitmap"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] ami_bitmap() got native bitmap"); #ifdef __amigaos4__ if (__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && @@ -617,7 +605,7 @@ ami_clip(const struct redraw_context *ctx, const struct rect *clip) struct gui_globals *glob = (struct gui_globals *)ctx->priv; struct Region *reg = NULL; - PLOT_LOG("[ami_plotter] Entered ami_clip()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_clip()"); if (glob->rp->Layer) { reg = NewRegion(); @@ -661,7 +649,7 @@ ami_arc(const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius, int angle1, int angle2) { - PLOT_LOG("[ami_plotter] Entered ami_arc()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_arc()"); struct gui_globals *glob = (struct gui_globals *)ctx->priv; @@ -693,7 +681,7 @@ ami_disc(const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius) { - PLOT_LOG("[ami_plotter] Entered ami_disc()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_disc()"); struct gui_globals *glob = (struct gui_globals *)ctx->priv; @@ -728,7 +716,7 @@ ami_line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line) { - PLOT_LOG("[ami_plotter] Entered ami_line()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_line()"); struct gui_globals *glob = (struct gui_globals *)ctx->priv; @@ -780,7 +768,7 @@ ami_rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect) { - PLOT_LOG("[ami_plotter] Entered ami_rectangle()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_rectangle()"); struct gui_globals *glob = (struct gui_globals *)ctx->priv; @@ -844,7 +832,7 @@ ami_polygon(const struct redraw_context *ctx, const int *p, unsigned int n) { - PLOT_LOG("[ami_plotter] Entered ami_polygon()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_polygon()"); struct gui_globals *glob = (struct gui_globals *)ctx->priv; @@ -893,7 +881,7 @@ ami_path(const struct redraw_context *ctx, unsigned int i; struct bez_point start_p = {0, 0}, cur_p = {0, 0}, p_a, p_b, p_c, p_r; - PLOT_LOG("[ami_plotter] Entered ami_path()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_path()"); struct gui_globals *glob = (struct gui_globals *)ctx->priv; @@ -1037,7 +1025,7 @@ ami_bitmap_tile(const struct redraw_context *ctx, bool repeat_x = (flags & BITMAPF_REPEAT_X); bool repeat_y = (flags & BITMAPF_REPEAT_Y); - PLOT_LOG("[ami_plotter] Entered ami_bitmap_tile()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap_tile()"); struct gui_globals *glob = (struct gui_globals *)ctx->priv; @@ -1154,7 +1142,7 @@ ami_text(const struct redraw_context *ctx, const char *text, size_t length) { - PLOT_LOG("[ami_plotter] Entered ami_text()"); + NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_text()"); struct gui_globals *glob = (struct gui_globals *)ctx->priv; 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) { diff --git a/utils/log.c b/utils/log.c index db90cbf18..8630d87a4 100644 --- a/utils/log.c +++ b/utils/log.c @@ -94,6 +94,7 @@ static const char *nslog_gettime(void) NSLOG_DEFINE_CATEGORY(netsurf, "NetSurf default logging"); NSLOG_DEFINE_CATEGORY(llcache, "Low level cache"); NSLOG_DEFINE_CATEGORY(fetch, "objet fetching"); +NSLOG_DEFINE_CATEGORY(plot, "rendering system"); static void netsurf_render_log(void *_ctx, diff --git a/utils/log.h b/utils/log.h index eee469255..247624769 100644 --- a/utils/log.h +++ b/utils/log.h @@ -59,6 +59,7 @@ extern nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv); NSLOG_DECLARE_CATEGORY(netsurf); NSLOG_DECLARE_CATEGORY(llcache); NSLOG_DECLARE_CATEGORY(fetch); +NSLOG_DECLARE_CATEGORY(plot); #else /* WITH_NSLOG */