diff options
Diffstat (limited to 'desktop/save_pdf.c')
-rw-r--r-- | desktop/save_pdf.c | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/desktop/save_pdf.c b/desktop/save_pdf.c index d303eca7c..889190089 100644 --- a/desktop/save_pdf.c +++ b/desktop/save_pdf.c @@ -171,7 +171,8 @@ bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *psty { DashPattern_e dash; #ifdef PDF_DEBUG - LOG("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, pstyle->fill_colour); + NSLOG(netsurf, INFO, "%d %d %d %d %f %X", x0, y0, x1, y1, + page_height - y0, pstyle->fill_colour); #endif if (pstyle->fill_type != PLOT_OP_TYPE_NONE) { @@ -212,10 +213,10 @@ bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *psty } apply_clip_and_mode(false, - NS_TRANSPARENT, - pstyle->stroke_colour, - pstyle->stroke_width, - dash); + NS_TRANSPARENT, + pstyle->stroke_colour, + plot_style_int_to_fixed(pstyle->stroke_width), + dash); HPDF_Page_Rectangle(pdf_page, x0, page_height - y0, x1 - x0, -(y1 - y0)); HPDF_Page_Stroke(pdf_page); @@ -244,10 +245,10 @@ bool pdf_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *pstyle) } apply_clip_and_mode(false, - NS_TRANSPARENT, - pstyle->stroke_colour, - pstyle->stroke_width, - dash); + NS_TRANSPARENT, + pstyle->stroke_colour, + plot_style_int_to_fixed(pstyle->stroke_width), + dash); HPDF_Page_MoveTo(pdf_page, x0, page_height - y0); HPDF_Page_LineTo(pdf_page, x1, page_height - y1); @@ -262,7 +263,7 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style) #ifdef PDF_DEBUG int pmaxx = p[0], pmaxy = p[1]; int pminx = p[0], pminy = p[1]; - LOG("."); + NSLOG(netsurf, INFO, "."); #endif if (n == 0) return true; @@ -281,7 +282,8 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style) } #ifdef PDF_DEBUG - LOG("%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, page_height - pminy); + NSLOG(netsurf, INFO, "%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, + page_height - pminy); #endif HPDF_Page_Fill(pdf_page); @@ -294,7 +296,8 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style) bool pdf_plot_clip(const struct rect *clip) { #ifdef PDF_DEBUG - LOG("%d %d %d %d", clip->x0, clip->y0, clip->x1, clip->y1); + NSLOG(netsurf, INFO, "%d %d %d %d", clip->x0, clip->y0, clip->x1, + clip->y1); #endif /*Normalize cllipping area - to prevent overflows. @@ -314,7 +317,7 @@ bool pdf_plot_text(int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle) { #ifdef PDF_DEBUG - LOG(". %d %d %.*s", x, y, (int)length, text); + NSLOG(netsurf, INFO, ". %d %d %.*s", x, y, (int)length, text); #endif char *word; HPDF_Font pdf_font; @@ -347,7 +350,7 @@ bool pdf_plot_text(int x, int y, const char *text, size_t length, bool pdf_plot_disc(int x, int y, int radius, const plot_style_t *style) { #ifdef PDF_DEBUG - LOG("."); + NSLOG(netsurf, INFO, "."); #endif if (style->fill_type != PLOT_OP_TYPE_NONE) { apply_clip_and_mode(false, @@ -378,7 +381,8 @@ bool pdf_plot_disc(int x, int y, int radius, const plot_style_t *style) bool pdf_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style) { #ifdef PDF_DEBUG - LOG("%d %d %d %d %d %X", x, y, radius, angle1, angle2, style->stroke_colour); + NSLOG(netsurf, INFO, "%d %d %d %d %d %X", x, y, radius, angle1, + angle2, style->stroke_colour); #endif /* FIXME: line width 1 is ok ? */ @@ -406,7 +410,8 @@ bool pdf_plot_bitmap_tile(int x, int y, int width, int height, HPDF_REAL max_width, max_height; #ifdef PDF_DEBUG - LOG("%d %d %d %d %p 0x%x", x, y, width, height, bitmap, bg); + NSLOG(netsurf, INFO, "%d %d %d %d %p 0x%x", x, y, width, height, + bitmap, bg); #endif if (width == 0 || height == 0) return true; @@ -483,7 +488,8 @@ HPDF_Image pdf_extract_image(struct bitmap *bitmap) rgb_buffer = (unsigned char *)malloc(3 * img_width * img_height); alpha_buffer = (unsigned char *)malloc(img_width * img_height); if (rgb_buffer == NULL || alpha_buffer == NULL) { - LOG("Not enough memory to create RGB buffer"); + NSLOG(netsurf, INFO, + "Not enough memory to create RGB buffer"); free(rgb_buffer); free(alpha_buffer); return NULL; @@ -607,7 +613,7 @@ bool pdf_plot_path(const float *p, unsigned int n, colour fill, float width, bool empty_path; #ifdef PDF_DEBUG - LOG("."); + NSLOG(netsurf, INFO, "."); #endif if (n == 0) @@ -649,7 +655,7 @@ bool pdf_plot_path(const float *p, unsigned int n, colour fill, float width, i += 7; empty_path = false; } else { - LOG("bad path command %f", p[i]); + NSLOG(netsurf, INFO, "bad path command %f", p[i]); return false; } } @@ -685,7 +691,7 @@ bool pdf_begin(struct print_settings *print_settings) HPDF_Free(pdf_doc); pdf_doc = HPDF_New(error_handler, NULL); if (!pdf_doc) { - LOG("Error creating pdf_doc"); + NSLOG(netsurf, INFO, "Error creating pdf_doc"); return false; } @@ -708,7 +714,7 @@ bool pdf_begin(struct print_settings *print_settings) pdf_page = NULL; #ifdef PDF_DEBUG - LOG("pdf_begin finishes"); + NSLOG(netsurf, INFO, "pdf_begin finishes"); #endif return true; } @@ -717,7 +723,7 @@ bool pdf_begin(struct print_settings *print_settings) bool pdf_next_page(void) { #ifdef PDF_DEBUG - LOG("pdf_next_page begins"); + NSLOG(netsurf, INFO, "pdf_next_page begins"); #endif clip_update_needed = false; if (pdf_page != NULL) { @@ -745,7 +751,7 @@ bool pdf_next_page(void) pdfw_gs_save(pdf_page); #ifdef PDF_DEBUG - LOG("%f %f", page_width, page_height); + NSLOG(netsurf, INFO, "%f %f", page_width, page_height); #endif return true; @@ -755,7 +761,7 @@ bool pdf_next_page(void) void pdf_end(void) { #ifdef PDF_DEBUG - LOG("pdf_end begins"); + NSLOG(netsurf, INFO, "pdf_end begins"); #endif clip_update_needed = false; if (pdf_page != NULL) { @@ -780,7 +786,7 @@ void pdf_end(void) else save_pdf(settings->output); #ifdef PDF_DEBUG - LOG("pdf_end finishes"); + NSLOG(netsurf, INFO, "pdf_end finishes"); #endif } @@ -819,7 +825,8 @@ nserror save_pdf(const char *path) static void error_handler(HPDF_STATUS error_no, HPDF_STATUS detail_no, void *user_data) { - LOG("ERROR:\n\terror_no=%x\n\tdetail_no=%d\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no); + NSLOG(netsurf, INFO, "ERROR:\n\terror_no=%x\n\tdetail_no=%d\n", + (HPDF_UINT)error_no, (HPDF_UINT)detail_no); #ifdef PDF_DEBUG exit(1); #endif |