Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
merge develop into master

See merge request Scientific-IT-Systems/gr!917
  • Loading branch information
jheinen committed Sep 20, 2022
2 parents c5bd9e3 + 0e25374 commit ab157a8
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 34 deletions.
2 changes: 1 addition & 1 deletion lib/gks/pdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ typedef unsigned long uLong;
#define pdf_curveto(p) pdf_printf(p->content, "c\n")
#define pdf_setdash(p, dash) pdf_printf(p->content, "%s 0 d\n", dash)

#define pdf_setlinewidth(p, width) pdf_printf(p->content, "0 J 1 j %s w\n", pdf_double(width))
#define pdf_setlinewidth(p, width) pdf_printf(p->content, "1 J 1 j %s w\n", pdf_double(width))

#define pdf_text(p, xorg, yorg, text) \
pdf_printf(p->content, "BT\n/F%d %d Tf\n%.2f %.2f Td\n(%s) Tj\nET\n", p->font, p->pt, xorg, yorg, text)
Expand Down
9 changes: 8 additions & 1 deletion lib/gks/plugin/aggplugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,9 @@ static void fill_path(agg::path_storage &path)
p->rasterizer.reset();
p->rasterizer.add_path(p->curve);
p->renderer_aa.color(p->fill_col);
p->rasterizer.filling_rule(agg::fill_even_odd);
agg::render_scanlines(p->rasterizer, p->scanline, p->renderer_aa);
p->rasterizer.filling_rule(agg::fill_non_zero);
p->path.remove_all();
}

Expand All @@ -496,7 +498,9 @@ static void fill_stroke_path(agg::path_storage &path)
p->rasterizer.reset();
p->rasterizer.add_path(p->curve);
p->renderer_aa.color(p->fill_col);
p->rasterizer.filling_rule(agg::fill_even_odd);
agg::render_scanlines(p->rasterizer, p->scanline, p->renderer_aa);
p->rasterizer.filling_rule(agg::fill_non_zero);
p->rasterizer.reset();
p->rasterizer.add_path(p->stroke);
p->renderer_aa.color(p->stroke_col);
Expand Down Expand Up @@ -673,7 +677,10 @@ static void fill_routine(int n, double *px, double *py, int tnr)
}
else
{
p->rasterizer.filling_rule(agg::fill_non_zero);
p->stroke.width(p->linewidth);
p->stroke.line_cap(agg::round_cap);
p->stroke.line_join(agg::round_join);
p->stroke_col = agg::rgba(p->rgb[p->color][0], p->rgb[p->color][1], p->rgb[p->color][2], p->transparency);
stroke_path(p->path, true);
}
Expand Down Expand Up @@ -864,7 +871,7 @@ static void polymarker(int n, const double *px, const double *py)

