gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11984: Don't use the character matr


From: Bastiaan Jacques
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11984: Don't use the character matrix to adjust "hair" width lines. Transform
Date: Fri, 05 Mar 2010 05:19:28 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 11984
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Fri 2010-03-05 05:19:28 +0100
message:
  Don't use the character matrix to adjust "hair" width lines. Transform
  the line width according to the inverted stage matrix, so these lines
  do not scale. Fixes bug #21566.
modified:
  backend/Renderer_cairo.cpp
  backend/Renderer_cairo.h
=== modified file 'backend/Renderer_cairo.cpp'
--- a/backend/Renderer_cairo.cpp        2010-01-14 12:03:17 +0000
+++ b/backend/Renderer_cairo.cpp        2010-03-05 04:19:28 +0000
@@ -788,7 +788,8 @@
 }
 
 void
-Renderer_cairo::apply_line_style(const LineStyle& style, const cxform& cx)
+Renderer_cairo::apply_line_style(const LineStyle& style, const cxform& cx,
+                                 const SWFMatrix& mat)
 {
     cairo_line_join_t join_style = CAIRO_LINE_JOIN_MITER;
     switch(style.joinStyle()) {
@@ -831,10 +832,16 @@
     float width = style.getThickness();
 
     if ( width == 0.0 ) {
-        double hwidth = 1.0;
-
-        cairo_device_to_user_distance(_cr, &hwidth, &hwidth);
-        cairo_set_line_width(_cr, hwidth);
+
+        cairo_matrix_t inv_stage = _stage_mat;
+        cairo_matrix_invert(&inv_stage);
+
+        double xconv = 1.0;
+        double yconv = 1.0;
+
+        cairo_matrix_transform_distance(&inv_stage, &xconv, &yconv);
+
+        cairo_set_line_width(_cr, xconv);
     } else {
         // TODO: this is correct for !style.scaleThicknessVertically() 
         //       and !style.scaleThicknessHorizontally().
@@ -847,7 +854,7 @@
 
         cairo_set_line_width(_cr, width);
     }
-    
+
     rgba color = cx.transform(style.get_color());
     set_color(color);
 }
@@ -855,7 +862,8 @@
 void
 Renderer_cairo::draw_outlines(const PathVec& path_vec,
                               const std::vector<LineStyle>& line_styles,
-                              const cxform& cx)
+                              const cxform& cx,
+                              const SWFMatrix& mat)
 {
     for (PathVec::const_iterator it = path_vec.begin(), end = path_vec.end();
          it != end; ++it) {
@@ -865,7 +873,7 @@
             continue;
         }
       
-        apply_line_style(line_styles[cur_path.m_line-1], cx);
+        apply_line_style(line_styles[cur_path.m_line-1], cx, mat);
         add_path(_cr, cur_path);
         cairo_stroke(_cr);
     }  
@@ -880,7 +888,7 @@
     CairoPathRunner runner(*this, path_vec, fill_styles, _cr);
     runner.run(cx, mat);
 
-    draw_outlines(path_vec, line_styles, cx);
+    draw_outlines(path_vec, line_styles, cx, mat);
 }
 
 

=== modified file 'backend/Renderer_cairo.h'
--- a/backend/Renderer_cairo.h  2010-01-14 12:03:17 +0000
+++ b/backend/Renderer_cairo.h  2010-03-05 04:19:28 +0000
@@ -75,11 +75,13 @@
 
     void add_path(cairo_t* cr, const Path& cur_path);
 
-    void apply_line_style(const LineStyle& style, const cxform& cx);
+    void apply_line_style(const LineStyle& style, const cxform& cx,
+                          const SWFMatrix& mat);
 
     void draw_outlines(const PathVec& path_vec,
                        const std::vector<LineStyle>& line_styles,
-                       const cxform& cx);
+                       const cxform& cx,
+                       const SWFMatrix& mat);
 
     std::vector<PathVec::const_iterator> find_subshapes(const PathVec& 
path_vec);
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]