gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash/backend render_handler.h render_handler_a... [relea


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash/backend render_handler.h render_handler_a... [release_0_7_2]
Date: Fri, 03 Nov 2006 17:35:03 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Branch:         release_0_7_2
Changes by:     Udo Giacomozzi <udog>   06/11/03 17:35:03

Modified files:
        backend        : render_handler.h render_handler_agg.cpp 

Log message:
        Backporting...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler.h?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.17.2.1&r2=1.17.2.2
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.29.2.5&r2=1.29.2.6

Patches:
Index: render_handler.h
===================================================================
RCS file: /cvsroot/gnash/gnash/backend/render_handler.h,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -u -b -r1.17.2.1 -r1.17.2.2
--- render_handler.h    30 Oct 2006 14:28:46 -0000      1.17.2.1
+++ render_handler.h    3 Nov 2006 17:35:02 -0000       1.17.2.2
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: render_handler.h,v 1.17.2.1 2006/10/30 14:28:46 rsavoye Exp $ */
+/* $Id: render_handler.h,v 1.17.2.2 2006/11/03 17:35:02 udog Exp $ */
 
 #ifndef RENDER_HANDLER_H
 #define RENDER_HANDLER_H
@@ -394,6 +394,10 @@
     
   }
     
+  /// Sets the x/y scale for the movie  
+  virtual void set_scale(float /*xscale*/, float /*yscale*/) {
+    // nop
+  }    
     
 protected:
 

Index: render_handler_agg.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.29.2.5
retrieving revision 1.29.2.6
diff -u -b -r1.29.2.5 -r1.29.2.6
--- render_handler_agg.cpp      31 Oct 2006 13:27:49 -0000      1.29.2.5
+++ render_handler_agg.cpp      3 Nov 2006 17:35:02 -0000       1.29.2.6
@@ -16,7 +16,7 @@
 
  
 
-/* $Id: render_handler_agg.cpp,v 1.29.2.5 2006/10/31 13:27:49 strk Exp $ */
+/* $Id: render_handler_agg.cpp,v 1.29.2.6 2006/11/03 17:35:02 udog Exp $ */
 
 // Original version by Udo Giacomozzi and Hannes Mayr, 
 // INDUNET GmbH (www.indunet.it)
@@ -203,7 +203,7 @@
 
 // --- YUV VIDEO 
---------------------------------------------------------------
 // Currently not implemented.
-#if 0
+
 class agg_YUV_video : public gnash::YUV_video
 {
 public:
@@ -217,7 +217,7 @@
   }
   
 }; // class agg_YUV_video
-#endif
+
 
 
 // --- ALPHA MASK BUFFER CONTAINER 
---------------------------------------------
@@ -313,7 +313,7 @@
        int xres;
        int yres;
        int bpp;        // bits per pixel
-       double scale;
+       double xscale, yscale;
 
 
 public:
@@ -399,7 +399,7 @@
     free(bi);
        }
        
-#if 0  
+       
        gnash::YUV_video*       create_YUV_video(int w, int h)
        {         
          return new agg_YUV_video(w, h);
@@ -409,7 +409,7 @@
        {
          if (yuv) delete yuv;
        }
-#endif
+
 
   // Constructor
   render_handler_agg(int bits_per_pixel)
@@ -441,7 +441,6 @@
        memsize = size;
        xres            = x;
        yres            = y;
-       scale           = 1/20.0;
        
        if (m_pixf != NULL)
          delete m_pixf;    // TODO: is this correct??
@@ -466,7 +465,7 @@
   void begin_display(
        gnash::rgba background_color,
        int /*viewport_x0*/, int /*viewport_y0*/,
-       int viewport_width, int viewport_height,
+       int /*viewport_width*/, int /*viewport_height*/,
        float /*x0*/, float /*x1*/, float /*y0*/, float /*y1*/)
        // Set up to render a full frame from a movie and fills the
        // background.  Sets up necessary transforms, to scale the
@@ -490,10 +489,10 @@
        background_color.m_b, background_color.m_a));
 
     // calculate final pixel scale