static void fillarea(int n, double *px, double *py)
{
p->linewidth = p->nominal_size;
p->linewidth = gkss->bwidth * p->nominal_size;
p->color = gkss->asf[12] ? gkss->facoli : 1;

p->rasterizer.filling_rule(agg::fill_even_odd);
Expand Down
13 changes: 9 additions & 4 deletions lib/gks/plugin/cairoplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ static void line_routine(int n, double *px, double *py, int linetype, int tnr)
seg_xform(&x, &y);
NDC_to_DC(x, y, x0, y0);

cairo_set_line_cap(p->cr, CAIRO_LINE_CAP_BUTT);
cairo_set_line_cap(p->cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_join(p->cr, CAIRO_LINE_JOIN_ROUND);
set_line_width(p->linewidth);

Expand Down Expand Up @@ -591,7 +591,11 @@ static void fillarea(int n, double *px, double *py)
{
int fl_color;

p->linewidth = p->nominal_size;
p->linewidth = gkss->bwidth * p->nominal_size;
set_line_width(p->linewidth);

cairo_set_line_cap(p->cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_join(p->cr, CAIRO_LINE_JOIN_ROUND);

fl_color = gkss->asf[12] ? gkss->facoli : 1;
set_color(fl_color);
Expand All @@ -617,7 +621,7 @@ static void polyline(int n, double *px, double *py)
ln_width = gkss->asf[1] ? gkss->lwidth : 1;
ln_color = gkss->asf[2] ? gkss->plcoli : 1;

cairo_set_line_cap(p->cr, CAIRO_LINE_CAP_BUTT);
cairo_set_line_cap(p->cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_join(p->cr, CAIRO_LINE_JOIN_ROUND);
p->linewidth = ln_width * p->nominal_size;
set_line_width(p->linewidth);
Expand Down Expand Up @@ -1780,8 +1784,9 @@ static void draw_path(int n, double *px, double *py, int nc, int *codes)
GKS_UNUSED(n);

cairo_new_path(p->cr);
cairo_set_line_cap(p->cr, CAIRO_LINE_CAP_BUTT);
cairo_set_line_cap(p->cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_join(p->cr, CAIRO_LINE_JOIN_ROUND);
cairo_set_fill_rule(p->cr, CAIRO_FILL_RULE_EVEN_ODD);
set_line_width(gkss->bwidth * p->nominal_size);

j = 0;
Expand Down
7 changes: 2 additions & 5 deletions lib/gks/plugin/gsplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ static void ps_init(int *pages)

set_color(-1, p->wtype);
set_foreground(-1, p->wtype);
packb("0 setlinecap 1 setlinejoin");
packb("1 setlinecap 1 setlinejoin");
set_linewidth(-1.0);
set_markersize(-1.0);
packb("0 ma");
Expand Down Expand Up @@ -1779,15 +1779,12 @@ static void draw_lines(int n, double *px, double *py, int *attributes)
p->green[ln_color] = ((rgba >> 8) & 0xff) / 255.0;
p->blue[ln_color] = ((rgba >> 16) & 0xff) / 255.0;

packb("np 1 setlinecap");
set_linewidth(line_width);
set_color(-ln_color, p->wtype);

snprintf(buffer, 50, "%d %d m %d %d l sk", xim1, yim1, xi, yi);
packb(buffer);
}

packb("0 setlinecap");
}

static void set_bordercolor(int wtype)
Expand Down Expand Up @@ -2276,7 +2273,7 @@ void gks_gsplugin(int fctid, int dx, int dy, int dimx, int *ia, int lr1, double
style = gkss->asf[10] ? gkss->ints : predef_ints[gkss->findex - 1];
color = gkss->asf[12] ? gkss->facoli : 1;
set_color(color, p->wtype);
set_linewidth(1.0);
set_linewidth(gkss->bwidth);
if (gkss->clip_tnr != 0)
{
packb("gsave");
Expand Down
13 changes: 7 additions & 6 deletions lib/gks/plugin/pgfplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ static void fillarea(int n, double *px, double *py)
int fl_color;

fl_color = gkss->asf[12] ? gkss->facoli : 1;
p->linewidth = p->nominal_size;
p->linewidth = gkss->bwidth * p->nominal_size;

pgf_printf(p->stream, "\\definecolor{mycolor}{HTML}{%s}\n", p->rgb[fl_color]);

Expand Down Expand Up @@ -1075,11 +1075,11 @@ static void draw_path(int n, double *px, double *py, int nc, int *codes)
int i, j;
double x[3], y[3], w, h, a1, a2;
double cur_x = 0, cur_y = 0, start_x = 0, start_y = 0;
int line_width;
double line_width;
PGF_stream *buf;
GKS_UNUSED(n);

line_width = nint(gkss->bwidth);
line_width = gkss->bwidth * p->nominal_size;
if (line_width < 1) line_width = 0;

pgf_printf(p->stream, "\\definecolor{pathstroke}{HTML}{%s}\n", p->rgb[gkss->bcoli]);
Expand Down Expand Up @@ -1214,16 +1214,17 @@ static void draw_path(int n, double *px, double *py, int nc, int *codes)
break;
case 'F': /* fill and stroke */
pgf_printf(buf, "-- cycle;\n");
pgf_printf(p->stream, "\\filldraw[color=pathstroke, fill=pathfill, line width=%fpt, opacity=%f] ", line_width,
p->transparency);
pgf_printf(p->stream,
"\\filldraw[color=pathstroke, fill=pathfill, even odd rule, line width=%fpt, opacity=%f] ",
line_width, p->transparency);
pgf_memcpy(p->stream, (char *)buf->buffer, buf->length);
pgf_clear_stream(buf);
cur_x = start_x;
cur_y = start_y;
break;
case 'f': /* fill */
pgf_printf(buf, "-- cycle;\n");
pgf_printf(p->stream, "\\fill[fill=pathfill, opacity=%f] ", p->transparency);
pgf_printf(p->stream, "\\fill[fill=pathfill, even odd rule, opacity=%f] ", p->transparency);
pgf_memcpy(p->stream, (char *)buf->buffer, buf->length);
pgf_clear_stream(buf);
cur_x = start_x;
Expand Down
4 changes: 2 additions & 2 deletions lib/gks/plugin/qtplugin_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ static void polyline(int n, double *px, double *py)
p->pixmap->setPen(pen);
}
else
p->pixmap->setPen(QPen(transparent_color, ln_width, Qt::SolidLine, Qt::FlatCap, Qt::RoundJoin));
p->pixmap->setPen(QPen(transparent_color, ln_width, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));

line_routine(n, px, py, ln_type, gkss->cntnr);

Expand Down Expand Up @@ -771,7 +771,7 @@ static void fillarea(int n, double *px, double *py)
if (fl_inter == GKS_K_INTSTYLE_HOLLOW)
{
p->pixmap->setPen(
QPen(transparent_color, gkss->bwidth * p->nominal_size, Qt::SolidLine, Qt::FlatCap, Qt::RoundJoin));
QPen(transparent_color, gkss->bwidth * p->nominal_size, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
line_routine(n, px, py, DrawBorder, gkss->cntnr);
}
else if (fl_inter == GKS_K_INTSTYLE_SOLID)
Expand Down
10 changes: 5 additions & 5 deletions lib/gks/plugin/svgplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ static void stroke(void)

svg_printf(p->stream,
"<polyline clip-path=\"url(#clip%02d%d)\" style=\""
"stroke:#%02x%02x%02x; stroke-linecap:butt; stroke-linejoin:round; stroke-width:%g; stroke-opacity:%g; "
"stroke:#%02x%02x%02x; stroke-linecap:round; stroke-linejoin:round; stroke-width:%g; stroke-opacity:%g; "
"fill:none\" ",
path_id, p->rect_index, p->rgb[p->color][0], p->rgb[p->color][1], p->rgb[p->color][2], p->linewidth,
p->transparency);
Expand Down Expand Up @@ -612,7 +612,7 @@ static void line_routine(int n, double *px, double *py, int linetype, int tnr)

svg_printf(p->stream,
"<polyline clip-path=\"url(#clip%02d%d)\" style=\""
"stroke:#%02x%02x%02x; stroke-linecap:butt; stroke-linejoin:round; stroke-width:%g; stroke-opacity:%g; "
"stroke:#%02x%02x%02x; stroke-linecap:round; stroke-linejoin:round; stroke-width:%g; stroke-opacity:%g; "
"fill:none\" ",
path_id, p->rect_index, p->rgb[p->color][0], p->rgb[p->color][1], p->rgb[p->color][2], p->linewidth,
p->transparency);
Expand Down Expand Up @@ -1252,15 +1252,15 @@ static void draw_path(int n, double *px, double *py, int nc, int *codes)
break;
case 'S': /* stroke */
svg_printf(p->stream,
"\" fill=\"none\" stroke=\"#%02x%02x%02x\" stroke-opacity=\"%g\" stroke-linecap=\"butt\" "
"\" fill=\"none\" stroke=\"#%02x%02x%02x\" stroke-opacity=\"%g\" stroke-linecap=\"round\" "
"stroke-linejoin=\"round\" stroke-width=\"%g\" />",
p->rgb[gkss->bcoli][0], p->rgb[gkss->bcoli][1], p->rgb[gkss->bcoli][2], p->transparency,
gkss->bwidth * p->nominal_size);
in_path = 0;
break;
case 's': /* close and stroke */
svg_printf(p->stream,
"Z\" fill=\"none\" stroke=\"#%02x%02x%02x\" stroke-opacity=\"%g\" stroke-linecap=\"butt\" "
"Z\" fill=\"none\" stroke=\"#%02x%02x%02x\" stroke-opacity=\"%g\" stroke-linecap=\"round\" "
"stroke-linejoin=\"round\" stroke-width=\"%g\" />",
p->rgb[gkss->bcoli][0], p->rgb[gkss->bcoli][1], p->rgb[gkss->bcoli][2], p->transparency,
gkss->bwidth * p->nominal_size);
Expand All @@ -1278,7 +1278,7 @@ static void draw_path(int n, double *px, double *py, int nc, int *codes)
case 'F': /* fill and stroke */
svg_printf(p->stream,
"Z\" fill=\"#%02x%02x%02x\" fill-rule=\"evenodd\" fill-opacity=\"%g\" stroke=\"#%02x%02x%02x\" "
"stroke-opacity=\"%g\" stroke-width=\"%g\" />",
"stroke-opacity=\"%g\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"%g\" />",
p->rgb[p->color][0], p->rgb[p->color][1], p->rgb[p->color][2], p->transparency,
p->rgb[gkss->bcoli][0], p->rgb[gkss->bcoli][1], p->rgb[gkss->bcoli][2], p->transparency,
gkss->bwidth * p->nominal_size);
Expand Down
9 changes: 3 additions & 6 deletions lib/gks/ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ static void ps_init(int *pages)

set_color(-1, p->wtype);
set_foreground(-1, p->wtype);
packb("0 setlinecap 1 setlinejoin");
packb("1 setlinecap 1 setlinejoin");
set_linewidth(-1.0);
set_markersize(-1.0);
packb("0 ma");
Expand Down Expand Up @@ -1328,7 +1328,7 @@ static void cell_array(double xmin, double xmax, double ymin, double ymax, int d
else if (swap == 2)
snprintf(buffer, 100, "/ImageMatrix [%d 0 0 %d 0 0]", dx, dy);
else
snprintf(buffer, 100, "/ImageMatrix [-%d 0 %d %d 0 0]", dx, dx, dy);
snprintf(buffer, 100, "/ImageMatrix [-%d 0 0 %d %d 0]", dx, dy, dx);
packb(buffer);

snprintf(buffer, 100, "/DataSource Data /BitsPerComponent 8 /Decode [0 1%s]", wtype % 2 == 0 ? " 0 1 0 1" : "");
Expand Down Expand Up @@ -1728,15 +1728,12 @@ static void draw_lines(int n, double *px, double *py, int *attributes)
p->green[ln_color] = ((rgba >> 8) & 0xff) / 255.0;
p->blue[ln_color] = ((rgba >> 16) & 0xff) / 255.0;

packb("np 1 setlinecap");
set_linewidth(line_width);
set_color(-ln_color, p->wtype);

snprintf(buffer, 50, "%d %d m %d %d l sk", xim1, yim1, xi, yi);
packb(buffer);
}

packb("0 setlinecap");
}

static void set_bordercolor(int wtype)
Expand Down Expand Up @@ -2100,7 +2097,7 @@ void gks_drv_ps(int fctid, int dx, int dy, int dimx, int *ia, int lr1, double *r
style = gkss->asf[10] ? gkss->ints : predef_ints[gkss->findex - 1];
color = gkss->asf[12] ? gkss->facoli : 1;
set_color(color, p->wtype);
set_linewidth(1.0);
set_linewidth(gkss->bwidth);
if (gkss->clip_tnr != 0)
{
packb("gsave");
Expand Down
6 changes: 3 additions & 3 deletions lib/gks/quartz/GKSView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ - (void)draw_path:(int)n:(double *)px:(double *)py:(int)nc:(int *)codes

begin_context(context);

CGContextSetLineCap(context, kCGLineCapButt);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineJoin(context, kCGLineJoinRound);
CGContextSetLineWidth(context, gkss->bwidth * p->nominal_size);
[self set_stroke_color:gkss->bcoli:context];
Expand Down Expand Up @@ -1746,13 +1746,13 @@ - (void)draw_path:(int)n:(double *)px:(double *)py:(int)nc:(int *)codes
CGContextClosePath(context);
cur_x = start_x;
cur_y = start_y;
CGContextDrawPath(context, kCGPathFill);
CGContextDrawPath(context, kCGPathEOFill);
break;
case 'F':
CGContextClosePath(context);
cur_x = start_x;
cur_y = start_y;
CGContextDrawPath(context, kCGPathFillStroke);
CGContextDrawPath(context, kCGPathEOFillStroke);
break;
case 'Z':
CGContextClosePath(context);
Expand Down
2 changes: 1 addition & 1 deletion lib/gr/gr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6182,7 +6182,7 @@ void gr_polymarker3d(int n, double *px, double *py, double *pz)
zpoint[i] = point[i].z;
}

if (m > 0) gr_polymarker(m, xpoint, ypoint);
if (m > 0) gks_polymarker(m, xpoint, ypoint);

if (flag_graphics)
{
Expand Down

0 comments on commit ab157a8

Please sign in to comment.