gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, openvg, updated. b8359c35a8b5eac0d290


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, openvg, updated. b8359c35a8b5eac0d29002854692ea8d1b20c13b
Date: Fri, 11 Feb 2011 02:46:57 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, openvg has been updated
       via  b8359c35a8b5eac0d29002854692ea8d1b20c13b (commit)
       via  8d973ffa5ce5a0979c6fc9fa445adb9630ed2384 (commit)
       via  5d619911f5a756ed91a087136755e4d20a45b3bd (commit)
       via  7b4ebb3f1693a4d82000f8779e9e42493eb1764a (commit)
       via  ef53d14da6de20e5750c6e9b64151b0d93bf79e1 (commit)
       via  716338da5b7352d1647aafa7d1ac3723ec8cedb5 (commit)
      from  9896128cab365d44d08a954a753b1d32ec7a3c77 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=b8359c35a8b5eac0d29002854692ea8d1b20c13b


commit b8359c35a8b5eac0d29002854692ea8d1b20c13b
Author: Rob Savoye <address@hidden>
Date:   Thu Feb 10 19:45:10 2011 -0700

    Use CXForm for all bitmaps.
    Enable hardware masking.
    Add support for the Aspect ratio for bitmaps.

diff --git a/librender/openvg/OpenVGBitmap.cpp 
b/librender/openvg/OpenVGBitmap.cpp
index e06ea56..dd0d18a 100644
--- a/librender/openvg/OpenVGBitmap.cpp
+++ b/librender/openvg/OpenVGBitmap.cpp
@@ -22,6 +22,7 @@
 #include "GnashImage.h"
 #include "Renderer.h"
 #include "FillStyle.h"
+#include "SWFCxForm.h"
 #include "openvg/OpenVGRenderer.h"
 #include "openvg/OpenVGBitmap.h"
 #include "VG/openvg.h"
