[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: |
Fri, 30 Nov 2007 23:11:11 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 07/11/30 23:11:11
Modified files:
. : ChangeLog
backend : render_handler.h render_handler_agg.cpp
render_handler_cairo.cpp render_handler_ogl.cpp
gui : gui.cpp
server : edit_text_character.cpp edit_text_character.h
render.cpp render.h text.cpp
Log message:
* backend/render_handler.h, server/render.cpp: Drop set_cxform
because it's unused; drop set_matrix because its semantics are
unclear. Instead of set_matrix, add matrix arguments to
draw_line_strip and draw_poly.
* backend/render_handler_agg.cpp: Drop set_cxform and
set_matrix and
adjust draw_{line_strip,poly} to match. Drop m_current_cxform
and
m_current_matrix wihch were previously used to hold the
arguments to
set_{matrix,cxform}.
* backend/render_handler_cairo.cpp: Make cairo_init_matrix
static.
Introduce class CairoScopeMatrix which will apply a matrix to
the
current cairo matrix and revert that application when it goes
out of
scope. Remove apply_matrix in favour of CairoScopeMatrix.
* backend/render_handler_ogl.cpp, gui/gui.cpp,
server/edit_text_character.{cpp,h}, server/render.{cpp,h},
server/text.cpp : Adjust following the removal of
set_{matrix,cxform}
and changes to draw_{line_strip,poly}.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5034&r2=1.5035
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler.h?cvsroot=gnash&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.117&r2=1.118
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_cairo.cpp?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_ogl.cpp?cvsroot=gnash&r1=1.97&r2=1.98
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.117&r2=1.118
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.134&r2=1.135
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.h?cvsroot=gnash&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/gnash/server/render.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/render.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/text.cpp?cvsroot=gnash&r1=1.38&r2=1.39
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5034
retrieving revision 1.5035
diff -u -b -r1.5034 -r1.5035
--- ChangeLog 30 Nov 2007 22:36:30 -0000 1.5034
+++ ChangeLog 30 Nov 2007 23:11:10 -0000 1.5035
@@ -1,3 +1,22 @@
+2007-11-30 Bastiaan Jacques <address@hidden>
+
+ * backend/render_handler.h, server/render.cpp: Drop set_cxform
+ because it's unused; drop set_matrix because its semantics are
+ unclear. Instead of set_matrix, add matrix arguments to
+ draw_line_strip and draw_poly.
+ * backend/render_handler_agg.cpp: Drop set_cxform and set_matrix and
+ adjust draw_{line_strip,poly} to match. Drop m_current_cxform and
+ m_current_matrix wihch were previously used to hold the arguments to
+ set_{matrix,cxform}.
+ * backend/render_handler_cairo.cpp: Make cairo_init_matrix static.
+ Introduce class CairoScopeMatrix which will apply a matrix to the
+ current cairo matrix and revert that application when it goes out of
+ scope. Remove apply_matrix in favour of CairoScopeMatrix.
+ * backend/render_handler_ogl.cpp, gui/gui.cpp,
+ server/edit_text_character.{cpp,h}, server/render.{cpp,h},
+ server/text.cpp : Adjust following the removal of set_{matrix,cxform}
+ and changes to draw_{line_strip,poly}.
+
2007-11-30 Sandro Santilli <address@hidden>
* server/edit_text_character.cpp (format_text): reset bounds when in
Index: backend/render_handler.h
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- backend/render_handler.h 20 Nov 2007 17:17:10 -0000 1.51
+++ backend/render_handler.h 30 Nov 2007 23:11:10 -0000 1.52
@@ -18,7 +18,7 @@
//
//
-/* $Id: render_handler.h,v 1.51 2007/11/20 17:17:10 bjacques Exp $ */
+/* $Id: render_handler.h,v 1.52 2007/11/30 23:11:10 bjacques Exp $ */
#ifndef RENDER_HANDLER_H
#define RENDER_HANDLER_H
@@ -353,17 +353,11 @@
virtual void end_display() = 0;
- /// Geometric transforms for mesh and line_strip rendering.
- virtual void set_matrix(const matrix& m) = 0;
-
- /// Color transforms for mesh and line_strip rendering.
- virtual void set_cxform(const cxform& cx) = 0;
-
/// Draw a line-strip directly, using a thin, solid line.
//
/// Can be used to draw empty boxes and cursors.
virtual void draw_line_strip(const void* coords, int vertex_count,
- const rgba& color) = 0;
+ const rgba& color, const matrix& mat) = 0;
/// Draw a simple, solid filled polygon with a thin (~1 pixel) outline.
//
@@ -380,7 +374,7 @@
/// ignored, otherwise it is respected.
///
virtual void draw_poly(const point* corners, size_t corner_count,
- const rgba& fill, const rgba& outline, bool masked) = 0;
+ const rgba& fill, const rgba& outline, const matrix& mat, bool masked) = 0;
/// Set line and fill styles for mesh & line_strip rendering.
Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -b -r1.117 -r1.118
--- backend/render_handler_agg.cpp 10 Nov 2007 14:39:51 -0000 1.117
+++ backend/render_handler_agg.cpp 30 Nov 2007 23:11:10 -0000 1.118
@@ -17,7 +17,7 @@
-/* $Id: render_handler_agg.cpp,v 1.117 2007/11/10 14:39:51 strk Exp $ */
+/* $Id: render_handler_agg.cpp,v 1.118 2007/11/30 23:11:10 bjacques Exp $ */
// Original version by Udo Giacomozzi and Hannes Mayr,
// INDUNET GmbH (www.indunet.it)
@@ -372,9 +372,6 @@
float m_display_width;
float m_display_height;
- gnash::matrix m_current_matrix;
- gnash::cxform m_current_cxform;
-
void set_antialiased(bool enable) {
// enable=false *forces* all bitmaps to be rendered in low quality
m_enable_antialias = enable;
@@ -598,8 +595,6 @@
m_enable_antialias(true),
m_display_width(0.0),
m_display_height(0.0),
- m_current_matrix(),
- m_current_cxform(),
m_rbuf(),
m_pixf(NULL), // TODO: use an auto_ptr
_clipbounds(),
@@ -733,20 +728,6 @@
// nothing to do
}
- void set_matrix(const gnash::matrix& m)
- // Set the current transform for mesh & line-strip rendering.
- {
- // used only for drawing line strips...
- m_current_matrix = m;
- }
-
- void set_cxform(const gnash::cxform& cx)
- // Set the current color transform for mesh & line-strip rendering.
- {
- // used only for drawing line strips...
- m_current_cxform = cx;
- }
-
static void apply_matrix(const gnash::matrix& /*m*/)
// add user space transformation
{
@@ -776,14 +757,15 @@
- void draw_line_strip(const void* coords, int vertex_count, const rgba&
color)
+ void draw_line_strip(const void* coords, int vertex_count, const rgba&
color,
+ const matrix& line_mat)
// Draw the line strip formed by the sequence of points.
{
assert(m_pixf != NULL);
matrix mat = stage_matrix;
- mat.concatenate(m_current_matrix);
+ mat.concatenate(line_mat);
if ( _clipbounds.size()==0 ) return;
@@ -1878,7 +1860,7 @@
/// Draws the given polygon.
template <class scanline_type>
void draw_poly_impl(const point* corners, size_t corner_count, const rgba&
fill,
- const rgba& outline, scanline_type& sl) {
+ const rgba& outline, scanline_type& sl, const matrix& poly_mat) {
assert(m_pixf != NULL);
@@ -1887,7 +1869,7 @@
if ( _clipbounds.size()==0 ) return;
matrix mat = stage_matrix;
- mat.concatenate(m_current_matrix);
+ mat.concatenate(poly_mat);
typedef agg::rasterizer_scanline_aa<> ras_type;
renderer_base rbase(*m_pixf);
@@ -1954,7 +1936,7 @@
void draw_poly(const point* corners, size_t corner_count, const rgba& fill,
- const rgba& outline, bool masked) {
+ const rgba& outline, const matrix& mat, bool masked) {
if (masked && !m_alpha_mask.empty()) {
@@ -1964,7 +1946,7 @@
sl_type sl(m_alpha_mask.back()->get_amask());
- draw_poly_impl<sl_type> (corners, corner_count, fill, outline, sl);
+ draw_poly_impl<sl_type> (corners, corner_count, fill, outline, sl, mat);
} else {
@@ -1974,7 +1956,7 @@
sl_type sl;
- draw_poly_impl<sl_type> (corners, corner_count, fill, outline, sl);
+ draw_poly_impl<sl_type> (corners, corner_count, fill, outline, sl, mat);
}
Index: backend/render_handler_cairo.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_cairo.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- backend/render_handler_cairo.cpp 25 Nov 2007 05:02:07 -0000 1.32
+++ backend/render_handler_cairo.cpp 30 Nov 2007 23:11:10 -0000 1.33
@@ -145,6 +145,41 @@
cairo_pattern_t* _pattern;
};
+static void
+init_cairo_matrix(cairo_matrix_t* cairo_matrix, const matrix& gnash_matrix)
+{
+ cairo_matrix_init(cairo_matrix,
+ gnash_matrix.m_[0][0], gnash_matrix.m_[1][0],
+ gnash_matrix.m_[0][1], gnash_matrix.m_[1][1],
+ gnash_matrix.m_[0][2], gnash_matrix.m_[1][2]);
+}
+
+
+/// Transforms the current Cairo matrix using the given matrix. When it goes
+/// out of scope, the matrix will be reset to what it was before the new matrix
+/// was applied.
+class CairoScopeMatrix : public boost::noncopyable
+{
+public:
+ CairoScopeMatrix(cairo_t* cr, const matrix& new_mat)
+ : _cr(cr)
+ {
+ cairo_get_matrix(_cr, &old_mat);
+
+ cairo_matrix_t tmp;
+ init_cairo_matrix(&tmp, new_mat);
+ cairo_transform(_cr, &tmp);
+ }
+
+ ~CairoScopeMatrix()
+ {
+ cairo_set_matrix(_cr, &old_mat);
+ }
+
+private:
+ cairo_t* _cr;
+ cairo_matrix_t old_mat;
+};
class DSOEXPORT render_handler_cairo: public render_handler
@@ -322,25 +357,17 @@
{
}
- virtual void set_matrix(const matrix& m)
- {
- log_unimpl("set_matrix");
- }
-
- virtual void set_cxform(const cxform& cx)
- {
- log_unimpl("set_cxform");
- }
-
virtual void draw_line_strip(const void* coords, int vertex_count,
- const rgba& color)
+ const rgba& color, const matrix& mat)
{
log_unimpl("draw_line_strip");
}
virtual void draw_poly(const point* corners, size_t corner_count,
- const rgba& fill, const rgba& outline, bool masked)
+ const rgba& fill, const rgba& outline, const matrix& mat, bool masked)
{
+ CairoScopeMatrix mat_transformer(_cr, mat);
+
if (corner_count < 1) {
return;
}
@@ -643,20 +670,8 @@
}
}
- void apply_matrix(cairo_t* cr, const gnash::matrix& m)
- // add user space transformation
- {
- cairo_matrix_t mat;
- init_cairo_matrix(&mat, m);
- cairo_transform(cr, &mat);
- }
-
-
-
- void
- draw_subshape(const PathVec& path_vec,
- const matrix& mat,
- const cxform& cx,
+void
+draw_subshape(const PathVec& path_vec, const matrix& mat, const cxform& cx,
float pixel_scale,
const std::vector<cairo_pattern_t*>& fill_styles,
const std::vector<line_style>& line_styles)
@@ -804,11 +819,7 @@
return;
}
- cairo_matrix_t old_matrix;
- cairo_get_matrix(_cr, &old_matrix);
-
- apply_matrix(_cr, mat);
-
+ CairoScopeMatrix mat_transformer(_cr, mat);
std::vector<PathVec::const_iterator> subshapes = find_subshapes(path_vec);
@@ -829,8 +840,6 @@
}
destroy_cairo_patterns(fill_styles_cairo);
-
- cairo_set_matrix(_cr, &old_matrix);
}
void
@@ -862,10 +871,7 @@
std::vector<line_style> dummy_ls;
- cairo_matrix_t old_matrix;
- cairo_get_matrix(_cr, &old_matrix);
-
- apply_matrix(_cr, mat);
+ CairoScopeMatrix mat_transformer(_cr, mat);
std::vector<cairo_pattern_t*> fill_styles_cairo
= build_cairo_styles(glyph_fs, dummy_cx, mat);
@@ -874,8 +880,6 @@
draw_subshape(path_vec, mat, dummy_cx, pixel_scale, fill_styles_cairo,
dummy_ls);
destroy_cairo_patterns(fill_styles_cairo);
-
- cairo_set_matrix(_cr, &old_matrix);
}
virtual bool allow_glyph_textures()
Index: backend/render_handler_ogl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_ogl.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- backend/render_handler_ogl.cpp 30 Nov 2007 05:58:48 -0000 1.97
+++ backend/render_handler_ogl.cpp 30 Nov 2007 23:11:10 -0000 1.98
@@ -880,7 +880,8 @@
//
/// Can be used to draw empty boxes and cursors.
virtual void
- draw_line_strip(const void* coords, int vertex_count, const rgba& color)
+ draw_line_strip(const void* coords, int vertex_count, const rgba& color,
+ const matrix& mat)
{
glPushMatrix();
@@ -904,7 +905,7 @@
}
virtual void draw_poly(const point* corners, size_t corner_count,
- const rgba& fill, const rgba& outline, bool masked)
+ const rgba& fill, const rgba& outline, const matrix& mat, bool masked)
{
log_unimpl("draw_poly");
}
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -b -r1.117 -r1.118
--- gui/gui.cpp 30 Nov 2007 11:26:05 -0000 1.117
+++ gui/gui.cpp 30 Nov 2007 23:11:11 -0000 1.118
@@ -602,10 +602,8 @@
corners[2].y = ymax;
corners[3].x = xmin;
corners[3].y = ymax;
- matrix dummy;
- gnash::render::set_matrix(dummy); // reset
matrix
gnash::render::draw_poly(&corners[0], 4,
- rgba(0,0,0,0), rgba(255,0,0,255),
false);
+ rgba(0,0,0,0), rgba(255,0,0,255),
matrix::identity, false);
}
}
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -b -r1.134 -r1.135
--- server/edit_text_character.cpp 30 Nov 2007 22:36:31 -0000 1.134
+++ server/edit_text_character.cpp 30 Nov 2007 23:11:11 -0000 1.135
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: edit_text_character.cpp,v 1.134 2007/11/30 22:36:31 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.135 2007/11/30 23:11:11 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -458,7 +458,7 @@
}
void
-edit_text_character::show_cursor()
+edit_text_character::show_cursor(const matrix& mat)
{
uint16_t x = static_cast<uint16_t>(m_xcursor);
uint16_t y = static_cast<uint16_t>(m_ycursor);
@@ -470,7 +470,7 @@
box[2] = x;
box[3] = y + h;
- render::draw_line_strip(box, 2, rgba(0,0,0,255)); // draw line
+ render::draw_line_strip(box, 2, rgba(0,0,0,255), mat); // draw line
}
void
@@ -488,7 +488,6 @@
if ( (drawBorder || drawBackground) && _bounds.isFinite() )
{
matrix mat = get_world_matrix();
- render::set_matrix(mat);
point coords[4];
float xmin = _bounds.getMinX();
@@ -517,7 +516,7 @@
log_debug("rendering a Pol composed by corners %s", ss.str().c_str());
#endif
- render::draw_poly( &coords[0], 4, backgroundColor, borderColor,
true);
+ render::draw_poly( &coords[0], 4, backgroundColor, borderColor,
mat, true);
}
@@ -539,7 +538,7 @@
if (m_has_focus)
{
- show_cursor();
+ show_cursor(m);
}
clear_invalidated();
Index: server/edit_text_character.h
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- server/edit_text_character.h 18 Oct 2007 18:54:33 -0000 1.59
+++ server/edit_text_character.h 30 Nov 2007 23:11:11 -0000 1.60
@@ -340,7 +340,7 @@
bool m_has_focus;
size_t m_cursor;
- void show_cursor();
+ void show_cursor(const matrix& mat);
float m_xcursor;
float m_ycursor;
Index: server/render.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/render.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/render.cpp 10 Nov 2007 11:51:43 -0000 1.19
+++ server/render.cpp 30 Nov 2007 23:11:11 -0000 1.20
@@ -142,40 +142,23 @@
}
- // Geometric and color transforms for mesh and line_strip
rendering.
- void set_matrix(const matrix& m)
+ void draw_line_strip(const int16_t coords[], int
vertex_count, const rgba& color, const matrix& mat)
{
#ifdef DEBUG_RENDER_CALLS
GNASH_REPORT_FUNCTION;
#endif
- if (s_render_handler) s_render_handler->set_matrix(m);
- }
- void set_cxform(const cxform& cx)
- {
-#ifdef DEBUG_RENDER_CALLS
- GNASH_REPORT_FUNCTION;
-#endif
- if (s_render_handler) s_render_handler->set_cxform(cx);
- }
-
-
- void draw_line_strip(const int16_t coords[], int
vertex_count, const rgba& color)
- {
-#ifdef DEBUG_RENDER_CALLS
- GNASH_REPORT_FUNCTION;
-#endif
- if (s_render_handler)
s_render_handler->draw_line_strip(coords, vertex_count, color);
+ if (s_render_handler)
s_render_handler->draw_line_strip(coords, vertex_count, color, mat);
}
void draw_poly(const point* corners, int corner_count, const rgba& fill,
- const rgba& outline, bool masked)
+ const rgba& outline, const matrix& mat, bool masked)
{
#ifdef DEBUG_RENDER_CALLS
GNASH_REPORT_FUNCTION;
#endif
if (s_render_handler)
s_render_handler->draw_poly(corners, corner_count,
- fill, outline, masked);
+ fill, outline, mat, masked);
}
Index: server/render.h
===================================================================
RCS file: /sources/gnash/gnash/server/render.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/render.h 23 Aug 2007 09:53:03 -0000 1.17
+++ server/render.h 30 Nov 2007 23:11:11 -0000 1.18
@@ -81,12 +81,6 @@
/// See render_handler::end_display (in
backend/render_handler.h)
void end_display();
- /// See render_handler::set_matrix (in backend/render_handler.h)
- void set_matrix(const matrix& m);
-
- /// See render_handler::set_cxform (in backend/render_handler.h)
- void set_cxform(const cxform& cx);
-
/// \brief
/// Draw triangles using the current fill-style 0.
/// Clears the style list after rendering.
@@ -100,11 +94,12 @@
/// See render_handler::draw_line_strip (in
backend/render_handler.h)
void draw_line_strip(const int16_t coords[],
- int vertex_count, const rgba& color);
+ int vertex_count, const rgba& color, const
matrix& mat);
/// See render_handler::draw_poly (in backend/render_handler.h)
void draw_poly(const point* corners, int corner_count,
- const rgba& fill, const rgba& outline, bool
masked);
+ const rgba& fill, const rgba& outline, const
matrix& mat,
+ bool masked);
/// See render_handler::draw_shape_character (in
backend/render_handler.h)
void draw_shape_character(shape_character_def *def,
Index: server/text.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/text.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/text.cpp 3 Sep 2007 16:50:09 -0000 1.38
+++ server/text.cpp 30 Nov 2007 23:11:11 -0000 1.39
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: text.cpp,v 1.38 2007/09/03 16:50:09 cmusick Exp $ */
+/* $Id: text.cpp,v 1.39 2007/11/30 23:11:11 bjacques Exp $ */
// Based on the public domain work of Thatcher Ulrich <address@hidden> 2003
@@ -180,8 +180,6 @@
#endif
#ifdef DRAW_INVALID_GLYPHS_AS_EMPTY_BOXES
- render::set_matrix(mat);
-
// The EM square is 1024x1024, but
usually isn't filled up.
// We'll use about half the width, and
around 3/4 the height.
// Values adjusted by eye.
@@ -194,7 +192,7 @@
32, -656,
32, 32
};
-
render::draw_line_strip(s_empty_char_box, 5, transformed_color);
+
render::draw_line_strip(s_empty_char_box, 5, transformed_color, mat);
#endif
}