Implement plot_path for BeOS, still missing transform support...

But already looks nice: http://revolf.free.fr/beos/shots/shot_beos_netsurf_svg_001.png

svn path=/trunk/netsurf/; revision=7311
This commit is contained in:
François Revel 2009-04-25 01:42:46 +00:00
parent af5297de25
commit 0ac498bffb

View File

@ -709,6 +709,14 @@ printf("plot_tile: -> %dx%d\n", width, height);
return true; return true;
} }
static BPoint transform_pt(float x, float y, const float transform[6])
{
#warning WRITEME: XXX: handle transform!
BPoint pt(x, y);
return pt;
}
bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width, bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]) colour c, const float transform[6])
{ {
@ -724,41 +732,57 @@ bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width,
BShape shape; BShape shape;
#if 0
for (i = 0; i < n; ) { for (i = 0; i < n; ) {
if (p[i] == PLOTTER_PATH_MOVE) { if (p[i] == PLOTTER_PATH_MOVE) {
path[i] = draw_MOVE_TO; BPoint pt(p[i + 1], p[i + 2]);
path[i + 1] = p[i + 1] * 2 * 256; shape.MoveTo(pt);
path[i + 2] = -p[i + 2] * 2 * 256;
i += 3; i += 3;
} else if (p[i] == PLOTTER_PATH_CLOSE) { } else if (p[i] == PLOTTER_PATH_CLOSE) {
path[i] = draw_CLOSE_LINE; shape.Close();
i++; i++;
} else if (p[i] == PLOTTER_PATH_LINE) { } else if (p[i] == PLOTTER_PATH_LINE) {
path[i] = draw_LINE_TO; BPoint pt(p[i + 1], p[i + 2]);
path[i + 1] = p[i + 1] * 2 * 256; shape.LineTo(pt);
path[i + 2] = -p[i + 2] * 2 * 256;
i += 3; i += 3;
} else if (p[i] == PLOTTER_PATH_BEZIER) { } else if (p[i] == PLOTTER_PATH_BEZIER) {
path[i] = draw_BEZIER_TO; BPoint pt[3] = {
path[i + 1] = p[i + 1] * 2 * 256; BPoint(p[i + 1], p[i + 2]),
path[i + 2] = -p[i + 2] * 2 * 256; BPoint(p[i + 3], p[i + 4]),
path[i + 3] = p[i + 3] * 2 * 256; BPoint(p[i + 5], p[i + 6])
path[i + 4] = -p[i + 4] * 2 * 256; };
path[i + 5] = p[i + 5] * 2 * 256; shape.BezierTo(pt);
path[i + 6] = -p[i + 6] * 2 * 256;
i += 7; i += 7;
} else { } else {
LOG(("bad path command %f", p[i])); LOG(("bad path command %f", p[i]));
goto error; return false;
} }
} }
path[i] = draw_END_PATH; shape.Close();
path[i + 1] = 0;
#endif
//StrokeBezier BView *view;
#warning WRITEME
view = nsbeos_current_gc/*_lock*/();
if (view == NULL)
return false;
rgb_color old_high = view->HighColor();
float old_pen = view->PenSize();
view->SetPenSize(width);
if (fill != TRANSPARENT) {
view->SetHighColor(nsbeos_rgb_colour(fill));
view->FillShape(&shape);
}
if (c != TRANSPARENT) {
view->SetHighColor(nsbeos_rgb_colour(c));
view->StrokeShape(&shape);
}
// restore
view->SetPenSize(old_pen);
view->SetHighColor(old_high);
//nsbeos_current_gc_unlock();
#warning WRITEME: XXX: handle transform!
#if 0 /* GTK */ #if 0 /* GTK */
/* Only the internal SVG renderer uses this plot call currently, /* Only the internal SVG renderer uses this plot call currently,
* and the GTK version uses librsvg. Thus, we ignore this complexity, * and the GTK version uses librsvg. Thus, we ignore this complexity,