[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog backend/render_handler.h backen...
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash ChangeLog backend/render_handler.h backen... |
Date: |
Thu, 29 May 2008 05:20:51 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 08/05/29 05:20:51
Modified files:
. : ChangeLog
backend : render_handler.h render_handler_cairo.cpp
Log message:
* backend/render_handler.h: Add anti-alias types for future
use. Document draw_line_strip.
* backend/render_handler_cairo.cpp: Implement draw_line_strip.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6751&r2=1.6752
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler.h?cvsroot=gnash&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_cairo.cpp?cvsroot=gnash&r1=1.43&r2=1.44
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6751
retrieving revision 1.6752
diff -u -b -r1.6751 -r1.6752
--- ChangeLog 28 May 2008 23:17:27 -0000 1.6751
+++ ChangeLog 29 May 2008 05:20:48 -0000 1.6752
@@ -1,3 +1,9 @@
+2008-05-29 Bastiaan Jacques <address@hidden>
+
+ * backend/render_handler.h: Add anti-alias types for future
+ use. Document draw_line_strip.
+ * backend/render_handler_cairo.cpp: Implement draw_line_strip.
+
2008-05-29 Sandro Santilli <address@hidden>
* libbase/curl_adapter.cpp: include boost/version.hpp
Index: backend/render_handler.h
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- backend/render_handler.h 23 Apr 2008 14:29:36 -0000 1.60
+++ backend/render_handler.h 29 May 2008 05:20:50 -0000 1.61
@@ -202,6 +202,17 @@
class DSOEXPORT render_handler
{
public:
+ enum antialias_method
+ {
+ ANTIALIAS_DEFAULT, // Whatever the renderer prefers
+ ANTIALIAS_NONE, // Disabled
+
+ ANTIALIAS_MULTISAMPLE, // OpenGL ARB_multisample extension
+ ANTIALIAS_ACCUM, // OpenGL accumulation buffer
+
+ ANTIALIAS_GRAY // Cairo single-color antialiasing
+ };
+
virtual ~render_handler() {}
// Your handler should return these with a ref-count of 0. (@@ is that the
right policy?)
@@ -330,6 +341,15 @@
/// Draw a line-strip directly, using a thin, solid line.
//
/// Can be used to draw empty boxes and cursors.
+ ///
+ /// @coords an array of 16-bit signed integer coordinates. Even indices
+ /// (and 0) are x coordinates, while uneven ones are y coordinates.
+ ///
+ /// @vertex_count the number of x-y coordinates (vertices).
+ ///
+ /// @color the color to be used to draw the line strip.
+ ///
+ /// @mat the matrix to be used to transform the vertices.
virtual void draw_line_strip(const void* coords, int vertex_count,
const rgba& color, const matrix& mat) = 0;
Index: backend/render_handler_cairo.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_cairo.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- backend/render_handler_cairo.cpp 27 May 2008 04:11:34 -0000 1.43
+++ backend/render_handler_cairo.cpp 29 May 2008 05:20:50 -0000 1.44
@@ -26,7 +26,6 @@
// - Document workings of Cairo and this renderer.
// - Test bitmap implementation correctness.
// - Figure out what extend types should be used and when.
-// - Figure out what the deal with subpixel offsets is.
// - Cleanups.
// - Optimizations.
//
@@ -408,8 +407,39 @@
virtual void draw_line_strip(const void* coords, int vertex_count,
const rgba& color, const matrix& mat)
+ // In this day and age, do we still need void* pointers?
{
- log_unimpl("draw_line_strip");
+ const boost::int16_t* vertices = static_cast<const
boost::int16_t*>(coords);
+ CairoScopeMatrix mat_transformer(_cr, mat);
+
+ if (vertex_count < 2) {
+ return;
+ }
+
+ double x, y;
+ x = vertices[0];
+ y = vertices[1];
+ snap_to_half_pixel(_cr, x, y);
+
+ cairo_move_to(_cr, x, y);
+
+ for (int i = 2; i < vertex_count * 2; i += 2) {
+ x = vertices[i];
+ y = vertices[i+1];
+ snap_to_half_pixel(_cr, x, y);
+ cairo_line_to(_cr, x, y);
+ }
+
+ set_color(color);
+ cairo_set_line_cap(_cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join(_cr, CAIRO_LINE_JOIN_ROUND);
+
+ double hwidth = 1.0;
+
+ cairo_device_to_user_distance(_cr, &hwidth, &hwidth);
+ cairo_set_line_width(_cr, hwidth);
+
+ cairo_stroke(_cr);
}
virtual void draw_poly(const point* corners, size_t corner_count,
- [Gnash-commit] gnash ChangeLog backend/render_handler.h backen...,
Bastiaan Jacques <=