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. eed5de3f66136b563805


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, openvg, updated. eed5de3f66136b5638054c3d64381c1cebf74f24
Date: Tue, 25 Jan 2011 17:58:52 +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  eed5de3f66136b5638054c3d64381c1cebf74f24 (commit)
       via  b1a4f59f773eff02f97052a8ea4c3fc5d3186c2e (commit)
      from  144f9fcef1cd8a9265d3ce2eefdca35a3fbd5dd6 (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=eed5de3f66136b5638054c3d64381c1cebf74f24


commit eed5de3f66136b5638054c3d64381c1cebf74f24
Author: Rob Savoye <address@hidden>
Date:   Tue Jan 25 10:58:37 2011 -0700

    implement working linear gradients via OpenVG hardware acceleration.

diff --git a/librender/openvg/OpenVGBitmap.cpp 
b/librender/openvg/OpenVGBitmap.cpp
index 158e03f..a6f25ef 100644
--- a/librender/openvg/OpenVGBitmap.cpp
+++ b/librender/openvg/OpenVGBitmap.cpp
@@ -46,7 +46,7 @@ OpenVGBitmap::OpenVGBitmap(VGPaint paint)
 }
 
 OpenVGBitmap::OpenVGBitmap(CachedBitmap *bitmap, VGPaint vgpaint)
-    : 
+    : _vgimage(VG_INVALID_HANDLE),
 #ifdef BUILD_X11_DEVICE
       _pixel_format(VG_sARGB_8888),
       _stride(4),
@@ -67,13 +67,16 @@ OpenVGBitmap::OpenVGBitmap(CachedBitmap *bitmap, VGPaint 
vgpaint)
     // Create a VG image
     _vgimage = vgCreateImage(_pixel_format, im.width(), im.height(),
                              VG_IMAGE_QUALITY_FASTER);    
+    if (_vgimage == VG_INVALID_HANDLE) {
+        log_error("Failed to create VG image! %s", 
Renderer_ovg::getErrorString(vgGetError()));
+    }
+    
     // Copy the image data into the VG image container
     vgImageSubData(_vgimage, im.begin(), im.width() * _stride, _pixel_format,
                    0, 0, im.width(), im.height());
     
-    if (_vgimage == VG_INVALID_HANDLE) {
-        log_error("Failed to create VG image! %s", 
Renderer_ovg::getErrorString(vgGetError()));
-    }
+    vgSetParameteri (_vgpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
+    vgPaintPattern (_vgpaint, _vgimage);
 }
 
 // 
@@ -84,12 +87,13 @@ OpenVGBitmap::OpenVGBitmap(CachedBitmap *bitmap, VGPaint 
vgpaint)
 // VG_A_4
 OpenVGBitmap::OpenVGBitmap(image::GnashImage *image, VGPaint vgpaint)
     : _image(image),
+      _vgimage(VG_INVALID_HANDLE),
 #ifdef BUILD_X11_DEVICE
-    _pixel_format(VG_sARGB_8888),
-    _stride(4),
+      _pixel_format(VG_sARGB_8888),
+      _stride(4),
 #else
-    _pixel_format(VG_sRGB_565),
-    _stride(2),
+      _pixel_format(VG_sRGB_565),
+      _stride(2),
 #endif
     _vgpaint(vgpaint)
 {
@@ -144,7 +148,10 @@ OpenVGBitmap::image()
     }
 }    
 
-// 
+// This applies the cached VGimage or VGpath to the current paint object.
+// a VGimage is used for a bitmap, for example a jpeg. VGpath is used
+// instead of a VGimage when handling gradients, as a VGPath has hardware
+// support for gradients.
 void
 OpenVGBitmap::apply(const gnash::SWFMatrix& bitmap_matrix,
                     bitmap_wrap_mode wrap_mode, VGPaint paint) const