-    double scaleX, scaleY;
+    /*double scaleX, scaleY;
     scaleX = (double)xres / (double)viewport_width / 20.0;  // 20=TWIPS
     scaleY = (double)yres / (double)viewport_height / 20.0;
-    scale = scaleX<scaleY ? scaleX : scaleY;
+    scale = scaleX<scaleY ? scaleX : scaleY;*/
     
     // reset status variables
     m_drawing_mask = false;
@@ -577,11 +576,11 @@
     const int16_t *vertex = static_cast<const int16_t*>(coords);
     
     m_current_matrix.transform(&pnt, point(vertex[0], vertex[1]));
-       path.move_to(pnt.m_x * scale, pnt.m_y * scale);
+       path.move_to(pnt.m_x * xscale, pnt.m_y * yscale);
 
     for (vertex += 2;  vertex_count > 1;  vertex_count--, vertex += 2) {
       m_current_matrix.transform(&pnt, point(vertex[0], vertex[1]));
-       path.line_to(pnt.m_x * scale, pnt.m_y * scale);
+       path.line_to(pnt.m_x * xscale, pnt.m_y * yscale);
     }
                // The vectorial pipeline
        ras.add_path(stroke);
@@ -858,7 +857,7 @@
           matrix cm;
           cm.set_inverse(fillstyle_matrix);
           m.concatenate(cm);
-          m.concatenate_scale(20.0f);
+          m.concatenate_scales(1.0f/xscale, 1.0f/yscale);
           
           sh.add_gradient_linear(fill_styles[fno], m, cx);
           break;
@@ -870,7 +869,7 @@
           matrix cm;
           cm.set_inverse(fillstyle_matrix);
           m.concatenate(cm);
-          m.concatenate_scale(20.0f);
+          m.concatenate_scales(1.0f/xscale, 1.0f/yscale);
           
           sh.add_gradient_radial(fill_styles[fno], m, cx);
           break;
@@ -887,7 +886,7 @@
           matrix cm;
           cm.set_inverse(fillstyle_matrix);
           m.concatenate(cm);
-          m.concatenate_scale(20.0f);
+          m.concatenate_scales(1.0f/xscale, 1.0f/yscale);
           
           sh.add_bitmap(dynamic_cast<agg_bitmap_info_base*> 
             (fill_styles[fno].get_bitmap_info()), m, cx, 
@@ -935,7 +934,7 @@
       rasc.styles(this_path.m_fill0-1, this_path.m_fill1-1);
       
       // starting point of path
-      path.move_to(this_path.m_ax*scale, this_path.m_ay*scale);      
+      path.move_to(this_path.m_ax*xscale, this_path.m_ay*yscale);      
       
       ecount = this_path.m_edges.size();
       edge_count += ecount;
@@ -944,10 +943,10 @@
         const edge &this_edge = this_path.m_edges[eno];
 
         if (this_edge.is_straight())
-          path.line_to(this_edge.m_ax*scale, this_edge.m_ay*scale);
+          path.line_to(this_edge.m_ax*xscale, this_edge.m_ay*yscale);
         else
-          path.curve3(this_edge.m_cx*scale, this_edge.m_cy*scale,
-                      this_edge.m_ax*scale, this_edge.m_ay*scale);
+          path.curve3(this_edge.m_cx*xscale, this_edge.m_cy*yscale,
+                      this_edge.m_ax*xscale, this_edge.m_ay*yscale);
         
       }
       
@@ -1050,7 +1049,7 @@
                   this_path.m_fill1==0 ? -1 : 0);
                   
       // starting point of path
-      path.move_to(this_path.m_ax*scale, this_path.m_ay*scale);
+      path.move_to(this_path.m_ax*xscale, this_path.m_ay*yscale);
     
       unsigned int ecount = this_path.m_edges.size();
       for (unsigned int eno=0; eno<ecount; eno++) {
@@ -1058,10 +1057,10 @@
         const edge &this_edge = this_path.m_edges[eno];
 
         if (this_edge.is_straight())
-          path.line_to(this_edge.m_ax*scale, this_edge.m_ay*scale);
+          path.line_to(this_edge.m_ax*xscale, this_edge.m_ay*yscale);
         else
-          path.curve3(this_edge.m_cx*scale, this_edge.m_cy*scale,
-                      this_edge.m_ax*scale, this_edge.m_ay*scale);
+          path.curve3(this_edge.m_cx*xscale, this_edge.m_cy*yscale,
+                      this_edge.m_ax*xscale, this_edge.m_ay*yscale);
         
       } // for edge
       
