use logdomain.

This commit is contained in:
Martin Preuss
2025-10-01 23:05:49 +02:00
parent bac8537939
commit 926f61aaa3
3 changed files with 38 additions and 38 deletions

View File

@@ -87,12 +87,12 @@ AQDG_DRAW_CONTEXT *AQDG_Draw_ContextCairo_Pdf_new(const char *fileName, int w, i
xg->surface=cairo_pdf_surface_create(fileName, w, h); xg->surface=cairo_pdf_surface_create(fileName, w, h);
if (xg->surface==NULL) { if (xg->surface==NULL) {
DBG_ERROR(0, "Unable to create surface"); DBG_ERROR(AQDG_LOGDOMAIN, "Unable to create surface");
} }
xg->cr=cairo_create(xg->surface); xg->cr=cairo_create(xg->surface);
if (xg->cr==NULL) { if (xg->cr==NULL) {
DBG_ERROR(0, "Could not create cairo context"); DBG_ERROR(AQDG_LOGDOMAIN, "Could not create cairo context");
} }
/* set virtual functions */ /* set virtual functions */
@@ -133,12 +133,12 @@ AQDG_DRAW_CONTEXT *AQDG_Draw_ContextCairo_Ps_new(const char *fileName, int w, in
xg->surface=cairo_ps_surface_create(fileName, w, h); xg->surface=cairo_ps_surface_create(fileName, w, h);
if (xg->surface==NULL) { if (xg->surface==NULL) {
DBG_ERROR(0, "Unable to create surface"); DBG_ERROR(AQDG_LOGDOMAIN, "Unable to create surface");
} }
xg->cr=cairo_create(xg->surface); xg->cr=cairo_create(xg->surface);
if (xg->cr==NULL) { if (xg->cr==NULL) {
DBG_ERROR(0, "Could not create cairo context"); DBG_ERROR(AQDG_LOGDOMAIN, "Could not create cairo context");
} }
/* set virtual functions */ /* set virtual functions */
@@ -181,12 +181,12 @@ AQDG_DRAW_CONTEXT *AQDG_Draw_ContextCairo_Png_new(const char *fileName, int w, i
xg->surface=cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h); xg->surface=cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
if (xg->surface==NULL) { if (xg->surface==NULL) {
DBG_ERROR(0, "Unable to create surface"); DBG_ERROR(AQDG_LOGDOMAIN, "Unable to create surface");
} }
xg->cr=cairo_create(xg->surface); xg->cr=cairo_create(xg->surface);
if (xg->cr==NULL) { if (xg->cr==NULL) {
DBG_ERROR(0, "Could not create cairo context"); DBG_ERROR(AQDG_LOGDOMAIN, "Could not create cairo context");
} }
/* set virtual functions */ /* set virtual functions */
@@ -246,7 +246,7 @@ int _penCreate(AQDG_DRAW_CONTEXT *g, uint32_t frontColour, int lineWidth, int da
xg=_ensureCairoSurface(g); xg=_ensureCairoSurface(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
@@ -257,7 +257,7 @@ int _penCreate(AQDG_DRAW_CONTEXT *g, uint32_t frontColour, int lineWidth, int da
AQDG_Draw_Pen_SetDashType(pen, dashType); AQDG_Draw_Pen_SetDashType(pen, dashType);
AQDG_Draw_Pen_List_Add(pen, xg->penList); AQDG_Draw_Pen_List_Add(pen, xg->penList);
DBG_ERROR(NULL, "Created pen %d", xg->lastPenId); DBG_DEBUG(AQDG_LOGDOMAIN, "Created pen %d", xg->lastPenId);
return xg->lastPenId; return xg->lastPenId;
} }
@@ -270,13 +270,13 @@ int _penRelease(AQDG_DRAW_CONTEXT *g, int penId)
xg=_ensureCairoSurface(g); xg=_ensureCairoSurface(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId);
if (pen==NULL) { if (pen==NULL) {
DBG_INFO(0, "Pen %d not found", penId); DBG_INFO(AQDG_LOGDOMAIN, "Pen %d not found", penId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
@@ -294,13 +294,13 @@ int _drawLine(AQDG_DRAW_CONTEXT *g, int penId, int xStart, int yStart, int xEnd,
xg=_ensureFullCairoContext(g); xg=_ensureFullCairoContext(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId);
if (pen==NULL) { if (pen==NULL) {
DBG_ERROR(0, "Pen %d not found", penId); DBG_ERROR(AQDG_LOGDOMAIN, "Pen %d not found", penId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
@@ -324,13 +324,13 @@ int _drawRect(AQDG_DRAW_CONTEXT *g, int penId, int x, int y, int w, int h)
xg=_ensureFullCairoContext(g); xg=_ensureFullCairoContext(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId);
if (pen==NULL) { if (pen==NULL) {
DBG_INFO(0, "Pen %d not found", penId); DBG_INFO(AQDG_LOGDOMAIN, "Pen %d not found", penId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
@@ -354,13 +354,13 @@ int _drawFilledRect(AQDG_DRAW_CONTEXT *g, int penId, int x, int y, int w, int h)
xg=_ensureFullCairoContext(g); xg=_ensureFullCairoContext(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId);
if (pen==NULL) { if (pen==NULL) {
DBG_INFO(0, "Pen %d not found", penId); DBG_INFO(AQDG_LOGDOMAIN, "Pen %d not found", penId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
@@ -385,7 +385,7 @@ int _fontCreate(AQDG_DRAW_CONTEXT *g, const char *face, int fontSize, int fontSl
xg=_ensureCairoSurface(g); xg=_ensureCairoSurface(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
@@ -410,13 +410,13 @@ int _fontRelease(AQDG_DRAW_CONTEXT *g, int fontId)
xg=_ensureCairoSurface(g); xg=_ensureCairoSurface(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId); font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId);
if (font==NULL) { if (font==NULL) {
DBG_INFO(0, "Font %d not found", fontId); DBG_INFO(AQDG_LOGDOMAIN, "Font %d not found", fontId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
@@ -436,14 +436,14 @@ int _drawText(AQDG_DRAW_CONTEXT *g, int penId, int fontId, int direction, int x,
xg=_ensureFullCairoContext(g); xg=_ensureFullCairoContext(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
/* get and handle pen */ /* get and handle pen */
pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId); pen=AQDG_Draw_Pen_List_GetById(xg->penList, penId);
if (pen==NULL) { if (pen==NULL) {
DBG_INFO(0, "Pen %d not found", penId); DBG_INFO(AQDG_LOGDOMAIN, "Pen %d not found", penId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
@@ -452,7 +452,7 @@ int _drawText(AQDG_DRAW_CONTEXT *g, int penId, int fontId, int direction, int x,
/* get and handle font */ /* get and handle font */
font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId); font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId);
if (font==NULL) { if (font==NULL) {
DBG_INFO(0, "Font %d not found", fontId); DBG_INFO(AQDG_LOGDOMAIN, "Font %d not found", fontId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
_setFont(xg->cr, font); _setFont(xg->cr, font);
@@ -460,7 +460,7 @@ int _drawText(AQDG_DRAW_CONTEXT *g, int penId, int fontId, int direction, int x,
cairo_text_extents(xg->cr, text, &te); cairo_text_extents(xg->cr, text, &te);
/* TODO: translate pos and rotate according to given direction (use cairo_save and cairo_restore) */ /* TODO: translate pos and rotate according to given direction (use cairo_save and cairo_restore) */
/*DBG_ERROR(NULL, "te.x_bearing=%f, te.y_bearing=%f", te.x_bearing, te.y_bearing);*/ /*DBG_ERROR(AQDG_LOGDOMAIN, "te.x_bearing=%f, te.y_bearing=%f", te.x_bearing, te.y_bearing);*/
cairo_move_to(xg->cr, x, y-te.y_bearing); cairo_move_to(xg->cr, x, y-te.y_bearing);
cairo_show_text(xg->cr, text); cairo_show_text(xg->cr, text);
@@ -477,14 +477,14 @@ int _getTextWidth(AQDG_DRAW_CONTEXT *g, int fontId, const char *text)
xg=_ensureFullCairoContext(g); xg=_ensureFullCairoContext(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
/* get and handle font */ /* get and handle font */
font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId); font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId);
if (font==NULL) { if (font==NULL) {
DBG_INFO(0, "Font %d not found", fontId); DBG_INFO(AQDG_LOGDOMAIN, "Font %d not found", fontId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
@@ -505,14 +505,14 @@ int _getTextHeight(AQDG_DRAW_CONTEXT *g, int fontId, const char *text)
xg=_ensureFullCairoContext(g); xg=_ensureFullCairoContext(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
/* get and handle font */ /* get and handle font */
font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId); font=AQDG_Draw_Font_List_GetById(xg->fontList, fontId);
if (font==NULL) { if (font==NULL) {
DBG_INFO(0, "Font %d not found", fontId); DBG_INFO(AQDG_LOGDOMAIN, "Font %d not found", fontId);
return GWEN_ERROR_NOT_FOUND; return GWEN_ERROR_NOT_FOUND;
} }
@@ -531,7 +531,7 @@ int _finish(AQDG_DRAW_CONTEXT *g)
xg=_ensureFullCairoContext(g); xg=_ensureFullCairoContext(g);
if (xg==NULL) { if (xg==NULL) {
DBG_INFO(NULL, "here"); DBG_INFO(AQDG_LOGDOMAIN, "here");
return GWEN_ERROR_INVALID; return GWEN_ERROR_INVALID;
} }
@@ -541,7 +541,7 @@ int _finish(AQDG_DRAW_CONTEXT *g)
cairo_surface_flush(xg->surface); cairo_surface_flush(xg->surface);
st=cairo_surface_write_to_png(xg->surface, xg->fileName); st=cairo_surface_write_to_png(xg->surface, xg->fileName);
if (st!=CAIRO_STATUS_SUCCESS) { if (st!=CAIRO_STATUS_SUCCESS) {
DBG_ERROR(0, "Cairo Status: %d (%s)", st, cairo_status_to_string(st)); DBG_ERROR(AQDG_LOGDOMAIN, "Cairo Status: %d (%s)", st, cairo_status_to_string(st));
} }
} }
@@ -573,7 +573,7 @@ AQDG_DRAW_CONTEXT_CAIRO *_ensureFullCairoContext(const AQDG_DRAW_CONTEXT *g)
xg=_ensureCairoSurface(g); xg=_ensureCairoSurface(g);
if (xg) { if (xg) {
if (xg->cr==NULL) { if (xg->cr==NULL) {
DBG_INFO(0, "Graphics context not active, call \"AQDG_Draw_Context_BeginDraw()\" first"); DBG_INFO(AQDG_LOGDOMAIN, "Graphics context not active, call \"AQDG_Draw_Context_BeginDraw()\" first");
return NULL; return NULL;
} }
return xg; return xg;
@@ -592,7 +592,7 @@ AQDG_DRAW_CONTEXT_CAIRO *_ensureCairoSurface(const AQDG_DRAW_CONTEXT *g)
xg=GWEN_INHERIT_GETDATA(AQDG_DRAW_CONTEXT, AQDG_DRAW_CONTEXT_CAIRO, g); xg=GWEN_INHERIT_GETDATA(AQDG_DRAW_CONTEXT, AQDG_DRAW_CONTEXT_CAIRO, g);
if (xg) { if (xg) {
if (xg->surface==NULL) { if (xg->surface==NULL) {
DBG_ERROR(0, "No surface created"); DBG_ERROR(AQDG_LOGDOMAIN, "No surface created");
return NULL; return NULL;
} }
} }

View File

@@ -305,7 +305,7 @@ int AQDG_DrawableWidget_DrawBackground(AQDG_OBJECT *object)
xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_DRAWABLE, object); xo=GWEN_INHERIT_GETDATA(AQDG_OBJECT, AQDG_OBJECT_DRAWABLE, object);
if (xo) { if (xo) {
#if 0 #if 0
DBG_ERROR(NULL, "Drawing background with pen %d to %d/%d %d/%d", DBG_ERROR(AQDG_LOGDOMAIN, "Drawing background with pen %d to %d/%d %d/%d",
xo->backgroundPenId, xo->backgroundPenId,
AQDG_Object_GetAbsoluteX(object), AQDG_Object_GetAbsoluteX(object),
AQDG_Object_GetAbsoluteY(object), AQDG_Object_GetAbsoluteY(object),
@@ -443,7 +443,7 @@ int AQDG_DrawableWidget_GetTextWidth(AQDG_OBJECT *object)
w=AQDG_Draw_Context_GetTextWidth(xo->drawContext, xo->fontId, xo->text); w=AQDG_Draw_Context_GetTextWidth(xo->drawContext, xo->fontId, xo->text);
if (w<0) { if (w<0) {
DBG_INFO(NULL, "here (%d)", w); DBG_INFO(AQDG_LOGDOMAIN, "here (%d)", w);
return 0; return 0;
} }
return w; return w;
@@ -467,7 +467,7 @@ int AQDG_DrawableWidget_GetTextHeight(AQDG_OBJECT *object)
h=AQDG_Draw_Context_GetTextHeight(xo->drawContext, xo->fontId, xo->text); h=AQDG_Draw_Context_GetTextHeight(xo->drawContext, xo->fontId, xo->text);
if (h<0) { if (h<0) {
DBG_INFO(NULL, "here (%d)", h); DBG_INFO(AQDG_LOGDOMAIN, "here (%d)", h);
return 0; return 0;
} }
return h; return h;

View File

@@ -85,7 +85,7 @@ int _calcXPos(AQDG_OBJECT *object, uint32_t opts, int tw)
w=AQDG_Object_GetWidth(object)-AQDG_Object_GetBorderLeft(object)-AQDG_Object_GetBorderRight(object); w=AQDG_Object_GetWidth(object)-AQDG_Object_GetBorderLeft(object)-AQDG_Object_GetBorderRight(object);
if (w<0) { if (w<0) {
DBG_ERROR(NULL, "Width smaller than borders (%d)", w); DBG_ERROR(AQDG_LOGDOMAIN, "Width smaller than borders (%d)", w);
return AQDG_Object_GetBorderLeft(object); return AQDG_Object_GetBorderLeft(object);
} }
@@ -103,7 +103,7 @@ int _calcXPos(AQDG_OBJECT *object, uint32_t opts, int tw)
} }
if (x<AQDG_Object_GetBorderLeft(object)) { if (x<AQDG_Object_GetBorderLeft(object)) {
DBG_INFO(NULL, "x lower than left border pos"); DBG_INFO(AQDG_LOGDOMAIN, "x lower than left border pos");
x=AQDG_Object_GetBorderLeft(object); x=AQDG_Object_GetBorderLeft(object);
} }
@@ -122,7 +122,7 @@ int _calcYPos(AQDG_OBJECT *object, uint32_t opts, int th)
h=oh-(borderTop+borderBottom); h=oh-(borderTop+borderBottom);
if (h<0) { if (h<0) {
DBG_ERROR(NULL, "Height smaller than borders (%d)", h); DBG_ERROR(AQDG_LOGDOMAIN, "Height smaller than borders (%d)", h);
return borderTop; return borderTop;
} }
@@ -140,7 +140,7 @@ int _calcYPos(AQDG_OBJECT *object, uint32_t opts, int th)
} }
if (y<borderTop) { if (y<borderTop) {
DBG_INFO(NULL, "y lower than top border pos"); DBG_INFO(AQDG_LOGDOMAIN, "y lower than top border pos");
y=borderTop; y=borderTop;
} }