- Constify parameters of struct plotter_table::polygon and struct plotter_table::path

- riscos/save_draw.c(ro_save_draw_plotters): Make it static.
- desktop/save_pdf/pdf_plotters.c(pdf_plot_path): fix broken implementation (coordinates path were wrong, no clip/text mode update, transformation matrix was overwritten); only update fill and/or 
stroke color when fill and/or stroke is done.
  (pdf_begin): disable compression when PDF_DEBUG is set

svn path=/trunk/netsurf/; revision=6361
This commit is contained in:
John Tytgat 2009-02-03 01:27:54 +00:00
parent 9a17510206
commit fbf6d4cd41
17 changed files with 116 additions and 121 deletions

View File

@ -189,7 +189,7 @@ bool ami_line(int x0, int y0, int x1, int y1, int width,
return true;
}
bool ami_polygon(int *p, unsigned int n, colour fill)
bool ami_polygon(const int *p, unsigned int n, colour fill)
{
int k;
#ifndef NS_AMIGA_CAIRO
@ -626,8 +626,8 @@ bool ami_flush(void)
return true;
}
bool ami_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
bool ami_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
/* For SVG only, because it needs Bezier curves we are going to cheat
and insist on Cairo */

View File

@ -27,7 +27,7 @@ bool ami_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
bool ami_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
bool ami_polygon(int *p, unsigned int n, colour fill);
bool ami_polygon(const int *p, unsigned int n, colour fill);
bool ami_fill(int x0, int y0, int x1, int y1, colour c);
bool ami_clip(int x0, int y0, int x1, int y1);
bool ami_text(int x, int y, const struct css_style *style,
@ -43,6 +43,6 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
bool ami_group_start(const char *name);
bool ami_group_end(void);
bool ami_flush(void);
bool ami_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform);
bool ami_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
#endif

View File

@ -66,9 +66,9 @@ static bool nsbeos_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool nsbeos_plot_polygon(int *p, unsigned int n, colour fill);
static bool nsbeos_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform);
static bool nsbeos_plot_polygon(const int *p, unsigned int n, colour fill);
static bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
static bool nsbeos_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool nsbeos_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@ -261,7 +261,7 @@ bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width,
}
bool nsbeos_plot_polygon(int *p, unsigned int n, colour fill)
bool nsbeos_plot_polygon(const int *p, unsigned int n, colour fill)
{
unsigned int i;
BView *view;
@ -709,8 +709,8 @@ printf("plot_tile: -> %dx%d\n", width, height);
return true;
}
bool nsbeos_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
unsigned int i;

View File