@@ -153,19 +160,19 @@ OpenVGBitmap::apply(const gnash::SWFMatrix& bitmap_matrix,
     
     gnash::SWFMatrix mat;
     VGfloat     vmat[9];
+
+//    Renderer_ovg::printVGMatrix(bitmap_matrix);
     
-    mat = bitmap_matrix;
+    // if (_vgimage == VG_INVALID_HANDLE) {
+    //     log_error("No cached VG image!");
+    // } else {
     
     vgSetParameteri (paint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
-
-    if (_vgimage == VG_INVALID_HANDLE) {
-        log_error("No cached VG image!");
-    }
-    
     // Paint the cached VG image into the VG paint surface
-    vgPaintPattern (paint, _vgimage);
-
+    mat = bitmap_matrix;
     mat.invert();
+    Renderer_ovg::printVGMatrix(mat);
+    
     memset(vmat, 0, sizeof(vmat));
     vmat[0] = mat.sx  / 65536.0f;
     vmat[1] = mat.shx / 65536.0f;
@@ -174,26 +181,40 @@ OpenVGBitmap::apply(const gnash::SWFMatrix& bitmap_matrix,
     vmat[6] = mat.tx;
     vmat[7] = mat.ty;
     
+    Renderer_ovg::printVGMatrix(vmat);
+    
     vgSeti (VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
     vgLoadMatrix (vmat);
     vgSeti (VG_MATRIX_MODE, VG_MATRIX_STROKE_PAINT_TO_USER);
     vgLoadMatrix (vmat);
     vgSeti (VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
-
-#if 0
-    if (wrap_mode == WRAP_CLAMP) {  
-        vgSetParameteri (paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_PAD);
-    } else {
-        vgSetParameteri (paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_REPEAT);
+    
+    switch (wrap_mode) {
+      case WRAP_FILL:
+          vgSetParameteri (paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_FILL);
+          break;
+      case WRAP_PAD:
+          vgSetParameteri (paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_PAD);
+          break;
+      case WRAP_REPEAT:
+          vgSetParameteri (paint, VG_PAINT_PATTERN_TILING_MODE, 
VG_TILE_REPEAT);
+          break;
+      case WRAP_REFLECT:
+          vgSetParameteri (paint, VG_PAINT_PATTERN_TILING_MODE, 
VG_TILE_REFLECT);
+          break;
+      default:
+          log_error("No supported wrap mode specified!");
+          break;
     }
-#else
-    vgSetParameteri (paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_FILL);
-#endif
 }
 
 /// OpenVG supports creating linear and gradient fills in hardware, so
 /// we want to use that instead of the existing way of calculating the
 /// gradient in software.
+
+// A Radial Gradient Bitmap uses two points and a radius in the paint
+// coordinate system. The gradient starts at x0,y0 as the center, and
+// x1,y1 is the focal point that is forced to be in the circle.
 OpenVGBitmap *
 OpenVGBitmap::createRadialBitmap(float cx, float cy, float fx, float fy, float 
radial,
                                  VGPaint paint)
@@ -213,22 +234,41 @@ OpenVGBitmap::createRadialBitmap(float cx, float cy, 
float fx, float fy, float r
     return this;
 }
 
+// A Linear Gradient Bitmap uses two points, x0,y0 and x1,y1 in the paint
+// coordinate system. The gradient starts at x0,y0 and goes to x1,y1. If
+// x1 and y1 are outside the boundaries of the shape, then the gradient gets
+// clipped at the boundary instead of x1,y1.
 OpenVGBitmap *
-OpenVGBitmap::createLinearBitmap(float x0, float y0, float x1, float y1, 
VGPaint paint)
+OpenVGBitmap::createLinearBitmap(float x0, float y0, float x1, float y1,
+                                 const rgba &incolor, const VGPaint paint)
 {
-    GNASH_REPORT_FUNCTION;
+    // GNASH_REPORT_FUNCTION;
+    VGfloat color[] = {
+        incolor.m_r / 255.0f,
+        incolor.m_g / 255.0f,
+        incolor.m_b / 255.0f,
+        incolor.m_a / 255.0f
+    };
+    vgSetParameteri (paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
+    vgSetParameterfv (paint, VG_PAINT_COLOR, 4, color);
 
-    VGfloat lgParams[] = { x0, y0, x1, y1 };
-    VGfloat stops[] = { 0.0, 0.33, 0.66, 1.0};
-    
-    // Paint Type
     vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
-    // Gradient Parameters
-    vgSetParameterfv(paint, VG_PAINT_LINEAR_GRADIENT, 4, lgParams);
-    // Color Ramp
-    vgSetParameterfv(paint, VG_PAINT_COLOR_RAMP_STOPS, 5*NUM_STOPS, stops);
     vgSetParameteri(paint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, 
VG_COLOR_RAMP_SPREAD_PAD);
 
+    VGfloat linearGradient[4] = { x0, y0, x1, y1 };
+    vgSetParameterfv(paint, VG_PAINT_LINEAR_GRADIENT, 4, linearGradient);
+
+#if 1
+    VGfloat stops[] = { 0.0, 0.33, 0.66, 1.0};
+    vgSetParameterfv(paint, VG_PAINT_COLOR_RAMP_STOPS, 4, stops);
+#else
+    VGfloat rampStop[] = {0.00f, 1.0f, 1.0f, 1.0f, 1.0f,
+                          0.33f, 1.0f, 0.0f, 0.0f, 1.0f,
+                          0.66f, 0.0f, 1.0f, 0.0f, 1.0f,
+                          1.00f, 0.0f, 0.0f,  1.0f, 1.0f};
+    vgSetParameterfv(paint, VG_PAINT_COLOR_RAMP_STOPS, 20, rampStop);    
+#endif
+    
     return this;
 }
 
diff --git a/librender/openvg/OpenVGBitmap.h b/librender/openvg/OpenVGBitmap.h
index 6b3c431..803a9aa 100644
--- a/librender/openvg/OpenVGBitmap.h
+++ b/librender/openvg/OpenVGBitmap.h
@@ -36,7 +36,7 @@ class OpenVGBitmap : public CachedBitmap
 {
 public:
     /// Set line and fill styles for mesh & line_strip rendering.
-    enum bitmap_wrap_mode { WRAP_REPEAT, WRAP_CLAMP };
+    enum bitmap_wrap_mode { WRAP_REPEAT, WRAP_FILL, WRAP_PAD, WRAP_REFLECT };
     
     OpenVGBitmap(VGPaint paint);
     OpenVGBitmap(CachedBitmap *bitmap, VGPaint vgpaint);
@@ -61,8 +61,10 @@ public:
     /// gradient in software.
     OpenVGBitmap *createRadialBitmap(float x0, float y0, float x1,
                                      float y1, float radial, VGPaint paint);
-    OpenVGBitmap *createLinearBitmap(float x0, float y0, float x1,
-                                     float y1, VGPaint paint);
+    OpenVGBitmap *createLinearBitmap(float x0, float y0, float x1, float y1,
+                                     const rgba &incolor, const VGPaint paint);
+
+    // This is for images
     OpenVGBitmap *createPatternBitmap(image::GnashImage &im,
                                       VGPaint paint);
     OpenVGBitmap *createPatternBitmap();
@@ -70,10 +72,10 @@ public:
 private:
     boost::scoped_ptr<image::GnashImage> _image;
     VGImageFormat   _pixel_format;
-    mutable VGImage _vgimage;
-    VGPaint         _vgpaint;
+    VGImage         _vgimage;
     int             _stride;
-    int             _tex_size;
+    VGPaint         _vgpaint;
+//    int             _tex_size;
 };
 
 } // namespace gnash::renderer::openvg
diff --git a/librender/openvg/OpenVGRenderer.cpp 
b/librender/openvg/OpenVGRenderer.cpp
index b220aa9..d0ffb28 100644
--- a/librender/openvg/OpenVGRenderer.cpp
+++ b/librender/openvg/OpenVGRenderer.cpp
@@ -87,8 +87,10 @@ class eglScopeMatrix : public boost::noncopyable
 public:
     eglScopeMatrix(const SWFMatrix& m)
         {
-            vgGetMatrix(orig_mat);
-
+            // GNASH_REPORT_FUNCTION;            
+            vgGetMatrix(_orig_mat);
+            //Renderer_ovg::printVGMatrix(_orig_mat);
+            
             float mat[9];
             memset(mat, 0, sizeof(mat));
             mat[0] = m.sx  / 65536.0f;
@@ -102,26 +104,40 @@ public:
   
     ~eglScopeMatrix()
         {
-            vgLoadMatrix(orig_mat);
+            vgLoadMatrix(_orig_mat);
         }
 private:
-    VGfloat orig_mat[9];
+    VGfloat _orig_mat[9];
 };
 
+/// @note
+/// A VGpath is constructed from a series of appended path
+/// segments. When drawing shapes from flash, we start each path by
+/// moving to a known location. Then segments are appended, and then
+/// the path is closed. This is also used for fills.
+
 #define MAX_SEG  (256)
 
+/// Start a VGPath by moving to a specified location
+///
+/// @param path The VGPath to start
+/// @returns nothing
 inline void
 startpath(VGPath path, const int x, const int y)
 {
     VGubyte     gseg[1];
     VGfloat     gdata[2];
-  
+
     gseg[0] = VG_MOVE_TO;
     gdata[0] = x;
     gdata[1] = y;
     vgAppendPathData (path, 1, gseg, gdata);
 }
 
+/// Close the VGPath started by startpath()
+///
+/// @param path The VGPath to close
+/// @returns nothing
 inline void
 closepath(VGPath path)
 {
@@ -132,6 +148,13 @@ closepath(VGPath path)
     vgAppendPathData (path, 1, gseg, gdata);
 }
 
+/// Add a series of edges to the existing path created by startpath()
+///
+/// @param path The VGPath to append segments to
+/// @param edges The segments to append to the path
+/// @param anchor_x The X coordinate to start from
+/// @param anchor_y The Y coordinate to start from
+/// @returns nothing
 inline void
 preparepath(VGPath path, const std::vector<Edge>& edges,
                         const float& anchor_x, const float& anchor_y)
@@ -366,16 +389,10 @@ void
 Renderer_ovg::begin_display(gnash::rgba const&, int width, int height,
                             float x0, float x1, float y0, float y1)
 {
-    // GNASH_REPORT_FUNCTION;
-
-    // std::cerr << "FIXME2: " << width / VGfloat(x1 - 1600) << " : "
-    //           << -((VGfloat)height / VGfloat(y1 - 0)) << std::endl;
+    GNASH_REPORT_FUNCTION;
 
     vgSeti (VG_MASKING, VG_FALSE);
 
-    // std::cerr << "FIXME1: " << width << ", " << height << ", " << x0 << ", 
" << x1
-    //           << ", " << y0 << ", " << y1 << std::endl;
-    
     VGfloat mat[9];
     memset(mat, 0, sizeof(mat));
     // sx and sy define scaling in the x and y directions, respectively;
@@ -796,7 +813,12 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
 {
     // GNASH_REPORT_FUNCTION;
 
+    // Renderer_ovg::printVGMatrix(mat);
+    
     SWF::FillType fill_type = boost::apply_visitor(GetType(), style.fill);
+    SWFMatrix sm = boost::apply_visitor(GetMatrix(), style.fill);
+    rgba incolor = boost::apply_visitor(GetColor(), style.fill);
+    
     switch (fill_type) {
         
       case SWF::FILL_LINEAR_GRADIENT:
@@ -804,14 +826,15 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
       case SWF::FILL_FOCAL_GRADIENT:
       {
           OpenVGBitmap* binfo = new OpenVGBitmap(_fillpaint);
+          // Renderer_ovg::printVGMatrix(sm);
           
-          GradientFill::Type gt;
+          eglScopeMatrix scope_mat(mat);
+          rgba c = cx.transform(incolor);
           switch (fill_type) {
           case SWF::FILL_LINEAR_GRADIENT:
           {
-              log_debug("Fill Style Type: Linear Gradient");
-              binfo->createLinearBitmap(mat.sx, mat.sy, mat.tx, mat.ty,
-                                        _fillpaint);
+              log_debug("FIXME: Fill Style Type: Linear Gradient");
+              // binfo->createLinearBitmap(sm, c, _fillpaint);
               break;
           }
           case SWF::FILL_RADIAL_GRADIENT:
@@ -825,8 +848,7 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
           default:
               std::abort();
           }
-          SWFMatrix sm = boost::apply_visitor(GetMatrix(), style.fill);        
  
-          binfo->apply(sm, OpenVGBitmap::WRAP_CLAMP, _fillpaint);
+          // binfo->apply(sm, OpenVGBitmap::WRAP_PAD, _fillpaint);
           vgSetParameteri (_fillpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
           break;
       }
@@ -834,11 +856,11 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
       case SWF::FILL_TILED_BITMAP:
       {
           log_debug("Fill Style Type: Tiled Bitmap");
-          SWFMatrix sm = boost::apply_visitor(GetMatrix(), style.fill);        
  
           CachedBitmap *cb = boost::apply_visitor(GetBitmap(), style.fill);
           //          std::auto_ptr<image::GnashImage> im(&cb->image());
           OpenVGBitmap *binfo = new OpenVGBitmap(cb, _fillpaint);
           binfo->apply(sm, OpenVGBitmap::WRAP_REPEAT, _fillpaint);
+          vgSetParameteri (_fillpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
           break;
       }
       
@@ -846,8 +868,6 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
       case SWF::FILL_CLIPPED_BITMAP_HARD:
       {     
           log_debug("Fill Style Type: Clipped Bitmap");
-          SWFMatrix sm = boost::apply_visitor(GetMatrix(), style.fill);
-
           CachedBitmap *cb = boost::apply_visitor(GetBitmap(), style.fill);
           OpenVGBitmap *binfo = new OpenVGBitmap(cb, _fillpaint);
 #if 0
@@ -855,7 +875,8 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
           image::GnashImage *im = boost::apply_visitor(GetImage(), style.fill);
           OpenVGBitmap *binfo = new OpenVGBitmap(im, _fillpaint);
 #endif
-          binfo->apply(sm, OpenVGBitmap::WRAP_CLAMP, _fillpaint);
+          binfo->apply(sm, OpenVGBitmap::WRAP_PAD, _fillpaint);
+          vgSetParameteri (_fillpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
           break;
       } 
       case SWF::FILL_SOLID:
@@ -1132,10 +1153,14 @@ Renderer_ovg::draw_subshape(const PathVec& path_vec,
             continue;
         }
         
+        SWF::FillType fill_type = boost::apply_visitor(GetType(), 
fill_styles[i].fill);
+        if ((fill_type != SWF::FILL_LINEAR_GRADIENT)
+            && (fill_type != SWF::FILL_RADIAL_GRADIENT)) {
+            apply_fill_style(fill_styles[i], mat, cx);
+        }
+
         std::list<PathPtrVec> contours = get_contours(paths);
         
-        apply_fill_style(fill_styles[i], mat, cx);
-        
         VGPath      vg_path;
         vg_path = vgCreatePath (VG_PATH_FORMAT_STANDARD,
                                 VG_PATH_DATATYPE_F,
@@ -1148,7 +1173,17 @@ Renderer_ovg::draw_subshape(const PathVec& path_vec,
             const PathPtrVec& refs = *iter;
             
             startpath(vg_path, (*(refs[0])).ap.x, (*(refs[0])).ap.y);
-            
+            if (fill_type == SWF::FILL_LINEAR_GRADIENT) {
+                rgba incolor = boost::apply_visitor(GetColor(), 
fill_styles[i].fill);
+                OpenVGBitmap* binfo = new OpenVGBitmap(_fillpaint);
+                // All positions are specified in twips, which are 20 to the
+                // pixel. Use th 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->createLinearBitmap((*(refs[0])).ap.x, (*(refs[0])).ap.y,
+                                          _display_width * 20.0f, 
_display_height * 20.0f,
+                                          incolor, _fillpaint);
+            }
             for (PathPtrVec::const_iterator it = refs.begin(), end = 
refs.end();
                  it != end; ++it) {
                 const Path& cur_path = *(*it);
@@ -1160,7 +1195,7 @@ Renderer_ovg::draw_subshape(const PathVec& path_vec,
             closepath(vg_path);
         }
         vgDrawPath (vg_path, VG_FILL_PATH);
-        vgDestroyPath(vg_path);    
+        vgDestroyPath(vg_path);
     }
     
     draw_outlines(normalized, mat, cx, line_styles);
@@ -1572,8 +1607,39 @@ Renderer_ovg::printVGParams()
     log_debug("VG_MAX_IMAGE_HEIGHT is %d", vgGeti(VG_MAX_IMAGE_HEIGHT));
     log_debug("VG_MAX_IMAGE_PIXELS is %d", vgGeti(VG_MAX_IMAGE_PIXELS));
     log_debug("VG_MAX_IMAGE_BYTES is %d", vgGeti(VG_MAX_IMAGE_BYTES));
+
 }
-  
+
+void
+Renderer_ovg::printVGPath(VGPath path)
+{
+    log_debug("VG_PATH_FORMAT is %d", vgGetParameteri(path, VG_PATH_FORMAT));
+    log_debug("VG_PATH_DATATYPE is %d", vgGetParameteri(path, 
VG_PATH_DATATYPE));
+    log_debug("VG_PATH_CAPABILITY_APPEND_TO is %d", vgGetParameteri(path, 
VG_PATH_CAPABILITY_APPEND_TO));
+    log_debug("VG_PATH_SCALE is %g", vgGetParameteri(path, VG_PATH_SCALE));
+    log_debug("VG_PATH_BIA is %g", vgGetParameteri(path, VG_PATH_BIAS));
+
+    log_debug("VG_PATH_NUM_SEGMENTS is %d", vgGetParameteri(path, 
VG_PATH_NUM_SEGMENTS));
+    log_debug("VG_PATH_NUM_COORDS is %d", vgGetParameteri(path, 
VG_PATH_NUM_COORDS));
+}
+
+// Print an OpenVG matric, which is 3 x 3. Elements 2 and 5 are
+// ignored, as they are the w0 and w1 paramaters.
+// It looks like this: { sx, shy, w0, shx, sy, w1, tx, ty, w2 }
+void
+Renderer_ovg::printVGMatrix(VGfloat *mat)
+{
+    std::cerr << "sx, shx, tx: " << mat[0] << ", " << mat[1]<< ", "  << mat[3] 
<< std::endl;
+    std::cerr << "sy, shy, ty: " << mat[4]<< ", " << mat[6] << ", "<< mat[7] 
<< std::endl;
+}
+
+void
+Renderer_ovg::printVGMatrix(const SWFMatrix &mat)
+{
+    std::cerr << "sx, shx, tx: " << mat.sx << ", " << mat.shx << ", " << 
mat.tx << std::endl;
+    std::cerr << "sy, shy, ty: " << mat.sy << ", " << mat.shy << ", " << 
mat.ty << std::endl;
+}
+
 Renderer *
 Renderer_ovg::startInternalRender(gnash::image::GnashImage&)
 {
diff --git a/librender/openvg/OpenVGRenderer.h 
b/librender/openvg/OpenVGRenderer.h
index f12a6b2..d1b91a4 100644
--- a/librender/openvg/OpenVGRenderer.h
+++ b/librender/openvg/OpenVGRenderer.h
@@ -120,7 +120,9 @@ public:
     // These methods are only for debugging and development
     void printVGParams();
     void printVGHardware();
-    void printVGPath();    
+    static void printVGPath(VGPath path);
+    static void printVGMatrix(VGfloat *mat);
+    static void printVGMatrix(const SWFMatrix &mat);
 
     static const char *getErrorString(VGErrorCode error);
 #if 0

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


commit b1a4f59f773eff02f97052a8ea4c3fc5d3186c2e
Author: Rob Savoye <address@hidden>
Date:   Tue Jan 25 10:57:32 2011 -0700

    simple test case for gradients, not designed for automated testing.

diff --git a/librender/linear.as b/librender/linear.as
new file mode 100644
index 0000000..c95d345
--- /dev/null
+++ b/librender/linear.as
@@ -0,0 +1,44 @@
+
+// _root.lineStyle(1, 0x000000, 100);
+// _root.moveTo(200, 100);
+// _root.lineTo(350, 100);
+// _root.lineTo(350, 200);
+// _root.lineTo(200, 200);
+// _root.lineTo(200, 100);
+
+
+fillType = "linear";
+colors = [0xFF0000, 0x0000FF];
+alphas = [100, 100];
+ratios = [0, 255];
+
+// This appears to be a "box" within the gradient, that effects how
+// wide the color stripes are.
+matrix = {matrixType:"box", x:150, y:200, w:500, h:200, r:0/180*Math.PI};
+_root.lineStyle(1, 0x000000, 100);
+
+_root.beginGradientFill(fillType, colors, alphas, ratios, matrix);
+//             X (200)                  W (150)
+//             |                        |
+// (x0, y0) 200,200------------------500,200 (x1, y0)
+//             |                        |
+//             |                        |---- Y (300)
+//             |                        |
+// (x0, y1) 200,400------------------500,400 (x1, y1)_
+//
+
+// This is the dimensions of the big black box that is supposed to have
+// a linear gradient in it.
+x0 = 200; // 200 pixels = 4000 twips
+y0 = 200; // 200 pixels = 4000 twips -77, was -102 at 150
+x1 = 500; // 500 pixels = 10000 twips
+y1 = 400; // 400 pixels = 8000 twips
+_root.moveTo(x0, y0);
+_root.lineTo(x1, y0);
+_root.lineTo(x1, y1);
+_root.lineTo(x0, y1);
+_root.lineTo(x0, y0);
+
+_root.endFill();
+
+ 

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

Summary of changes:
 librender/linear.as                 |   44 +++++++++++++
 librender/openvg/OpenVGBitmap.cpp   |  112 ++++++++++++++++++++++-----------
 librender/openvg/OpenVGBitmap.h     |   14 +++--
 librender/openvg/OpenVGRenderer.cpp |  120 +++++++++++++++++++++++++++--------
 librender/openvg/OpenVGRenderer.h   |    4 +-
 5 files changed, 224 insertions(+), 70 deletions(-)
 create mode 100644 librender/linear.as


hooks/post-receive
-- 
Gnash



reply via email to

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