@@ -155,6 +156,7 @@ OpenVGBitmap *
 OpenVGBitmap::createRadialBitmap(float cx, float cy, float fx, float fy,
                                  float radial, const rgba &incolor,
                                  const GradientFill::GradientRecords &records,
+                                 const SWFCxForm& cxform,
                                  VGPaint paint)
 {
     // GNASH_REPORT_FUNCTION;
@@ -215,14 +217,18 @@ OpenVGBitmap *
 OpenVGBitmap::createLinearBitmap(float x0, float y0, float x1, float y1,
                                  const rgba &incolor,
                                  const GradientFill::GradientRecords &records,
+                                 const SWFCxForm& cxform,                      
           
                                  const VGPaint paint)
 {
     // GNASH_REPORT_FUNCTION;
+
+    rgba nc = cxform.transform(incolor);
+
     VGfloat color[] = {
-        incolor.m_r / 255.0f,
-        incolor.m_g / 255.0f,
-        incolor.m_b / 255.0f,
-        incolor.m_a / 255.0f
+        nc.m_r / 255.0f,
+        nc.m_g / 255.0f,
+        nc.m_b / 255.0f,
+        nc.m_a / 255.0f
     };
     vgSetParameteri (paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
     vgSetParameterfv (paint, VG_PAINT_COLOR, 4, color);
@@ -250,10 +256,10 @@ OpenVGBitmap::createLinearBitmap(float x0, float y0, 
float x1, float y1,
     VGfloat ramps[entries];
     int j = 0;
     for (size_t i=0; i!= records.size(); ++i) {
-        std::cerr << "The record is: " << records[i].ratio/255.0f;
-        rgba c = records[i].color;
-        std::cerr << ", " << c.m_r/255.0f << ", " << c.m_g/255.0f << ", "
-                  << c.m_b/255.0f << ", " << c.m_a/255.0f << std::endl;
+        // std::cerr << "The record is: " << records[i].ratio/255.0f;
+        rgba c = cxform.transform(records[i].color);
+        // std::cerr << ", " << c.m_r/255.0f << ", " << c.m_g/255.0f << ", "
+        //           << c.m_b/255.0f << ", " << c.m_a/255.0f << std::endl;
         // The set of 5 for each record is simply: { Offset, R, G, B, A }
         ramps[j++] = records[i].ratio/255.0f;
         ramps[j++] = c.m_r / 255.0f;
@@ -295,7 +301,7 @@ OpenVGBitmap::applyPatternBitmap(const gnash::SWFMatrix& 
matrix,
     mat = matrix;
     mat.invert();
     Renderer_ovg::printVGMatrix(matrix);
-    Renderer_ovg::printVGMatrix(mat);
+    //Renderer_ovg::printVGMatrix(mat);
     
     memset(vmat, 0, sizeof(vmat));
     // Convert from fixed point to floating point
@@ -333,7 +339,8 @@ OpenVGBitmap::applyPatternBitmap(const gnash::SWFMatrix& 
matrix,
     }
 
     vgPaintPattern(_vgpaint, _vgimage);
-
+    vgDestroyImage(_vgimage);
+    
     return this;
 }
 
diff --git a/librender/openvg/OpenVGBitmap.h b/librender/openvg/OpenVGBitmap.h
index 24a9d7a..5b0741b 100644
--- a/librender/openvg/OpenVGBitmap.h
+++ b/librender/openvg/OpenVGBitmap.h
@@ -27,6 +27,8 @@
 
 namespace gnash {
 
+class SWFCxForm;
+
 namespace renderer {
 
 namespace openvg {
@@ -59,10 +61,12 @@ public:
     OpenVGBitmap *createRadialBitmap(float x0, float y0, float x1, float y1,
                                      float radial, const rgba &incolor,
                                      const GradientFill::GradientRecords 
&records,
+                                     const SWFCxForm& cx,
                                      VGPaint paint);
     OpenVGBitmap *createLinearBitmap(float x0, float y0, float x1, float y1,
                                      const rgba &incolor,
                                      const GradientFill::GradientRecords 
&records,
+                                     const SWFCxForm& cx,
                                      const VGPaint paint);
 
     OpenVGBitmap *applyPatternBitmap(const gnash::SWFMatrix& matrix,
diff --git a/librender/openvg/OpenVGRenderer.cpp 
b/librender/openvg/OpenVGRenderer.cpp
index e76c4b1..7dd5264 100644
--- a/librender/openvg/OpenVGRenderer.cpp
+++ b/librender/openvg/OpenVGRenderer.cpp
@@ -89,7 +89,7 @@ public:
         {
             GNASH_REPORT_FUNCTION;            
             vgGetMatrix(_orig_mat);
-            Renderer_ovg::printVGMatrix(_orig_mat);
+            // Renderer_ovg::printVGMatrix(_orig_mat);
             
             float mat[9];
             memset(mat, 0, sizeof(mat));
@@ -99,8 +99,8 @@ public:
             mat[4] = m.sy  / 65536.0f;
             mat[6] = m.tx;
             mat[7] = m.ty;
-            Renderer_ovg::printVGMatrix(mat);
             vgMultMatrix(mat);
+            Renderer_ovg::printVGMatrix(mat);
         }
   
     ~eglScopeMatrix()
@@ -209,11 +209,12 @@ Renderer_ovg::Renderer_ovg()
     : _display_width(0.0),
       _display_height(0.0),
       _drawing_mask(false),
-      _fillpaint(0),
-      _strokepaint(0)
 #ifdef OPENVG_VERSION_1_1    
-      , _mask(0)
+      _mask_layer(VG_INVALID_HANDLE),
 #endif
+      _fillpaint(VG_INVALID_HANDLE),
+      _strokepaint(VG_INVALID_HANDLE),
+      _aspect_ratio(0.75)       // 4:3 aspect ratio
 {
     // GNASH_REPORT_FUNCTION;
 }
@@ -221,15 +222,19 @@ Renderer_ovg::Renderer_ovg()
 Renderer_ovg::Renderer_ovg(renderer::GnashDevice::dtype_t /* dtype */)
     : _display_width(0.0),
       _display_height(0.0),
-      _drawing_mask(false)
+      _drawing_mask(false),
 #ifdef OPENVG_VERSION_1_1    
-      , _mask(0)
+      _mask_layer(VG_INVALID_HANDLE),
 #endif
+      _fillpaint(VG_INVALID_HANDLE),
+      _strokepaint(VG_INVALID_HANDLE),
+      _aspect_ratio(0.75)       // 4:3 aspect ratio
 {
     GNASH_REPORT_FUNCTION;
 
     set_scale(1.0f, 1.0f);
-    
+
+#if 0
     _fillpaint = vgCreatePaint();
     
     _strokepaint = vgCreatePaint();
@@ -239,6 +244,7 @@ Renderer_ovg::Renderer_ovg(renderer::GnashDevice::dtype_t 
/* dtype */)
 
     // this pain object is used for paths
     vgSetPaint (_strokepaint, VG_STROKE_PATH);
+#endif
 }
 
 void
@@ -249,14 +255,12 @@ Renderer_ovg::init(float x, float y)
     _display_width = x;
     _display_height = y;
     
-    _fillpaint = vgCreatePaint();
-    
-    _strokepaint = vgCreatePaint();
-    
     // this paint object is used for solid, gradient, and pattern fills.
-    vgSetPaint (_fillpaint,   VG_FILL_PATH);
+    _fillpaint = vgCreatePaint();
+    vgSetPaint (_fillpaint, VG_FILL_PATH);
 
     // this pain object is used for paths
+    _strokepaint = vgCreatePaint();
     vgSetPaint (_strokepaint, VG_STROKE_PATH);
 
     // Turn on alpha blending.
@@ -269,10 +273,7 @@ Renderer_ovg::init(float x, float y)
     vgSetfv( VG_CLEAR_COLOR, 4, clearColor );
     
 #ifdef OPENVG_VERSION_1_1    
-    // If masking isn't enabled, don't use it.
-    if (vgGeti(VG_MASKING) == VG_TRUE) {
-        _mask = vgCreateMaskLayer(x, y);
-    }
+    _mask_layer = vgCreateMaskLayer(x, y);
 #endif
 
     log_debug("VG Vendor is %s, VG Version is %s, VG Renderer is %s",
@@ -292,7 +293,7 @@ Renderer_ovg::~Renderer_ovg()
     vgDestroyPaint(_fillpaint);
     vgDestroyPaint(_strokepaint);
 #ifdef OPENVG_VERSION_1_1    
-    vgDestroyMaskLayer(_mask);
+    vgDestroyMaskLayer(_mask_layer);
 #endif
 }
 
@@ -440,7 +441,7 @@ Renderer_ovg::begin_display(gnash::rgba const&, int width, 
int height,
 void
 Renderer_ovg::end_display()
 {
-//    GNASH_REPORT_FUNCTION;
+    GNASH_REPORT_FUNCTION;
 }
 
 /// Draw a line-strip directly, using a thin, solid line. 
@@ -578,18 +579,16 @@ Renderer_ovg::begin_submit_mask()
 {
     GNASH_REPORT_FUNCTION;
 
-    // If masking is disabled, then we can't use it
-    if (vgGeti(VG_MASKING) == VG_TRUE) {
-        PathVec mask;
-        _masks.push_back(mask);
-        _drawing_mask = true;
-    }
+    PathVec mask;
+    _masks.push_back(mask);
+    _drawing_mask = true;
 }
 
 void
 Renderer_ovg::end_submit_mask()
 {
     GNASH_REPORT_FUNCTION;
+
     // If masking is disabled, rhen we can't use it
     if (_drawing_mask == true) {
         _drawing_mask = false;    
@@ -618,7 +617,7 @@ Renderer_ovg::apply_mask()
     
     vgSeti (VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
     vgLoadIdentity();
-    vgGetMatrix (omat);
+    vgGetMatrix (omat);         // get the current matrix
     
     memset(mat, 0, sizeof(mat));
     mat[0] =  stage_matrix.get_x_scale(); // scale sx
@@ -628,27 +627,17 @@ Renderer_ovg::apply_mask()
     mat[6] =  0;    // shift tx
     mat[7] =  _display_height;   // shift ty
     vgLoadMatrix(mat);
+    Renderer_ovg::printVGMatrix(mat);
     
-#ifdef OPENVG_VERSION_1_1    
-    vgMask(_mask, VG_FILL_MASK, 0, 0, _display_width, _display_height); 
+#ifdef OPENVG_VERSION_1_1
+    vgMask(_mask_layer, VG_FILL_MASK, 0, 0, _display_width, _display_height);
 #endif
 // Call add_paths for each mask.
     std::for_each(_masks.begin(), _masks.end(),
                   boost::bind(&Renderer_ovg::add_paths, this, _1));
-    vgSeti(VG_MASKING, VG_TRUE);      
-    vgLoadMatrix (omat);
-}
-
-void
-Renderer_ovg::add_paths(const PathVec& path_vec)
-{
-    // GNASH_REPORT_FUNCTION;
-
-    SWFCxForm dummy_cx;
+    vgSeti(VG_MASKING, VG_TRUE);
     
-    FillStyle coloring = FillStyle(SolidFill(rgba(0, 255, 0, 255)));
-
-    draw_submask(path_vec, SWFMatrix(), dummy_cx, coloring);
+    vgLoadMatrix (omat);        // restore the current matrix
 }
 
 void
@@ -656,7 +645,7 @@ Renderer_ovg::disable_mask()
 {
     GNASH_REPORT_FUNCTION;
     
-    if (vgGeti(VG_MASKING) == VG_TRUE) {
+    // if (vgGeti(VG_MASKING) == VG_TRUE) {
         _masks.pop_back();
         
         if (_masks.empty()) {
@@ -664,7 +653,19 @@ Renderer_ovg::disable_mask()
         } else {
             apply_mask();
         }
-    }
+    // }
+}
+
+void
+Renderer_ovg::add_paths(const PathVec& path_vec)
+{
+    GNASH_REPORT_FUNCTION;
+
+    SWFCxForm dummy_cx;
+    
+    FillStyle coloring = FillStyle(SolidFill(rgba(0, 255, 0, 255)));
+
+    draw_submask(path_vec, SWFMatrix(), dummy_cx, coloring);
 }
 
 Path
@@ -682,8 +683,7 @@ Renderer_ovg::reverse_path(const Path& cur_path)
     float prev_ax = cur_end.ap.x;
     float prev_ay = cur_end.ap.y; 
     
-    for (std::vector<Edge>::const_reverse_iterator it = 
cur_path.m_edges.rbegin()+1, end = cur_path.m_edges.rend();
-         it != end; ++it) {
+    for (std::vector<Edge>::const_reverse_iterator it = 
cur_path.m_edges.rbegin()+1, end = cur_path.m_edges.rend(); it != end; ++it) {
         const Edge& cur_edge = *it;
         
         if (prev_ax == prev_cx && prev_ay == prev_cy) {
@@ -850,6 +850,8 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
           CachedBitmap *cb = boost::apply_visitor(GetBitmap(), style.fill);
           // Convert the GnashImage to a VG Image
           OpenVGBitmap *binfo = new OpenVGBitmap(cb, _fillpaint);
+          // Adjust the X scale by the aspect ratio or images get squished
+          sm.sx = sm.sx * _aspect_ratio;
           // Apply the transformation and paint
           binfo->applyPatternBitmap(sm, OpenVGBitmap::WRAP_FILL, _fillpaint);
           break;
@@ -862,8 +864,9 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
           CachedBitmap *cb = boost::apply_visitor(GetBitmap(), style.fill);    
      
           // Convert the GnashImage to a VG Image
           OpenVGBitmap *binfo = new OpenVGBitmap(cb, _fillpaint);
+          // Adjust the X scale by the aspect ratio or images get squished
+          sm.sx = sm.sx * _aspect_ratio;
           // Apply the transformation and paint
-          // sm.sx = 2450; // FIXME: debug hack
           binfo->applyPatternBitmap(sm, OpenVGBitmap::WRAP_FILL, _fillpaint);
           break;
       } 
@@ -1174,24 +1177,23 @@ Renderer_ovg::draw_subshape(const PathVec& path_vec,
                 // log_debug("Fill Style Type: Linear Gradient, %d records", 
records.size());
                 binfo->createLinearBitmap((*(refs[0])).ap.x, (*(refs[0])).ap.y,
                                           _display_width * 20.0f, 
(_display_height * 20.0f)/2,
-                                          incolor, records, _fillpaint);
+                                          incolor, records, cx, _fillpaint);
             }
             if (fill_type == SWF::FILL_RADIAL_GRADIENT) {
                 rgba incolor = boost::apply_visitor(GetColor(), 
fill_styles[i].fill);
                 double focalpt = boost::apply_visitor(GetFocalPoint(), 
fill_styles[i].fill);
                 const std::vector<gnash::GradientRecord> &records =
                     boost::apply_visitor(GetGradientRecords(), 
fill_styles[i].fill);
-                // log_debug("Fill Style Type: Radial Gradient: focal is: %d, 
%d records",
-                //           focalpt, records.size());
+                log_debug("Fill Style Type: Radial Gradient: focal is: %d, 
%d:%d",
+                          focalpt, (*(refs[0])).ap.x, (*(refs[0])).ap.y);
                 OpenVGBitmap* binfo = new OpenVGBitmap(_fillpaint);
                 // All positions are specified in twips, which are 20 to the
                 // pixel. Use the display size for the extent of the shape, 
                 // as it'll get clipped by OpenVG at the end of the
                 // shape that is being filled with the gradient.
                 binfo->createRadialBitmap((*(refs[0])).ap.x, (*(refs[0])).ap.y,
-                                          (*(refs[0])).ap.x * 3,
-                                          (*(refs[0])).ap.y * 3, focalpt,
-                                          incolor, records, _fillpaint);
+                                          (*(refs[0])).ap.x+1000, 
(*(refs[0])).ap.y+1000, focalpt,
+                                          incolor, records, cx, _fillpaint);
             }
             for (PathPtrVec::const_iterator it = refs.begin(), end = 
refs.end();
                  it != end; ++it) {
@@ -1214,7 +1216,7 @@ void
 Renderer_ovg::draw_submask(const PathVec& path_vec,
                            const SWFMatrix& /* mat */,
                            const SWFCxForm& /* cx */,
-                           const FillStyle& /* f_style */)
+                            const FillStyle& /* f_style */)
 {
     GNASH_REPORT_FUNCTION;
     
@@ -1250,8 +1252,8 @@ Renderer_ovg::draw_submask(const PathVec& path_vec,
         closepath(vg_path);
     }
     
-#ifdef OPENVG_VERSION_1_1    
-    vgRenderToMask(vg_path, VG_FILL_PATH, VG_INTERSECT_MASK); //FIXME
+#ifdef OPENVG_VERSION_1_1
+    vgRenderToMask(vg_path, VG_FILL_PATH, VG_INTERSECT_MASK);
 #endif
     vgDestroyPath(vg_path);
 }
@@ -1318,7 +1320,9 @@ Renderer_ovg::drawGlyph(const SWF::ShapeRecord& rec, 
const rgba& c,
 {
     // GNASH_REPORT_FUNCTION;
 
-    if (_drawing_mask) abort();
+    if (_drawing_mask) {
+        abort();
+    }
     
     if (rec.getBounds().is_null()) {
         return;
diff --git a/librender/openvg/OpenVGRenderer.h 
b/librender/openvg/OpenVGRenderer.h
index 5bcbcc1..ed9d161 100644
--- a/librender/openvg/OpenVGRenderer.h
+++ b/librender/openvg/OpenVGRenderer.h
@@ -173,7 +173,6 @@ public:
 #ifdef OPENVG_VERSION_1_1
     VGMaskLayer _mask_layer;
 #endif
-  
     gnash::SWFMatrix stage_matrix;  // conversion from TWIPS to pixels
     
     /// this paint object is used for solid, gradient, and pattern fills.
@@ -182,19 +181,25 @@ public:
     /// this pain object is used for paths
     VGPaint     _strokepaint;
 
-    /// This stores the Aspect Ratio, which is required to properly set the X
-    /// axis scale. This is usually represented as 4:3 or 16:9 for most
-    /// framebuffers. To get the scale, divide the 2nd argument by the first,
-    /// ie... 4:3 = 3/4 = 0.75.
+    /// This stores the Aspect Ratio, which is required to properly
+    /// set the X axis scale. This is usually represented as 4:3 or
+    /// 16:9 for most framebuffers. To get the scale, divide the 2nd
+    /// argument by the first, ie... 4:3 = 3/4 = 0.75.
+    /// The official calculation for the aspect ratio for a monitor of
+    /// 800x480 returns a 5:3 aspect ratio, which for a WVGA LCD
+    /// touchscreen is wrong. The manufacturer specs say it's a 4:3 or
+    /// 16:9, so we use 4:3, which in my testing is correct.
     double      _aspect_ratio;
     
-    // FIXME: A cache for the VGImages might make some sense assuming it takes 
more time
-    // to render the cached GnashImage to a VGImage. Right now every ti;l a 
fill style is
-    // applied, the VGImage is rebuilt from the GnashImage. This appears to be 
relatively
-    // fast, and possibly faster than the lookup in a map as the size of the 
cache grows.
-    // The other issue would be when to clear the cache, as we have no 
knowledge from the VM
-    // when images are deleted, or unused.
-//    std::map<CachedBitmap *, VGImage > _image_cache;
+    // FIXME: A cache for the VGImages might make some sense assuming
+    // it takes more time to render the cached GnashImage to a
+    // VGImage. Right now every til a fill style is applied, the
+    // VGImage is rebuilt from the GnashImage. This appears to be
+    // relatively fast, and possibly faster than the lookup in a map
+    // as the size of the cache grows. The other issue would be when
+    // to clear the cache, as we have no knowledge from the VM when
+    // images are deleted, or unused.
+    // std::map<CachedBitmap *, VGImage > _image_cache;
 };
 
 DSOEXPORT Renderer* create_handler(const char *pixelformat);

http://git.savannah.gnu.org/cgit//commit/?id=8d973ffa5ce5a0979c6fc9fa445adb9630ed2384


commit 8d973ffa5ce5a0979c6fc9fa445adb9630ed2384
Author: Rob Savoye <address@hidden>
Date:   Thu Feb 10 19:44:12 2011 -0700

    remove extra FBGlue constructor/destructor

diff --git a/gui/fb/fb_glue_agg.cpp b/gui/fb/fb_glue_agg.cpp
index 449dbdf..a5a8b35 100644
--- a/gui/fb/fb_glue_agg.cpp
+++ b/gui/fb/fb_glue_agg.cpp
@@ -42,15 +42,15 @@ namespace gnash {
 
 namespace gui {
 
-FBGlue::FBGlue()
-{
-    GNASH_REPORT_FUNCTION;
-}
+// FBGlue::FBGlue()
+// {
+//     GNASH_REPORT_FUNCTION;
+// }
 
-FBGlue::~FBGlue()
-{
-    GNASH_REPORT_FUNCTION;
-}
+// FBGlue::~FBGlue()
+// {
+//     GNASH_REPORT_FUNCTION;
+// }
 
 //---------------------------------------------
 FBAggGlue::FBAggGlue()
@@ -226,11 +226,13 @@ FBAggGlue::prepDrawingArea(FbWidget */* drawing_area */)
     // creating the renderer.
 }
 
+#if 0
 void
 FBGlue::render(void * /* region */)
 {
     GNASH_REPORT_FUNCTION;
 }
+#endif
 
 void
 FBAggGlue::render()

http://git.savannah.gnu.org/cgit//commit/?id=5d619911f5a756ed91a087136755e4d20a45b3bd


commit 5d619911f5a756ed91a087136755e4d20a45b3bd
Author: Rob Savoye <address@hidden>
Date:   Thu Feb 10 19:42:46 2011 -0700

    reformatting

diff --git a/gui/fb/fb.cpp b/gui/fb/fb.cpp
index 11a116b..d4b38b3 100644
--- a/gui/fb/fb.cpp
+++ b/gui/fb/fb.cpp
@@ -203,25 +203,23 @@ FBGui::init(int argc, char *** argv)
 #ifdef RENDERER_AGG
     if (renderer == "agg") {
         _glue.reset(new FBAggGlue());
-    } else
+    }
 #endif
 #ifdef RENDERER_OPENVG
-        if (renderer == "openvg") {
+    if (renderer == "openvg") {
         _glue.reset(new FBOvgGlue(0));
+        // Initialize the glue layer between the renderer and the gui toolkit
+        _glue->init(argc, argv);
+        
+        FBOvgGlue *ovg = reinterpret_cast<FBOvgGlue *>(_glue.get());
+        // Set "window" size
+        _width =  ovg->getWidth();
+        _height = ovg->getHeight();
+            log_debug("Width:%d, Height:%d", _width, _height);
     } else {
-#endif
         log_error("No renderer! %s not supported.", renderer);
     }
-        
-    // Initialize the glue layer between the renderer and the gui toolkit
-    _glue->init(argc, argv);
-
-    FBOvgGlue *ovg = reinterpret_cast<FBOvgGlue *>(_glue.get());
-    // Set "window" size
-    _width =  ovg->getWidth();
-    _height = ovg->getHeight();
-    log_debug("Width:%d, Height:%d", _width, _height);
-    
+#endif
     disable_terminal();
     
     // Initialize all the input devices
@@ -303,8 +301,11 @@ FBGui::init(int argc, char *** argv)
 
     _validbounds.setTo(0, 0, _width - 1, _height - 1);
 
+#ifdef RENDERER_OPENVG
     _renderer.reset(renderer::openvg::create_handler(0));
-  
+#else
+    _renderer.reset(renderer::openvg::create_Renderer_agg(0));
+#endif
     renderer::openvg::Renderer_ovg *rend = reinterpret_cast
         <renderer::openvg::Renderer_ovg *>(_renderer.get());
     rend->init(_width, _height);

http://git.savannah.gnu.org/cgit//commit/?id=7b4ebb3f1693a4d82000f8779e9e42493eb1764a


commit 7b4ebb3f1693a4d82000f8779e9e42493eb1764a
Author: Rob Savoye <address@hidden>
Date:   Thu Feb 10 19:42:14 2011 -0700

    enable debug message, remove blank lines

diff --git a/gui/gui.cpp b/gui/gui.cpp
index 51341f0..4f92445 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -263,7 +263,7 @@ Gui::updateStageMatrix()
     if (!_stage) {
         // When VM initializes, we'll get a call to resize_view, which
         // would call us again.
-        //log_debug("Can't update stage matrix till VM is initialized");
+        log_debug("Can't update stage matrix till VM is initialized");
         return;
     }
     
@@ -286,7 +286,7 @@ Gui::updateStageMatrix()
             // stage matrix that returns nan values.                   
             _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
             _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
-            
+
             // Scale proportionally, using smallest scale
             if (_xscale < _yscale) {
                 _yscale = _xscale;
@@ -294,7 +294,7 @@ Gui::updateStageMatrix()
                 _xscale = _yscale;
             }
             break;
-        
+
         case movie_root::SCALEMODE_NOBORDER:
             // set new scale value ( user-pixel / pseudo-pixel )
             _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;

http://git.savannah.gnu.org/cgit//commit/?id=ef53d14da6de20e5750c6e9b64151b0d93bf79e1


commit ef53d14da6de20e5750c6e9b64151b0d93bf79e1
Author: Rob Savoye <address@hidden>
Date:   Tue Feb 8 16:46:19 2011 -0700

    add private data for the aspect ratio, so we can adjust bitmaps to be 
correct.

diff --git a/librender/openvg/OpenVGRenderer.h 
b/librender/openvg/OpenVGRenderer.h
index e7c8a0c..5bcbcc1 100644
--- a/librender/openvg/OpenVGRenderer.h
+++ b/librender/openvg/OpenVGRenderer.h
@@ -127,19 +127,6 @@ public:
     static const char *getErrorString(VGErrorCode error);
 
     // VGImage (CachedBitmap *x) { return _image_cache[x]; };
-#if 0
-    // These are all required by the Render class
-    void draw_poly(const point* corners, size_t corner_count,
-                           const rgba& fill, const rgba& outline,
-                           const SWFMatrix& mat, bool masked);
-    void drawVideoFrame(gnash::image::GnashImage*, const gnash::Transform&,
-                        const gnash::SWFRect*, bool);
-
-    void renderToImage(boost::shared_ptr<IOChannel> io,FileType type);
-    void set_invalidated_regions(const InvalidatedRanges& ranges);
-    
-    void begin_submit_mask();
-#endif
   private:
     void add_paths(const PathVec& path_vec);
     Path reverse_path(const Path& cur_path);
@@ -183,6 +170,9 @@ public:
   
     std::vector<PathVec> _masks;
     bool        _drawing_mask;
+#ifdef OPENVG_VERSION_1_1
+    VGMaskLayer _mask_layer;
+#endif
   
     gnash::SWFMatrix stage_matrix;  // conversion from TWIPS to pixels
     
@@ -192,9 +182,12 @@ public:
     /// this pain object is used for paths
     VGPaint     _strokepaint;
 
-#ifdef OPENVG_VERSION_1_1
-    VGMaskLayer _mask;
-#endif
+    /// This stores the Aspect Ratio, which is required to properly set the X
+    /// axis scale. This is usually represented as 4:3 or 16:9 for most
+    /// framebuffers. To get the scale, divide the 2nd argument by the first,
+    /// ie... 4:3 = 3/4 = 0.75.
+    double      _aspect_ratio;
+    
     // FIXME: A cache for the VGImages might make some sense assuming it takes 
more time
     // to render the cached GnashImage to a VGImage. Right now every ti;l a 
fill style is
     // applied, the VGImage is rebuilt from the GnashImage. This appears to be 
relatively

http://git.savannah.gnu.org/cgit//commit/?id=716338da5b7352d1647aafa7d1ac3723ec8cedb5


commit 716338da5b7352d1647aafa7d1ac3723ec8cedb5
Author: Rob Savoye <address@hidden>
Date:   Sun Feb 6 17:52:12 2011 -0700

    minor reformatting only

diff --git a/libcore/swf/ShapeRecord.cpp b/libcore/swf/ShapeRecord.cpp
index 99d070a..ddc7be5 100644
--- a/libcore/swf/ShapeRecord.cpp
+++ b/libcore/swf/ShapeRecord.cpp
@@ -99,10 +99,8 @@ public:
     const Edge& getNextEdge()
     {
         const Edge& ret = _paths[_currpath][_curredge];
-        if ( ++_curredge >= _paths[_currpath].size() )
-        {
-            if ( ++_currpath >= _paths.size() )
-            {
+        if ( ++_curredge >= _paths[_currpath].size() ) {
+            if ( ++_currpath >= _paths.size() ) {
                 // this is not really needed,
                 // but it's simpler to do so that
                 // to make next call fail or abort..
@@ -219,8 +217,7 @@ ShapeRecord::setLerp(const ShapeRecord& a, const 
ShapeRecord& b,
     // shape
     const Paths& paths1 = a.paths();
     const Paths& paths2 = b.paths();
-    for (size_t i = 0, k = 0, n = 0; i < _paths.size(); i++)
-    {
+    for (size_t i = 0, k = 0, n = 0; i < _paths.size(); i++) {
         Path& p = _paths[i];
         const Path& p1 = i < paths1.size() ? paths1[i] : empty_path;
         const Path& p2 = n < paths2.size() ? paths2[n] : empty_path;
@@ -235,8 +232,7 @@ ShapeRecord::setLerp(const ShapeRecord& a, const 
ShapeRecord& b,
         const size_t len = p1.size();
         p.m_edges.resize(len);
 
-        for (size_t j=0; j < p.size(); j++)
-        {
+        for (size_t j=0; j < p.size(); j++) {
             Edge& e = p[j];
             const Edge& e1 = j < p1.size() ? p1[j] : empty_edge;
 
@@ -270,7 +266,6 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                             tag == SWF::DEFINESHAPE4_);
 
     if (styleInfo) {
-
         _bounds = readRect(in);
     
         IF_VERBOSE_PARSE(
@@ -290,8 +285,7 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
         readLineStyles(_lineStyles, in, tag, m, r);
     }
 
-    if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2 )
-    {
+    if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2 ) {
         assert(!styleInfo);
     }
     
@@ -306,8 +300,7 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
             tag, num_fill_bits, num_line_bits);
     );
     
-    if ( !num_fill_bits && !num_line_bits )
-    {
+    if ( !num_fill_bits && !num_line_bits ) {
         /// When reading font glyphs it happens to read 1 byte
         /// past end boundary of a glyph due to fill/line bits being
         /// zero.
@@ -323,8 +316,7 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
         ///
         ///
         if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2 || 
-                tag == SWF::DEFINEFONT3)
-        {
+                tag == SWF::DEFINEFONT3) {
             log_debug("Skipping glyph read, being fill and line bits zero. "
                     "SWF tag is %d.", tag);
             return;
@@ -346,30 +338,24 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
 #define SHAPE_LOG 0
     
     // SHAPERECORDS
-    for (;;)
-    {
+    for (;;) {
         in.ensureBits(1);
         bool isEdgeRecord = in.read_bit();
-        if (!isEdgeRecord)
-        {
+        if (!isEdgeRecord) {
             // Parse the record.
             in.ensureBits(5);
             int flags = in.read_uint(5);
-            if (flags == SHAPE_END)
-            {  
+            if (flags == SHAPE_END) {  
                 // Store the current path if any.
-                if (! current_path.empty())
-                {
+                if (! current_path.empty()) {
                     _paths.push_back(current_path);
                     current_path.m_edges.resize(0);
                 }
                 break;
             }
-            if (flags & SHAPE_MOVE)
-            {  
+            if (flags & SHAPE_MOVE) {  
                 // Store the current path if any, and prepare a fresh one.
-                if (! current_path.empty())
-                {
+                if (! current_path.empty()) {
                     _paths.push_back(current_path);
                     current_path.m_edges.resize(0);
                 }
@@ -392,11 +378,9 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 );
 #endif
             }
-            if ((flags & SHAPE_FILLSTYLE0_CHANGE) && num_fill_bits > 0)
-            {
+            if ((flags & SHAPE_FILLSTYLE0_CHANGE) && num_fill_bits > 0) {
                 // FillStyle_0_change = 1;
-                if (! current_path.empty())
-                {
+                if (! current_path.empty()) {
                     _paths.push_back(current_path);
                     current_path.m_edges.resize(0);
                     current_path.ap.x = x;
@@ -404,15 +388,12 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 }
                 in.ensureBits(num_fill_bits);
                 unsigned style = in.read_uint(num_fill_bits);
-                if (style > 0)
-                {
+                if (style > 0) {
                     style += fill_base;
                 }
     
-                if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2)
-                {
-                    if ( style > 1 )          // 0:hide 1:renderer
-                    {
+                if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2) {
+                    if ( style > 1 ) {         // 0:hide 1:renderer
                         IF_VERBOSE_MALFORMED_SWF(
                              log_swferror(_("Invalid fill style %d in "
                                      "fillStyle0Change record for font tag "
@@ -420,12 +401,9 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                         );
                         style = 0;
                     }
-                }
-                else
-                {
+                } else {
                     // 1-based index
-                    if ( style > _fillStyles.size() )
-                    {
+                    if ( style > _fillStyles.size() ) {
                         IF_VERBOSE_MALFORMED_SWF(
                              log_swferror(_("Invalid fill style %d in "
                                      "fillStyle0Change record - %d defined. "
@@ -443,11 +421,9 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 );
 #endif
             }
-            if ((flags & SHAPE_FILLSTYLE1_CHANGE) && num_fill_bits > 0)
-            {
+            if ((flags & SHAPE_FILLSTYLE1_CHANGE) && num_fill_bits > 0) {
                 // FillStyle_1_change = 1;
-                if (! current_path.empty())
-                {
+                if (! current_path.empty()) {
                     _paths.push_back(current_path);
                     current_path.m_edges.resize(0);
                     current_path.ap.x = x;
@@ -455,15 +431,12 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 }
                 in.ensureBits(num_fill_bits);
                 unsigned style = in.read_uint(num_fill_bits);
-                if (style > 0)
-                {
+                if (style > 0) {
                     style += fill_base;
                 }
     
-                if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2)
-                {
-                    if ( style > 1 )          // 0:hide 1:renderer
-                    {
+                if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2) {
+                    if ( style > 1 ) {          // 0:hide 1:renderer
                         IF_VERBOSE_MALFORMED_SWF(
                              log_swferror(_("Invalid fill style %d in "
                                      "fillStyle1Change record for font tag "
@@ -471,12 +444,9 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                         );
                         style = 0;
                     }
-                }
-                else
-                {
+                } else {
                     // 1-based index
-                    if ( style > _fillStyles.size() )
-                    {
+                    if ( style > _fillStyles.size() ) {
                         IF_VERBOSE_MALFORMED_SWF(
                             log_swferror(_("Invalid fill style %d in "
                                     "fillStyle1Change record - %d defined. "
@@ -493,11 +463,9 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 );
 #endif
             }
-            if ((flags & SHAPE_LINESTYLE_CHANGE) && num_line_bits > 0)
-            {
+            if ((flags & SHAPE_LINESTYLE_CHANGE) && num_line_bits > 0) {
                 // line_style_change = 1;
-                if (! current_path.empty())
-                {
+                if (! current_path.empty()) {
                     _paths.push_back(current_path);
                     current_path.m_edges.resize(0);
                     current_path.ap.x = x;
@@ -505,14 +473,11 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 }
                 in.ensureBits(num_line_bits);
                 unsigned style = in.read_uint(num_line_bits);
-                if (style > 0)
-                {
+                if (style > 0) {
                     style += line_base;
                 }
-                if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2)
-                {
-                    if ( style > 1 )          // 0:hide 1:renderer
-                    {
+                if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2) {
+                    if ( style > 1 ) {         // 0:hide 1:renderer
                         IF_VERBOSE_MALFORMED_SWF(
                             log_swferror(_("Invalid line style %d in "
                                     "lineStyleChange record for font tag "
@@ -520,8 +485,7 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                         );
                         style = 0;
                     }
-                }
-                else {
+                } else {
                     // 1-based index
                     if (style > _lineStyles.size()) {
                         IF_VERBOSE_MALFORMED_SWF(
@@ -540,10 +504,8 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 )
 #endif
             }
-            if (flags & SHAPE_HAS_NEW_STYLES)
-            {
-                if (!styleInfo)
-                {
+            if (flags & SHAPE_HAS_NEW_STYLES) {
+                if (!styleInfo) {
                     IF_VERBOSE_MALFORMED_SWF(
                          log_swferror("Unexpected HasNewStyle flag in tag "
                              "%d shape record", tag);
@@ -555,8 +517,7 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 );
     
                 // Store the current path if any.
-                if (! current_path.empty())
-                {
+                if (! current_path.empty()) {
                     _paths.push_back(current_path);
                     current_path.clear();
                 }
@@ -576,14 +537,11 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 num_fill_bits = in.read_uint(4);
                 num_line_bits = in.read_uint(4);
             }
-        }
-        else
-        {
+        } else {
             // EDGERECORD
             in.ensureBits(1);
             bool edge_flag = in.read_bit();
-            if (edge_flag == 0)
-            {
+            if (edge_flag == 0) {
                 in.ensureBits(4);
                 int num_bits = 2 + in.read_uint(4);
                 // curved edge
@@ -602,9 +560,7 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                 current_path.m_edges.push_back(Edge(cx, cy, ax, ay));
                 x = ax;
                 y = ay;
-            }
-            else
-            {
+            } else {
                 // straight edge
                 in.ensureBits(5);
                 int num_bits = 2 + in.read_uint(4);
@@ -616,19 +572,14 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                     in.ensureBits(2 * num_bits);
                     dx = in.read_sint(num_bits);
                     dy = in.read_sint(num_bits);
-                }
-                else
-                {
+                } else {
                     in.ensureBits(1);
                     bool vert_flag = in.read_bit();
-                    if (vert_flag == 0)
-                    {
+                    if (vert_flag == 0) {
                         // Horizontal line.
                         in.ensureBits(num_bits);
                         dx = in.read_sint(num_bits);
-                    }
-                    else
-                    {
+                    } else {
                         // Vertical line.
                         in.ensureBits(num_bits);
                         dy = in.read_sint(num_bits);
@@ -649,16 +600,14 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
         }
     }
     
-    if (!styleInfo)
-    {
+    if (!styleInfo) {
         // TODO: performance would be improved by computing
         //       the bounds as edges are parsed.
         computeBounds(_bounds, _paths, _lineStyles, m.get_version());
     }
 
 #ifdef GNASH_DEBUG_SHAPE_BOUNDS
-    else
-    {
+    else {
         SWFRect computedBounds;
         computeBounds(computedBounds, _paths, _lineStyles, m.get_version());
         if ( computedBounds != _bounds )
@@ -680,10 +629,8 @@ readFillStyles(ShapeRecord::FillStyles& styles, SWFStream& 
in,
 {
     in.ensureBytes(1);
     boost::uint16_t FillStyle_count = in.read_u8();
-    if (tag != SWF::DEFINESHAPE)
-    {
-        if (FillStyle_count == 0xFF)
-        {
+    if (tag != SWF::DEFINESHAPE) {
+        if (FillStyle_count == 0xFF) {
             in.ensureBytes(2);
             FillStyle_count = in.read_u16();
         }
@@ -714,8 +661,7 @@ readLineStyles(ShapeRecord::LineStyles& styles, SWFStream& 
in,
         log_parse(_("  readLineStyles: count = %d"), line_style_count);
     );
 
-    if (line_style_count == 0xFF)
-    {
+    if (line_style_count == 0xFF) {
         in.ensureBytes(2);
         line_style_count = in.read_u16();
         IF_VERBOSE_PARSE(
@@ -724,8 +670,7 @@ readLineStyles(ShapeRecord::LineStyles& styles, SWFStream& 
in,
     }
 
     // Read the styles.
-    for (int i = 0; i < line_style_count; i++)
-    {
+    for (int i = 0; i < line_style_count; i++) {
         styles.resize(styles.size() + 1);
         styles.back().read(in, tag, md, r);
     }
@@ -738,13 +683,11 @@ computeBounds(SWFRect& bounds, const ShapeRecord::Paths& 
paths,
 {
     bounds.set_null();
 
-    for (unsigned int i = 0; i < paths.size(); i++)
-    {
+    for (unsigned int i = 0; i < paths.size(); i++) {
         const Path& p = paths[i];
 
         unsigned thickness = 0;
-        if ( p.m_line )
-        {
+        if ( p.m_line ) {
             // For glyph shapes m_line is allowed to be 1
             // while no defined line styles are allowed.
             if (lineStyles.empty()) {

-----------------------------------------------------------------------

Summary of changes:
 gui/fb/fb.cpp                       |   29 ++++---
 gui/fb/fb_glue_agg.cpp              |   18 ++--
 gui/gui.cpp                         |    6 +-
 libcore/swf/ShapeRecord.cpp         |  157 +++++++++++------------------------
 librender/openvg/OpenVGBitmap.cpp   |   27 ++++--
 librender/openvg/OpenVGBitmap.h     |    4 +
 librender/openvg/OpenVGRenderer.cpp |  116 +++++++++++++------------
 librender/openvg/OpenVGRenderer.h   |   46 +++++------
 8 files changed, 181 insertions(+), 222 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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