@ -90,7 +90,7 @@ static bool knockout_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool knockout_plot_polygon(int *p, unsigned int n, colour fill);
static bool knockout_plot_polygon(const int *p, unsigned int n, colour fill);
static bool knockout_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool knockout_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@ -107,8 +107,8 @@ static bool knockout_plot_bitmap_tile(int x, int y, int width, int height,
static bool knockout_plot_flush(void);
static bool knockout_plot_group_start(const char *name);
static bool knockout_plot_group_end(void);
static bool knockout_plot_path(float *p, unsigned int n, colour fill,
float width, colour c, float *transform);
static bool knockout_plot_path(const float *p, unsigned int n, colour fill,
float width, colour c, const float transform[6]);
const struct plotter_table knockout_plotters = {
@ -704,7 +704,7 @@ bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
}
bool knockout_plot_polygon(int *p, unsigned int n, colour fill)
bool knockout_plot_polygon(const int *p, unsigned int n, colour fill)
{
bool success = true;
int *dest;
@ -734,8 +734,8 @@ bool knockout_plot_polygon(int *p, unsigned int n, colour fill)
}
bool knockout_plot_path(float *p, unsigned int n, colour fill,
float width, colour c, float *transform)
bool knockout_plot_path(const float *p, unsigned int n, colour fill,
float width, colour c, const float transform[6])
{
knockout_plot_flush();
return real_plot.path(p, n, fill, width, c, transform);

View File

@ -82,7 +82,7 @@ struct plotter_table {
int line_width, colour c, bool dotted, bool dashed);
bool (*line)(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
bool (*polygon)(int *p, unsigned int n, colour fill);
bool (*polygon)(const int *p, unsigned int n, colour fill);
bool (*fill)(int x0, int y0, int x1, int y1, colour c);
bool (*clip)(int x0, int y0, int x1, int y1);
bool (*text)(int x, int y, const struct css_style *style,
@ -98,8 +98,8 @@ struct plotter_table {
bool (*group_start)(const char *name); /**< optional, may be NULL */
bool (*group_end)(void); /**< optional, may be NULL */
bool (*flush)(void); /**< optional, may be NULL */
bool (*path)(float *p, unsigned int n, colour fill, float width,
colour c, float *transform);
bool (*path)(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
bool option_knockout; /**< set if knockout rendering is required */
};

View File

@ -51,7 +51,7 @@ static bool pdf_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool pdf_plot_polygon(int *p, unsigned int n, colour fill);
static bool pdf_plot_polygon(const int *p, unsigned int n, colour fill);
static bool pdf_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool pdf_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@ -65,8 +65,8 @@ static bool pdf_plot_bitmap(int x, int y, int width, int height,
static bool pdf_plot_bitmap_tile(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bool repeat_x, bool repeat_y, struct content *content);
static bool pdf_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform);
static bool pdf_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
static void pdf_set_solid(void);
static void pdf_set_dashed(void);
@ -150,10 +150,10 @@ bool pdf_plot_rectangle(int x0, int y0, int width, int height,
pdf_set_dashed();
HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
HPDF_Page_Rectangle(pdf_page, x0, page_height - y0 + height, width, height);
HPDF_Page_Rectangle(pdf_page, x0, page_height - y0, width, -height);
HPDF_Page_Stroke(pdf_page);
if (dotted||dashed)
if (dotted || dashed)
pdf_set_solid();
return true;
@ -181,13 +181,13 @@ bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
HPDF_Page_LineTo(pdf_page, x1, page_height - y1);
HPDF_Page_Stroke(pdf_page);
if (dotted||dashed)
if (dotted || dashed)
pdf_set_solid();
return true;
}
bool pdf_plot_polygon(int *p, unsigned int n, colour fill)
bool pdf_plot_polygon(const int *p, unsigned int n, colour fill)
{
unsigned int i;
#ifdef PDF_DEBUG
@ -214,7 +214,7 @@ bool pdf_plot_polygon(int *p, unsigned int n, colour fill)
}
#ifdef PDF_DEBUG
LOG(("%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, page_height-pminy));
LOG(("%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, page_height - pminy));
#endif
HPDF_Page_LineTo(pdf_page, p[0], page_height - p[1]);
@ -226,7 +226,7 @@ bool pdf_plot_polygon(int *p, unsigned int n, colour fill)
bool pdf_plot_fill(int x0, int y0, int x1, int y1, colour c)
{
#ifdef PDF_DEBUG
LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height-y0, c));
LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, c));
#endif
/*Normalize boundaries of the area - to prevent overflows.
@ -242,7 +242,7 @@ bool pdf_plot_fill(int x0, int y0, int x1, int y1, colour c)
apply_clip_and_mode(false);
HPDF_Page_SetRGBFill(pdf_page, R(c), G(c), B(c));
HPDF_Page_Rectangle(pdf_page, x0, page_height - y1, x1-x0, y1-y0);
HPDF_Page_Rectangle(pdf_page, x0, page_height - y1, x1 - x0, y1 - y0);
HPDF_Page_Fill(pdf_page);
return true;
@ -330,7 +330,7 @@ bool pdf_plot_disc(int x, int y, int radius, colour c, bool filled)
else
HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
HPDF_Page_Circle(pdf_page, x, page_height-y, radius);
HPDF_Page_Circle(pdf_page, x, page_height - y, radius);
if (filled)
HPDF_Page_Fill(pdf_page);
@ -356,7 +356,7 @@ bool pdf_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c)
HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
HPDF_Page_Arc(pdf_page, x, page_height-y, radius, angle1, angle2);
HPDF_Page_Arc(pdf_page, x, page_height - y, radius, angle1, angle2);
HPDF_Page_Stroke(pdf_page);
return true;
@ -382,7 +382,7 @@ bool pdf_plot_bitmap(int x, int y, int width, int height,
return false;
HPDF_Page_DrawImage(pdf_page, image,
x, page_height-y-height,
x, page_height - y - height,
width, height);
return true;
@ -394,6 +394,8 @@ bool pdf_plot_bitmap_tile(int x, int y, int width, int height,
bool repeat_x, bool repeat_y, struct content *content)
{
HPDF_Image image;
HPDF_REAL current_x, current_y ;
HPDF_REAL max_width, max_height;
#ifdef PDF_DEBUG
LOG(("%d %d %d %d %p 0x%x %p", x, y, width, height,
@ -407,22 +409,17 @@ bool pdf_plot_bitmap_tile(int x, int y, int width, int height,
image = pdf_extract_image(bitmap, content);
if (!image)
return false;
else {
/*The position of the next tile*/
HPDF_REAL current_x, current_y ;
HPDF_REAL max_width, max_height;
max_width = (repeat_x ? page_width : width);
max_height = (repeat_y ? page_height: height);
/*The position of the next tile*/
max_width = (repeat_x) ? page_width : width;
max_height = (repeat_y) ? page_height : height;
for (current_y=0; current_y < max_height; current_y += height)
for (current_x=0; current_x < max_width; current_x += width)
HPDF_Page_DrawImage(pdf_page, image,
current_x + x,
page_height-current_y - y - height,
width, height);
}
for (current_y = 0; current_y < max_height; current_y += height)
for (current_x = 0; current_x < max_width; current_x += width)
HPDF_Page_DrawImage(pdf_page, image,
current_x + x,
page_height - current_y - y - height,
width, height);
return true;
}
@ -542,46 +539,45 @@ static void apply_clip_and_mode(bool selectTextMode)
}
}
static inline float transform_x(float *transform, float x, float y)
static inline float transform_x(const float transform[6], float x, float y)
{
return ((transform[0] * x) + (transform[2] * (-y) ) + transform[4]) * 2;
return transform[0] * x + transform[2] * y + transform[4];
}
static inline float transform_y(float *transform, float x, float y)
static inline float transform_y(const float transform[6], float x, float y)
{
return page_height - (((transform[1] * x) +
(transform[3] * (-y)) - transform[5]) * 2);
return page_height
- (transform[1] * x + transform[3] * y + transform[5]);
}
bool pdf_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
bool pdf_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
#ifdef PDF_DEBUG
LOG(("."));
#endif
unsigned int i;
bool empty_path = true;
bool empty_path;
if (n == 0)
return true;
if ((c == TRANSPARENT) && (fill == TRANSPARENT))
if (c == TRANSPARENT && fill == TRANSPARENT)
return true;
if (p[0] != PLOTTER_PATH_MOVE) {
if (p[0] != PLOTTER_PATH_MOVE)
return false;
apply_clip_and_mode(false);
if (fill != TRANSPARENT)
HPDF_Page_SetRGBFill(pdf_page, R(fill), G(fill), B(fill));
if (c != TRANSPARENT) {
HPDF_Page_SetLineWidth(pdf_page, width);
HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
}
HPDF_Page_SetRGBFill(pdf_page, R(fill), G(fill), B(fill));
HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
transform[0] = 0.1;
transform[1] = 0;
transform[2] = 0;
transform[3] = -0.1;
transform[4] = 0;
transform[5] = 0;
empty_path = true;
for (i = 0 ; i < n ; ) {
if (p[i] == PLOTTER_PATH_MOVE) {
HPDF_Page_MoveTo(pdf_page,
@ -672,8 +668,10 @@ bool pdf_begin(struct print_settings *print_settings)
page_height = settings->page_height - settings->margins[MARGINTOP];
#ifndef PDF_DEBUG
if (option_enable_PDF_compression)
HPDF_SetCompressionMode(pdf_doc, HPDF_COMP_ALL); /*Compression on*/
#endif
HPDF_SetInfoAttr(pdf_doc, HPDF_INFO_CREATOR, user_agent_string());
pdf_font = NULL;

View File

@ -147,7 +147,7 @@ static bool fb_16bpp_rectangle(int x0, int y0, int width, int height,
return true;
}
static bool fb_16bpp_polygon(int *p, unsigned int n, colour fill)
static bool fb_16bpp_polygon(const int *p, unsigned int n, colour fill)
{
return fb_plotters_polygon(p, n, fill, fb_16bpp_line);
}
@ -386,8 +386,8 @@ static bool fb_16bpp_flush(void)
return true;
}
static bool fb_16bpp_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
static bool fb_16bpp_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
LOG(("%f, %d, 0x%lx, %f, 0x%lx, %f",
*p, n, fill, width, c, *transform));

View File

@ -50,7 +50,7 @@ static bool fb_1bpp_line(int x0, int y0, int x1, int y1, int width,
return true;
}
static bool fb_1bpp_polygon(int *p, unsigned int n, colour fill)
static bool fb_1bpp_polygon(const int *p, unsigned int n, colour fill)
{
LOG(("%s(%p, %d, 0x%lx)\n", __func__, p,n,fill));
return true;
@ -235,8 +235,8 @@ static bool fb_1bpp_flush(void)
return true;
}
static bool fb_1bpp_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
static bool fb_1bpp_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
LOG(("%s(%f, %d, 0x%lx, %f, 0x%lx, %f)\n", __func__,
*p, n, fill, width, c, *transform));

View File

@ -135,7 +135,7 @@ static bool fb_32bpp_rectangle(int x0, int y0, int width, int height,
}
static bool fb_32bpp_polygon(int *p, unsigned int n, colour fill)
static bool fb_32bpp_polygon(const int *p, unsigned int n, colour fill)
{
return fb_plotters_polygon(p, n, fill, fb_32bpp_line);
}
@ -367,8 +367,8 @@ static bool fb_32bpp_flush(void)
return true;
}
static bool fb_32bpp_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
static bool fb_32bpp_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
printf("path\n");
return true;

View File

@ -55,7 +55,7 @@ static bool fb_8bpp_line(int x0, int y0, int x1, int y1, int width,
return true;
}
static bool fb_8bpp_polygon(int *p, unsigned int n, colour fill)
static bool fb_8bpp_polygon(const int *p, unsigned int n, colour fill)
{
/*LOG(("%p, %d, 0x%lx", p,n,fill));*/
return fb_plotters_polygon(p, n, fill, fb_8bpp_line);
@ -266,8 +266,8 @@ static bool fb_8bpp_flush(void)
return true;
}
static bool fb_8bpp_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
static bool fb_8bpp_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
LOG(("%s(%f, %d, 0x%lx, %f, 0x%lx, %f)\n", __func__,
*p, n, fill, width, c, *transform));

View File

@ -221,10 +221,10 @@ colour fb_plotters_ablend(colour pixel, colour scrpixel)
}
bool
fb_plotters_polygon(int *p, unsigned int n, colour fill,bool (linefn)(int x0, int y0, int x1, int y1, int width, colour c, bool dotted, bool dashed))
fb_plotters_polygon(const int *p, unsigned int n, colour fill,bool (linefn)(int x0, int y0, int x1, int y1, int width, colour c, bool dotted, bool dashed))
{
unsigned int pnt;
int *cur = p;
const int *cur = p;
for (pnt = 1; pnt < n; pnt++) {
cur = p + (pnt << 1);

View File

@ -34,7 +34,7 @@ bool fb_plotters_clip_rect(const bbox_t *clip, int *x0, int *y0, int *x1, int *y
bool fb_plotters_clip_line_ctx(int *x0, int *y0, int *x1, int *y1);
bool fb_plotters_clip_line(const bbox_t *clip, int *x0, int *y0, int *x1, int *y1);
bool fb_plotters_polygon(int *p, unsigned int n, colour fill, bool (linefn)(int x0, int y0, int x1, int y1, int width, colour c, bool dotted, bool dashed));
bool fb_plotters_polygon(const int *p, unsigned int n, colour fill, bool (linefn)(int x0, int y0, int x1, int y1, int width, colour c, bool dotted, bool dashed));
bool fb_plotters_bitmap_tile(int x, int y,
int width, int height,

View File

@ -54,9 +54,9 @@ static bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool nsgtk_plot_polygon(int *p, unsigned int n, colour fill);
static bool nsgtk_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform);
static bool nsgtk_plot_polygon(const int *p, unsigned int n, colour fill);
static bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
static bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool nsgtk_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@ -149,7 +149,7 @@ bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
}
bool nsgtk_plot_polygon(int *p, unsigned int n, colour fill)
bool nsgtk_plot_polygon(const int *p, unsigned int n, colour fill)
{
unsigned int i;
@ -341,8 +341,8 @@ bool nsgtk_plot_bitmap_tile(int x, int y, int width, int height,
return true;
}
bool nsgtk_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
unsigned int i;
cairo_matrix_t old_ctm, n_ctm;

View File

@ -55,9 +55,9 @@ static bool nsgtk_print_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool nsgtk_print_plot_polygon(int *p, unsigned int n, colour fill);
static bool nsgtk_print_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform);
static bool nsgtk_print_plot_polygon(const int *p, unsigned int n, colour fill);
static bool nsgtk_print_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
static bool nsgtk_print_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool nsgtk_print_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@ -170,7 +170,7 @@ bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width,
}
bool nsgtk_print_plot_polygon(int *p, unsigned int n, colour fill)
bool nsgtk_print_plot_polygon(const int *p, unsigned int n, colour fill)
{
LOG(("Plotting polygon."));
@ -385,8 +385,8 @@ bool nsgtk_print_plot_bitmap_tile(int x, int y, int width, int height,
return true;
}
bool nsgtk_print_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
bool nsgtk_print_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
/* Only the internal SVG renderer uses this plot call currently,
* and the GTK version uses librsvg. Thus, we ignore this complexity,

View File

@ -41,9 +41,9 @@ static bool ro_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool ro_plot_draw_path(const draw_path * const path, int width,
colour c, bool dotted, bool dashed);
static bool ro_plot_polygon(int *p, unsigned int n, colour fill);
static bool ro_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform);
static bool ro_plot_polygon(const int *p, unsigned int n, colour fill);
static bool ro_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
static bool ro_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool ro_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@ -190,7 +190,7 @@ bool ro_plot_draw_path(const draw_path * const path, int width,
}
bool ro_plot_polygon(int *p, unsigned int n, colour fill)
bool ro_plot_polygon(const int *p, unsigned int n, colour fill)
{
int path[n * 3 + 2];
unsigned int i;
@ -222,8 +222,8 @@ bool ro_plot_polygon(int *p, unsigned int n, colour fill)
}
bool ro_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
bool ro_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
static const draw_line_style line_style = { draw_JOIN_MITRED,
draw_CAP_BUTT, draw_CAP_BUTT, 0, 0x7fffffff,

View File

@ -103,7 +103,7 @@ static bool print_fonts_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool print_fonts_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool print_fonts_plot_polygon(int *p, unsigned int n, colour fill);
static bool print_fonts_plot_polygon(const int *p, unsigned int n, colour fill);
static bool print_fonts_plot_fill(int x0, int y0, int x1, int y1, colour c);
static bool print_fonts_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@ -119,8 +119,8 @@ static bool print_fonts_plot_bitmap(int x, int y, int width, int height,
static bool print_fonts_plot_bitmap_tile(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bool repeat_x, bool repeat_y, struct content *content);
static bool print_fonts_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform);
static bool print_fonts_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
static void print_fonts_callback(void *context,
const char *font_name, unsigned int font_size,
const char *s8, unsigned short *s16, unsigned int n,
@ -831,7 +831,7 @@ bool print_fonts_plot_line(int x0, int y0, int x1, int y1, int width,
{
return true;
}
bool print_fonts_plot_polygon(int *p, unsigned int n, colour fill)
bool print_fonts_plot_polygon(const int *p, unsigned int n, colour fill)
{
return true;
}
@ -865,8 +865,8 @@ bool print_fonts_plot_bitmap_tile(int x, int y, int width, int height,
{
return true;
}
bool print_fonts_plot_path(float *p, unsigned int n, colour fill, float width,
colour c, float *transform)
bool print_fonts_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6])
{
return true;
}

View File

@ -41,9 +41,9 @@ static bool ro_save_draw_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool ro_save_draw_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool ro_save_draw_polygon(int *p, unsigned int n, colour fill);
static bool ro_save_draw_path(float *p, unsigned int n, colour fill,
float width, colour c, float *transform);
static bool ro_save_draw_polygon(const int *p, unsigned int n, colour fill);
static bool ro_save_draw_path(const float *p, unsigned int n, colour fill,
float width, colour c, const float transform[6]);
static bool ro_save_draw_fill(int x0, int y0, int x1, int y1, colour c);
static bool ro_save_draw_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
@ -63,7 +63,7 @@ static bool ro_save_draw_group_end(void);
static bool ro_save_draw_error(pencil_code code);
const struct plotter_table ro_save_draw_plotters = {
static const struct plotter_table ro_save_draw_plotters = {
ro_save_draw_clg,
ro_save_draw_rectangle,
ro_save_draw_line,
@ -199,7 +199,7 @@ bool ro_save_draw_line(int x0, int y0, int x1, int y1, int width,
}
bool ro_save_draw_polygon(int *p, unsigned int n, colour fill)
bool ro_save_draw_polygon(const int *p, unsigned int n, colour fill)
{
pencil_code code;
int path[n * 3 + 1];
@ -224,14 +224,9 @@ bool ro_save_draw_polygon(int *p, unsigned int n, colour fill)
}
bool ro_save_draw_path(float *p, unsigned int n, colour fill,
float width, colour c, float *transform)
bool ro_save_draw_path(const float *p, unsigned int n, colour fill,
float width, colour c, const float transform[6])
{
pencil_code code;
int *path;
unsigned int i;
bool empty_path = true;
if (n == 0)
return true;
@ -240,12 +235,14 @@ bool ro_save_draw_path(float *p, unsigned int n, colour fill,
return false;
}
path = malloc(sizeof *path * (n + 10));
int *path = malloc(sizeof *path * (n + 10));
if (!path) {
LOG(("out of memory"));
return false;
}
unsigned int i;
bool empty_path = true;
for (i = 0; i < n; ) {
if (p[i] == PLOTTER_PATH_MOVE) {
path[i] = draw_MOVE_TO;
@ -304,7 +301,7 @@ bool ro_save_draw_path(float *p, unsigned int n, colour fill,
return true;
}
code = pencil_path(ro_save_draw_diagram, path, i + 1,
pencil_code code = pencil_path(ro_save_draw_diagram, path, i + 1,
fill == TRANSPARENT ? pencil_TRANSPARENT : fill << 8,
c == TRANSPARENT ? pencil_TRANSPARENT : c << 8,
width, pencil_JOIN_MITRED,