@@ -1133,7 +1132,9 @@
 
     // use avg between x and y scale                                           
     const float stroke_scale =                                                 
-      (linestyle_matrix.get_x_scale() + linestyle_matrix.get_y_scale()) / 2.0f;
+      (linestyle_matrix.get_x_scale() + linestyle_matrix.get_y_scale()) / 2.0f
+      * (xscale+yscale)/2.0f;
+    
     
     // AGG stuff
     renderer_base rbase(*m_pixf);
@@ -1171,18 +1172,17 @@
       const line_style &lstyle = line_styles[this_path.m_line-1];
       rgba color = cx.transform(lstyle.get_color());
       int width = lstyle.get_width();
-
       if (width==1)
         stroke.width(1);
       else
-        stroke.width(width*scale*stroke_scale);
+        stroke.width(width*stroke_scale);
       stroke.line_cap(agg::round_cap);
       stroke.line_join(agg::round_join);
 
         
       agg_path.remove_all();  // clear path
       
-      agg_path.move_to(this_path.m_ax*scale, this_path.m_ay*scale);
+      agg_path.move_to(this_path.m_ax*xscale, this_path.m_ay*yscale);
         
       ecount = this_path.m_edges.size();
       for (eno=0; eno<ecount; eno++) {
@@ -1190,10 +1190,10 @@
         const edge &this_edge = this_path.m_edges[eno];
         
         if (this_edge.is_straight())
-          agg_path.line_to(this_edge.m_ax*scale, this_edge.m_ay*scale);
+          agg_path.line_to(this_edge.m_ax*xscale, this_edge.m_ay*yscale);
         else
-          agg_path.curve3(this_edge.m_cx*scale, this_edge.m_cy*scale,
-                      this_edge.m_ax*scale, this_edge.m_ay*scale);
+          agg_path.curve3(this_edge.m_cx*yscale, this_edge.m_cy*yscale,
+                      this_edge.m_ax*yscale, this_edge.m_ay*yscale);
         
       } // for edges
       
@@ -1237,17 +1237,17 @@
     
     m_current_matrix.transform(&origin, 
       point(trunc(corners[0].m_x), trunc(corners[0].m_y)));
-    path.move_to(trunc(origin.m_x*scale)+0.5, trunc(origin.m_y*scale)+0.5);
+    path.move_to(trunc(origin.m_x*xscale)+0.5, trunc(origin.m_y*yscale)+0.5);
     
     for (unsigned int i=1; i<corner_count; i++) {
     
       m_current_matrix.transform(&pnt, point(corners[i].m_x, corners[i].m_y));
         
-      path.line_to(trunc(pnt.m_x*scale)+0.5, trunc(pnt.m_y*scale)+0.5);
+      path.line_to(trunc(pnt.m_x*xscale)+0.5, trunc(pnt.m_y*yscale)+0.5);
     }
     
     // close polygon
-    path.line_to(trunc(origin.m_x*scale)+0.5, trunc(origin.m_y*scale)+0.5);
+    path.line_to(trunc(origin.m_x*xscale)+0.5, trunc(origin.m_y*yscale)+0.5);
     
     // fill polygon
     if (fill.m_a>0) {
@@ -1273,8 +1273,8 @@
   
   void world_to_pixel(int *x, int *y, const float world_x, const float 
world_y) 
   {
-    *x = (int) (world_x * scale);
-    *y = (int) (world_y * scale);
+    *x = (int) (world_x * xscale);
+    *y = (int) (world_y * yscale);
   }
   
   
@@ -1323,6 +1323,12 @@
     
   }
   
+  void set_scale(float new_xscale, float new_yscale) {
+    xscale = new_xscale/20.0f;
+    yscale = new_yscale/20.0f;
+    printf("set_scale\n");
+  }
+  
 private:  // private methods  
 
   /// Returns the cache manager instance of the given character definition.




reply via email to

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