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. 17a0b5ea7b995d5245c0


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, openvg, updated. 17a0b5ea7b995d5245c078a8589c8a429274340f
Date: Sat, 25 Dec 2010 21:13:16 +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  17a0b5ea7b995d5245c078a8589c8a429274340f (commit)
       via  37570697f54664a327af114b93727bb100daf477 (commit)
      from  0d3ae63ffc1fbb02cbec7cb4546009cebc019f29 (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=17a0b5ea7b995d5245c078a8589c8a429274340f


commit 17a0b5ea7b995d5245c078a8589c8a429274340f
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 25 14:12:41 2010 -0700

    use current drawShape() API, not the old API.

diff --git a/librender/openvg/Renderer_ovg.cpp 
b/librender/openvg/Renderer_ovg.cpp
index 0ab298c..465e702 100644
--- a/librender/openvg/Renderer_ovg.cpp
+++ b/librender/openvg/Renderer_ovg.cpp
@@ -35,6 +35,7 @@
 #include "GnashImage.h"
 #include "GnashNumeric.h"
 #include "FillStyle.h"
+#include "Transform.h"
 #include "log.h"
 #include "utility.h"
 #include "Range2d.h"
@@ -165,21 +166,26 @@ preparepath(VGPath path, const std::vector<Edge>& edges,
 
 // Use the image class copy constructor; it's not important any more
 // what kind of image it is.
-bitmap_info_ovg::bitmap_info_ovg(gnash::image::GnashImage* img,
-                                        VGImageFormat pixelformat, VGPaint 
paint) 
-    :
-    _img(img),
+bitmap_info_ovg::bitmap_info_ovg(std::auto_ptr<gnash::image::GnashImage> img,
+                                 VGImageFormat pixelformat, VGPaint paint)
+:
+    _img(img.release()),
     _pixel_format(pixelformat),
-    _paint(paint)
+    _paint(paint),
+    _orig_width(_img->width()),
+    _orig_height(_img->height())
 {
+    GNASH_REPORT_FUNCTION;
+
     _width = _img->width();
     _height = _img->height();
   
-    if (_pixel_format == VG_sARGB_8888)
+    if (_pixel_format == VG_sARGB_8888) {
         _image = vgCreateImage(VG_sARGB_8888, _width, _height, 
GNASH_IMAGE_QUALITY);    
     
-    // vgImageSubData(_image, _img->data(), _width * 4, VG_sARGB_8888,
-    //                0, 0, _width, _height); FIXME
+        vgImageSubData(_image, _img->begin(), _width * 4, VG_sARGB_8888,
+                       0, 0, _width, _height);
+    }
     
     tex_size += _width * _height * 4;
     log_debug("Add Texture size:%d (%d x %d x %dbpp)", _width * _height * 4, 
_width, _height, 4);
@@ -188,6 +194,7 @@ bitmap_info_ovg::bitmap_info_ovg(gnash::image::GnashImage* 
img,
     
 bitmap_info_ovg::~bitmap_info_ovg()
 {
+    GNASH_REPORT_FUNCTION;
     tex_size -= _width * _height * 4;
     log_debug(_("Remove Texture size:%d (%d x %d x %dbpp)"), _width * _height 
* 4, _width, _height, 4);
     log_debug(_("Current Texture size: %d"), tex_size);
@@ -199,6 +206,7 @@ void
 bitmap_info_ovg::apply(const gnash::SWFMatrix& bitmap_matrix,
                        bitmap_wrap_mode wrap_mode) const
 {
+    GNASH_REPORT_FUNCTION;
     gnash::SWFMatrix mat;
     VGfloat     vmat[9];
     
@@ -267,23 +275,7 @@ void
 Renderer_ovg::init(float x, float y)
 {
     GNASH_REPORT_FUNCTION;
-#if 0
-    static const VGubyte sqrCmds[5] = {VG_MOVE_TO_ABS, VG_HLINE_TO_ABS, 
VG_VLINE_TO_ABS, VG_HLINE_TO_ABS, VG_CLOSE_PATH};
-    static const VGfloat sqrCoords[5]   = {50.0f, 50.0f, 250.0f, 250.0f, 
50.0f};
-    path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1, 0, 0, 
0,
-                        VG_PATH_CAPABILITY_APPEND_TO);
-    vgAppendPathData(path, 5, sqrCmds, sqrCoords);
-    
-    fill = vgCreatePaint();
-    vgSetParameterfv(fill, VG_PAINT_COLOR, 4, color);
-    vgSetPaint(fill, VG_FILL_PATH);
-    
-    vgSetfv(VG_CLEAR_COLOR, 4, white_color);
-    vgSetf(VG_STROKE_LINE_WIDTH, 10);
-    vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
-    vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
-    vgSetf(VG_STROKE_MITER_LIMIT, 4.0f);
-#else
+
     _display_width = x;
     _display_height = y;
     
@@ -299,7 +291,7 @@ Renderer_ovg::init(float x, float y)
 #ifdef OPENVG_VERSION_1_1    
     m_mask = vgCreateMaskLayer(x, y);
 #endif
-#endif
+
     log_debug("VG Vendor is %s, VG Version is %s, VG Renderer is %s",
               vgGetString(VG_VENDOR), vgGetString(VG_VERSION),
               vgGetString(VG_RENDERER));
@@ -309,6 +301,8 @@ Renderer_ovg::init(float x, float y)
 
 Renderer_ovg::~Renderer_ovg()
 {
+    GNASH_REPORT_FUNCTION;
+
     vgDestroyPaint(m_fillpaint);
     vgDestroyPaint(m_strokepaint);
 #ifdef OPENVG_VERSION_1_1    
@@ -327,14 +321,18 @@ 
Renderer_ovg::createCachedBitmap(std::auto_ptr<image::GnashImage> im)
     // OpenVG don't support 24bit RGB, need translate colorspace
     switch (im->type()) {
       case image::TYPE_RGBA:   
-//          return new bitmap_info_ovg(im.get(), VG_sARGB_8888, m_fillpaint);
+          return new bitmap_info_ovg(im, VG_sARGB_8888, m_fillpaint);
           break;
       case image::TYPE_RGB:
-          break;
       default:
+          log_error("Can't create a cached bitmap! Unsuppored type: %d",
+                    im->type());
           std::abort();
     }
 
+   const CachedBitmap* bi = createCachedBitmap(
+                    static_cast<std::auto_ptr<image::GnashImage> >(im));
+
     return 0;
 }
 
@@ -406,7 +404,7 @@ Renderer_ovg::begin_display(const rgba& /* bg_color */, int 
/* viewport_x0 */,
                             int /* viewport_height */, float x0, float x1,
                             float y0, float y1)
 {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     vgSeti (VG_MASKING, VG_FALSE);
     
@@ -421,13 +419,12 @@ Renderer_ovg::begin_display(const rgba& /* bg_color */, 
int /* viewport_x0 */,
     
     vgSeti (VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
     vgLoadMatrix (mat);
-}
+ }
 
 void
 Renderer_ovg::end_display()
 {
-    GNASH_REPORT_FUNCTION;
-    
+//    GNASH_REPORT_FUNCTION;
 }
 
 /// Draw a line-strip directly, using a thin, solid line. 
@@ -628,20 +625,22 @@ Renderer_ovg::apply_mask()
 void
 Renderer_ovg::add_paths(const PathVec& path_vec)
 {
+    GNASH_REPORT_FUNCTION;
     SWFCxForm dummy_cx;
-#if 0
-  FIXME:
-    
-    FillStyle coloring
-        coloring.setSolid(rgba(0,255,0,255));
     
-    draw_submask(path_vec, SWFMatrix(), dummy_cx, coloring);
+#if 0                           // original
+    FillStyle coloring = SolidFill(rgba(0,255,0,255));
+#else
+    FillStyle coloring = FillStyle(SolidFill(rgba(0, 255, 0, 255)));
 #endif
+
+    draw_submask(path_vec, SWFMatrix(), dummy_cx, coloring);
 }
 
 void
 Renderer_ovg::disable_mask()
 {
+    GNASH_REPORT_FUNCTION;
     _masks.pop_back();
     
     if (_masks.empty()) {
@@ -727,6 +726,7 @@ Renderer_ovg::find_connecting_path(const Path& to_connect,
 PathVec
 Renderer_ovg::normalize_paths(const PathVec &paths)
 {
+    GNASH_REPORT_FUNCTION;
     PathVec normalized;
     
     for (PathVec::const_iterator it = paths.begin(), end = paths.end();
@@ -774,6 +774,7 @@ void
 Renderer_ovg::analyze_paths(const PathVec &paths, bool& have_shape,
                             bool& have_outline) 
 {
+    GNASH_REPORT_FUNCTION;
     have_shape=false;
     have_outline=false;
     
@@ -800,9 +801,11 @@ void
 Renderer_ovg::apply_fill_style(const FillStyle& style, const SWFMatrix& /* mat 
*/,
                                const SWFCxForm& cx)
 {
+    GNASH_REPORT_FUNCTION;
+
 #if 0
-    FIXME fill_style changed to FillStyle
-        int fill_type = style.get_type();
+    //    FIXME fill_style changed to FillStyle
+    SWF::FillType fill_type = SWF::FILL_SOLID; // style.get_type();
     
     switch (fill_type) {
         
@@ -810,13 +813,18 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& /* mat *
       case SWF::FILL_RADIAL_GRADIENT:
       case SWF::FILL_FOCAL_GRADIENT:
       {
+          gnash::GradientFill f();
           const bitmap_info_ovg* binfo = static_cast<const bitmap_info_ovg*>(
-              style.need_gradient_bitmap(*this));       
-          
+#if 0                           // original
+              style.need_gradient_bitmap(*this));   
+#else
+          createGradientBitmap(&f, *this));
+#endif
           binfo->apply(style.getGradientMatrix(), 
bitmap_info_ovg::WRAP_CLAMP); 
           vgSetParameteri (m_fillpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
           break;
-      }        
+      }
+#if 0
       case SWF::FILL_TILED_BITMAP_HARD:
       case SWF::FILL_TILED_BITMAP:
       {
@@ -838,7 +846,7 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& /* mat *
           vgSetParameteri (m_fillpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
           break;
       } 
-      
+#endif 
       case SWF::FILL_SOLID:
       {
           rgba c = cx.transform(style.get_color());
@@ -860,6 +868,7 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& /* mat *
 bool
 Renderer_ovg::apply_line_style(const LineStyle& style, const SWFCxForm& cx, 
const SWFMatrix& mat)
 {
+    GNASH_REPORT_FUNCTION;
     
     bool rv = true;
     
@@ -938,6 +947,7 @@ void
 Renderer_ovg::draw_outlines(const PathVec& path_vec, const SWFMatrix& mat,
                             const SWFCxForm& cx, const std::vector<LineStyle>& 
line_styles)
 {
+    GNASH_REPORT_FUNCTION;
     for (PathVec::const_iterator it = path_vec.begin(), end = path_vec.end();
          it != end; ++it) {
         
@@ -966,6 +976,7 @@ Renderer_ovg::draw_outlines(const PathVec& path_vec, const 
SWFMatrix& mat,
 std::list<PathPtrVec>
 Renderer_ovg::get_contours(const PathPtrVec &paths)
 {
+    GNASH_REPORT_FUNCTION;
     std::list<const Path*> path_refs;
     std::list<PathPtrVec> contours;
     
@@ -1013,6 +1024,7 @@ Renderer_ovg::get_contours(const PathPtrVec &paths)
 void
 Renderer_ovg::draw_mask(const PathVec& path_vec)
 { 
+    GNASH_REPORT_FUNCTION;
    
     for (PathVec::const_iterator it = path_vec.begin(), end = path_vec.end();
          it != end; ++it) {
@@ -1184,11 +1196,13 @@ Renderer_ovg::draw_submask(const PathVec& path_vec,
 //  b. Apply fill style.
 //  c. Feed the contours in the tesselator. (Render.)
 //  d. Draw outlines for every path in the subshape with a line style.
-
+// FIMXE: this doesn't work anymore as the API has changed.
 void
-Renderer_ovg::drawShape(const SWF::ShapeRecord& shape, const SWFCxForm& cx,
-                        const SWFMatrix& mat)
+Renderer_ovg::drawShape(gnash::SWF::ShapeRecord const &shape, 
+                        gnash::Transform const& xform)
 {
+    //    GNASH_REPORT_FUNCTION;
+
     const PathVec& path_vec = shape.paths();
     
     if (!path_vec.size()) {
@@ -1197,7 +1211,7 @@ Renderer_ovg::drawShape(const SWF::ShapeRecord& shape, 
const SWFCxForm& cx,
     }
     if (_drawing_mask) {
         PathVec scaled_path_vec = path_vec;
-        apply_matrix_to_paths(scaled_path_vec, mat);
+        apply_matrix_to_paths(scaled_path_vec, xform.matrix);
         draw_mask(scaled_path_vec); 
         return;
     }    
@@ -1210,7 +1224,7 @@ Renderer_ovg::drawShape(const SWF::ShapeRecord& shape, 
const SWFCxForm& cx,
         return;
     }    
     
-    eglScopeMatrix scope_mat(mat);
+    eglScopeMatrix scope_mat(xform.matrix);
     
     std::vector<PathVec::const_iterator> subshapes = find_subshapes(path_vec);
     
@@ -1226,8 +1240,8 @@ Renderer_ovg::drawShape(const SWF::ShapeRecord& shape, 
const SWFCxForm& cx,
             subshape_paths.push_back(*subshapes[i]);
         }
         
-        draw_subshape(subshape_paths, mat, cx, fill_styles,
-                      line_styles);
+        draw_subshape(subshape_paths, xform.matrix, xform.colorTransform,
+                      fill_styles, line_styles);
     }
 }
 
@@ -1235,6 +1249,8 @@ void
 Renderer_ovg::drawGlyph(const SWF::ShapeRecord& rec, const rgba& c,
                         const SWFMatrix& mat)
 {
+    GNASH_REPORT_FUNCTION;
+
     if (_drawing_mask) abort();
     
     if (rec.getBounds().is_null()) {
@@ -1244,13 +1260,14 @@ Renderer_ovg::drawGlyph(const SWF::ShapeRecord& rec, 
const rgba& c,
     SWFCxForm dummy_cx;
     std::vector<FillStyle> glyph_fs;
     
-#if 0
-    FIXME fill_style is now FillStyle
-        FillStyle coloring;
-    coloring.setSolid(c);
-    
-    glyph_fs.push_back(coloring);
+#if 0                           // original
+    FillStyle coloring = SolidFill(c);
+#else
+    FillStyle coloring = FillStyle(SolidFill(c));
 #endif
+
+    glyph_fs.push_back(coloring);
+
     std::vector<LineStyle> dummy_ls;
     
     eglScopeMatrix scope_mat(mat);
@@ -1275,6 +1292,8 @@ Renderer_ovg::set_invalidated_regions(const 
InvalidatedRanges& /* ranges */)
 DSOEXPORT Renderer *
 create_handler(const char */* pixelformat */)
 {
+    GNASH_REPORT_FUNCTION;
+
     Renderer_ovg *renderer = new Renderer_ovg;
     return renderer;
 }
@@ -1532,6 +1551,7 @@ Renderer_ovg::printVGParams()
 bool
 Renderer_ovg::initTestBuffer(unsigned int width, unsigned int height)
 {
+    GNASH_REPORT_FUNCTION;
     int size = width * height * getBitsPerPixel(); // FIXME was Bytes not bits
 
 #if 0
@@ -1558,6 +1578,7 @@ Renderer_ovg::initTestBuffer(unsigned int width, unsigned 
int height)
 void
 Renderer_ovg::init_buffer(unsigned char *mem, int size, int x, int y, int 
rowstride)
 {
+    GNASH_REPORT_FUNCTION;
 #if 0
     assert(x > 0);
     assert(y > 0);
@@ -1579,28 +1600,25 @@ Renderer_ovg::init_buffer(unsigned char *mem, int size, 
int x, int y, int rowstr
 Renderer *
 Renderer_ovg::startInternalRender(gnash::image::GnashImage&)
 {
-    
+    // GNASH_REPORT_FUNCTION;
 }
 
 void
 Renderer_ovg::endInternalRender()
 {
-    
+    // GNASH_REPORT_FUNCTION;    
 }
 
 void
-Renderer_ovg::drawShape(gnash::SWF::ShapeRecord const&, gnash::Transform 
const&)
-{
-}
-void
 Renderer_ovg::begin_display(gnash::rgba const&, int, int, float, float, float, 
float)
 {
+    GNASH_REPORT_FUNCTION;
 
 }
 void
 Renderer_ovg::drawVideoFrame(gnash::image::GnashImage*, gnash::Transform 
const&, gnash::SWFRect const*, bool)
 {
-
+    GNASH_REPORT_FUNCTION;
 }
 
 unsigned int
diff --git a/librender/openvg/Renderer_ovg.h b/librender/openvg/Renderer_ovg.h
index bd40005..21da7ad 100644
--- a/librender/openvg/Renderer_ovg.h
+++ b/librender/openvg/Renderer_ovg.h
@@ -16,7 +16,9 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 ///
-/// Author: Visor <address@hidden>
+/// Original Author: Visor <address@hidden>.
+/// Heavily hacked by Rob <address@hidden> to work with Gnash
+/// gitmaster.
 ///
 
 #ifndef GNASH_RENDER_HANDLER_OVG_H
@@ -32,6 +34,7 @@
 //#include "directfb/DirectFBDevice.h"
 #include "GnashDevice.h"
 #include "CachedBitmap.h"
+#include "FillStyle.h"
 
 #include <VG/vgu.h>
 #ifdef OPENVG_VERSION_1_1
@@ -52,6 +55,11 @@ namespace renderer {
 
 namespace openvg {
 
+namespace {
+    const CachedBitmap* createGradientBitmap(const GradientFill& gf,
+            Renderer& renderer);
+}
+
 typedef std::vector<const Path*> PathRefs;
 typedef std::vector<Path> PathVec;
 typedef std::vector<geometry::Range2d<int> > ClipBounds;
@@ -80,7 +88,7 @@ public:
     geometry::Range2d<int> world_to_pixel(const geometry::Range2d<float>& wb);
     gnash::point pixel_to_world(int, int);
 
-    // this is in Render
+    // this is in master
     void begin_display(const gnash::rgba&, int, int, float,
                                         float, float, float);
     // This is from the patch
@@ -96,12 +104,10 @@ public:
     void drawPoly(const point* corners, size_t corner_count, 
                   const rgba& fill, const rgba& outline,
                   const SWFMatrix& mat, bool masked);
-    // this is in Render
+    // this is in master
     void drawShape(const gnash::SWF::ShapeRecord&,
                                     const gnash::Transform&);
     // This is from the patch
-    void drawShape(const SWF::ShapeRecord& shape, const SWFCxForm& cx,
-                   const SWFMatrix& mat);
     void drawGlyph(const SWF::ShapeRecord& rec, const rgba& c,
                    const SWFMatrix& mat);
 
@@ -129,38 +135,16 @@ public:
     
 #if 0
     // These are all required by the Render class
-    void drawLine(const std::vector<point>& coords, const rgba& color,
-                          const SWFMatrix& mat);
-
     void draw_poly(const point* corners, size_t corner_count,
                            const rgba& fill, const rgba& outline,
                            const SWFMatrix& mat, bool masked);
-    void drawGlyph(const SWF::ShapeRecord& rec, const rgba& color,
-                   const SWFMatrix& mat);
     void drawVideoFrame(gnash::image::GnashImage*, const gnash::Transform&,
                         const gnash::SWFRect*, bool);
-    void drawShape(const gnash::SWF::ShapeRecord&,
-                                    const gnash::Transform&);
 
     void renderToImage(boost::shared_ptr<IOChannel> io,FileType type);
     void set_invalidated_regions(const InvalidatedRanges& ranges);
     
     void begin_submit_mask();
-    void end_submit_mask();
-    void disable_mask();
-
-    gnash::geometry::Range2d<int> world_to_pixel(const gnash::SWFRect&);
-    gnash::point pixel_to_world(int, int);
-    void begin_display(const gnash::rgba&, int, int, float,
-                                        float, float, float);
-    void end_display();
-    Renderer *startInternalRender(gnash::image::GnashImage&);
-    void endInternalRender();
-    unsigned int getBitsPerPixel();
-
-    bool getPixel(rgba& color_return, int x, int y);
-
-    bool initTestBuffer(unsigned width, unsigned height);
 #endif
   private:
     void draw_mask(const PathVec& path_vec);
@@ -176,9 +160,11 @@ public:
                        bool& have_outline);
     void apply_fill_style(const FillStyle& style, const SWFMatrix& /* mat */,
                           const SWFCxForm& cx);
-    bool apply_line_style(const LineStyle& style, const SWFCxForm& cx, const 
SWFMatrix& mat);
+    bool apply_line_style(const LineStyle& style, const SWFCxForm& cx,
+                          const SWFMatrix& mat);
     void draw_outlines(const PathVec& path_vec, const SWFMatrix& mat,
-                       const SWFCxForm& cx, const std::vector<LineStyle>& 
line_styles);
+                       const SWFCxForm& cx, const std::vector<
+                       LineStyle>& line_styles);
     std::list<PathPtrVec> get_contours(const PathPtrVec &paths);
     PathPtrVec paths_by_style(const PathVec& path_vec, unsigned int style);
     std::vector<PathVec::const_iterator> find_subshapes(const PathVec& 
path_vec);
diff --git a/librender/openvg/Renderer_ovg_bitmap.h 
b/librender/openvg/Renderer_ovg_bitmap.h
index 274cb14..254b3a9 100644
--- a/librender/openvg/Renderer_ovg_bitmap.h
+++ b/librender/openvg/Renderer_ovg_bitmap.h
@@ -23,7 +23,7 @@
 #define GNASH_RENDER_HANDLER_OVG_BITMAP_H
 
 #include "Geometry.h"
-//#include "BitmapInfo.h"
+#include "CachedBitmap.h"
 #include "GnashImage.h"
 #include "Renderer.h"
 
@@ -33,11 +33,7 @@ namespace renderer {
 
 namespace openvg {
 
-/// The class itself uses a template. Currently this is unnecessary and it may
-/// be removed but an older implementation required this method and it may be
-/// necessary again when the last missing parts of the renderer will be
-/// implemented. And when might that be? I don't think I'll wait.
-class bitmap_info_ovg // : public BitmapInfo
+class bitmap_info_ovg : public CachedBitmap
 {
 public:
   
@@ -48,21 +44,56 @@ public:
         WRAP_CLAMP
     };
     
-    bitmap_info_ovg(image::GnashImage* img, VGImageFormat pixelformat, VGPaint 
paint);
+    bitmap_info_ovg(std::auto_ptr<image::GnashImage> img,
+                    VGImageFormat pixelformat, VGPaint paint);
     ~bitmap_info_ovg();
 
+    void dispose() {
+        _img.reset();
+    }
+
+    bool disposed() const {
+        return !_img.get();
+    }
+
     void apply(const gnash::SWFMatrix& bitmap_matrix,
                bitmap_wrap_mode wrap_mode) const;
 
+    virtual image::GnashImage& image() {
+        GNASH_REPORT_FUNCTION;
+        if (_cache.get()) {
+            return *_cache;
+        }
+        log_error("Image not cached!");
+#if 0
+        switch (_pixel_format) {
+            case GL_RGB:
+                _cache.reset(new image::ImageRGB(_orig_width, _orig_height));
+                break;
+            case GL_RGBA:
+                _cache.reset(new image::ImageRGBA(_orig_width, _orig_height));
+                break;
+            default:
+                std::abort();
+        }
+#endif
+        std::fill(_cache->begin(), _cache->end(), 0xff);
+
+        return *_cache;
+    }
+    
     int _width;
     int _height;
 
 private:
     
-    mutable image::GnashImage *_img;
+    mutable boost::scoped_ptr<image::GnashImage> _img;
+    mutable boost::scoped_ptr<image::GnashImage> _cache;
     VGImageFormat   _pixel_format;
     mutable VGImage _image;
     VGPaint         _paint;
+    size_t          _orig_width;
+    size_t          _orig_height;
 };
 
 } // namespace gnash::renderer::openvg

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


commit 37570697f54664a327af114b93727bb100daf477
Author: Rob Savoye <address@hidden>
Date:   Sat Dec 25 12:55:21 2010 -0700

    add doxygen style comments

diff --git a/libdevice/DeviceGlue.h b/libdevice/DeviceGlue.h
index 1075553..3833d6f 100644
--- a/libdevice/DeviceGlue.h
+++ b/libdevice/DeviceGlue.h
@@ -46,7 +46,7 @@
 
 /// @note This file is a simple base class for any GUI glue layer code
 /// That needs to use libdevice devices. Currently this is used by both
-/// the GTK and Framebufffer GUIs for OpenVG, OpenGLES1, and OpenGLES2.
+/// the GTK and Framebuffer GUIs for OpenVG, OpenGLES1, and OpenGLES2.
 namespace gnash {
 
 class DeviceGlue {
@@ -54,6 +54,11 @@ public:
     DeviceGlue() {};
     ~DeviceGlue() {};
     
+    /// Probe the system to see what types of display devices exist. This
+    /// doesn't select a device, it merely returns a list of what is
+    /// available.
+    ///
+    /// @return a list of devices
     boost::shared_array<renderer::GnashDevice::dtype_t> probeDevices() {
         GNASH_REPORT_FUNCTION;
         
@@ -89,9 +94,11 @@ public:
 #endif
         return devs;
     }
-    
+
+    /// Reset the the current device, which disables output
     void resetDevice() { _device.reset(); };
     
+    /// Get the current active device type.
     renderer::GnashDevice::dtype_t getDevice()
     {
         if (_device) {
@@ -100,6 +107,8 @@ public:
         return renderer::GnashDevice::NODEV;
     }
     
+    /// Set the display device for later use. After this is called,
+    /// the display device is active.
     void setDevice(renderer::GnashDevice::dtype_t dtype) {
         switch (dtype) {
 #ifdef BUILD_EGL_DEVICE
@@ -140,27 +149,42 @@ public:
         // egl->printEGLSurface();
     }
 
+    /// Initialze the device
+    ///
+    /// @param argc The count of arguments from the command line
+    /// @param argv The array of command line arguments
+    /// @return status
     bool initDevice(int argc, char *argv[]) {
         return (_device) ? _device->initDevice(argc, argv) : false;
     };
 
+    /// Attach the area to draw in to the lower level device. This makes
+    /// the drawing area available to the dispaly device when binding the
+    /// display to the native windowing system or framebuffer.
     bool attachWindow(renderer::GnashDevice::native_window_t window) {
         return (_device) ? _device->attachWindow(window) : false;
     };
 
+    /// Bind the client API to the device. As EGL can support different
+    /// renderers, namely OpenG:, OpenGLES1, OpenGLES2, amd OpenVG. This
+    /// is how the underlying hardware knows which API to implement.
     bool bindClient(renderer::GnashDevice::rtype_t rtype) {
         return (_device) ? _device->bindClient(rtype) : false;
     };
 
-    /// \brief
-    ///  The Width of the drawing area, in pixels. For framebuffer
+    ///  Get the Width of the drawing area, in pixels. For framebuffer
     ///  based devices, this is the size of the display screen.
     size_t getWidth()  { return (_device) ? _device->getWidth() : 0; };
 
     /// Height of the drawing area, in pixels. For framebuffer
     ///  based devices, this is the size of the display screen.
     size_t getHeight() { return (_device) ? _device->getHeight() : 0; };
-    
+
+    /// Make the current buffer the active one.
+    bool swapBuffers() {
+        return (_device) ? _device->swapBuffers() : false;
+    }
+
 protected:
     boost::scoped_ptr<renderer::GnashDevice> _device;
 };

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

Summary of changes:
 libdevice/DeviceGlue.h                 |   34 ++++++-
 librender/openvg/Renderer_ovg.cpp      |  146 ++++++++++++++++++--------------
 librender/openvg/Renderer_ovg.h        |   44 +++------
 librender/openvg/Renderer_ovg_bitmap.h |   47 +++++++++--
 4 files changed, 165 insertions(+), 106 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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