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. 2f3d03c91d5a1ab58e87


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, openvg, updated. 2f3d03c91d5a1ab58e87621052cf0a3178c1fa80
Date: Thu, 25 Nov 2010 04:39:12 +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  2f3d03c91d5a1ab58e87621052cf0a3178c1fa80 (commit)
      from  37f6559f5cfd22b79d2263e63816c7d1262d5ca8 (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=2f3d03c91d5a1ab58e87621052cf0a3178c1fa80


commit 2f3d03c91d5a1ab58e87621052cf0a3178c1fa80
Author: Rob Savoye <address@hidden>
Date:   Wed Nov 24 21:38:54 2010 -0700

    add cteareCacheBitmap back in, plus test case

diff --git a/librender/GnashDevice.h b/librender/GnashDevice.h
index 517495d..9e5a619 100644
--- a/librender/GnashDevice.h
+++ b/librender/GnashDevice.h
@@ -26,20 +26,27 @@
 
 #include <boost/scoped_array.hpp>
 
-namespace gnash
-{
+#include "Geometry.h"
+
+namespace gnash {
 
 namespace renderer {
 
 struct GnashDevice
 {
+    typedef std::vector<const Path*> PathRefs;
+    typedef std::vector<Path> PathVec;
+    typedef std::vector<geometry::Range2d<int> > ClipBounds;
+    typedef std::vector<const Path*> PathPtrVec;
+    
     /// Handle multiple window types. The derived classes will cast this to
     /// the proper data type.
     typedef long native_window_t;
     
     /// the list of supported renders that use devices
-    typedef enum {OPENVG, OPENGL, OPENGLES1, OPENGLES2, X11, VAAPI} rtype_t;
-
+    typedef enum {OPENVG, OPENGL, OPENGLES1, OPENGLES2, XORG, VAAPI} rtype_t;
+    typedef enum {EGL, DIRECTFB, X11} dtype_t;
+    
     GnashDevice() { GNASH_REPORT_FUNCTION; };
     virtual ~GnashDevice() { GNASH_REPORT_FUNCTION; };
 
diff --git a/librender/Renderer.h b/librender/Renderer.h
index ed10e67..f05a1fd 100644
--- a/librender/Renderer.h
+++ b/librender/Renderer.h
@@ -149,6 +149,8 @@
 
 #include "dsodefs.h" // for DSOEXPORT
 
+#include "boost/shared_array.hpp"
+#include "boost/scoped_ptr.hpp"
 #include "GnashEnums.h" 
 #include "Range2d.h"
 #include "Point2d.h"
@@ -156,6 +158,17 @@
 #include "log.h"
 #include "snappingrange.h"
 #include "SWFRect.h"
+#include "GnashDevice.h"
+
+#ifdef BUILD_EGL_DEVICE
+#include "eglDevice.h"
+#endif
+#ifdef BUILD_DIRECTFB_DEVICE
+#include "directfb/DirectFBDevice.h"
+#endif
+#ifdef BUILD_X11_DEVICE
+#include "x11/X11Device.h"
+#endif
 
 // Forward declarations.
 namespace gnash {
@@ -224,8 +237,8 @@ public:
     /// Given an image, returns a pointer to a bitmap_info class
     /// that can later be passed to FillStyleX_bitmap(), to set a
     /// bitmap fill style.
-    virtual CachedBitmap* createCachedBitmap(
-            std::auto_ptr<image::GnashImage> im) = 0;
+    virtual CachedBitmap *
+        createCachedBitmap(std::auto_ptr<image::GnashImage> im) = 0;
 
 
     /// ==================================================================
@@ -462,8 +475,69 @@ public:
         return true;
     }
 
+    /// ==================================================================
+    /// Interface for using low-level devices like EGL or DirectFB
+    /// These are unused by AGG, Cairo, and OpenGL, but are needed
+    /// when using OpenGLES1, OpenGLES2, or OpenVG.
+    /// ==================================================================
+    boost::shared_array<renderer::GnashDevice::dtype_t> probeDevices() {
+        GNASH_REPORT_FUNCTION;
+        
+        size_t total = 0;
+#ifdef BUILD_EGL_DEVICE
+        total++;
+#endif
+#ifdef BUILD_DIRECTFB_DEVICE
+        total++;
+#endif
+#ifdef BUILD_X11_DEVICE
+        total++;
+#endif
+        boost::shared_array<renderer::GnashDevice::dtype_t> devs
+            (new renderer::GnashDevice::dtype_t[total]);
+#ifdef BUILD_EGL_DEVICE
+        devs[--total];
+#endif
+#ifdef BUILD_DIRECTFB_DEVICE
+        devs[--total];
+#endif
+#ifdef BUILD_X11_DEVICE
+        devs[--total];
+#endif
+        
+        return devs;
+    }
+    
+    void setDevice(renderer::GnashDevice::dtype_t dtype) {
+        switch (dtype) {
+#if BUILD_EGL_DEVICE
+          case renderer::GnashDevice::EGL:
+          {
+              _device.reset(new renderer::EGLDevice);
+              break;
+          }
+#endif
+#if BUILD_DIRECTFB_DEVICE
+          case renderer::GnashDevice::DIRECTFB:
+          {
+              _device.reset(new renderer::directfb::DirectFBDevice);
+              break;
+          }
+#endif
+//#ifdef BUILD_X11_DEVICE
+          case renderer::GnashDevice::X11:
+          {
+              _device.reset(new renderer::x11::X11Device);
+              break;
+          }
+//#endif
+          default:
+              log_error("unsupported Display Device!");
+        }
+    }
+    
 #ifdef USE_TESTSUITE
-
+        
     /// ==================================================================
     /// Interfaces for testing only. Disabled when the testsuite isn't built.
     /// ==================================================================
@@ -630,6 +704,9 @@ protected:
     // Delayed imaged to render
     RenderImages _render_images;
 
+    // 
+    boost::scoped_ptr<renderer::GnashDevice> _device;
+    
 private:
 
     /// Bracket the displaying of a frame from a movie.
diff --git a/librender/agg/Renderer_agg.cpp b/librender/agg/Renderer_agg.cpp
index edd6a51..dc5e0ae 100644
--- a/librender/agg/Renderer_agg.cpp
+++ b/librender/agg/Renderer_agg.cpp
@@ -154,6 +154,7 @@ AGG resources
 #include "SWFCxForm.h"
 #include "FillStyle.h"
 #include "Transform.h"
+#include "GnashDevice.h"
 
 #ifdef HAVE_VA_VA_H
 #include "GnashVaapiImage.h"
@@ -684,12 +685,14 @@ public:
     // bitmap fill style.
     gnash::CachedBitmap* createCachedBitmap(std::auto_ptr<image::GnashImage> 
im)
     {        
+       GNASH_REPORT_FUNCTION;
         return new agg_bitmap_info(im);
     }
 
     virtual void renderToImage(boost::shared_ptr<IOChannel> io,
             FileType type, int quality) const
     {
+       GNASH_REPORT_FUNCTION;
         image::ImageRGBA im(xres, yres);
         for (int x = 0; x < xres; ++x) {
             for (int y = 0; y < yres; ++y) {
@@ -814,6 +817,7 @@ public:
     // lead to an assertion failure in begin_display() because we check
     // whether the scale is known there.
     set_scale(1.0f, 1.0f);
+       GNASH_REPORT_FUNCTION;
   }   
 
   /// Initializes the rendering buffer. The memory pointed by "mem" is not
@@ -822,8 +826,9 @@ public:
   /// remain the same. 
   /// rowstride is the size, in bytes, of one row.
   /// This method *must* be called prior to any other method of the class!
-  void init_buffer(unsigned char *mem, int size, int x, int y, int rowstride)
+    void init_buffer(unsigned char *mem, int /* size */, int x, int y, int 
rowstride)
   {
+       GNASH_REPORT_FUNCTION;
       assert(x > 0);
       assert(y > 0);
 
@@ -845,6 +850,7 @@ public:
       int /*viewport_width*/, int /*viewport_height*/,
       float /*x0*/, float /*x1*/, float /*y0*/, float /*y1*/)
   {
+       GNASH_REPORT_FUNCTION;
     assert(m_pixf.get());
     
     assert(scale_set);
@@ -870,6 +876,7 @@ public:
   
  
     virtual Renderer* startInternalRender(image::GnashImage& im) {
+       GNASH_REPORT_FUNCTION;
     
         std::auto_ptr<Renderer_agg_base> in;
     
@@ -880,6 +887,8 @@ public:
             case image::TYPE_RGBA:
                 in.reset(new Renderer_agg<typename RGBA::PixelFormat>(32));
                 break;
+         default:
+             break;
         }
  
         const size_t width = im.width();
@@ -892,6 +901,7 @@ public:
     }
 
     virtual void endInternalRender() {
+       GNASH_REPORT_FUNCTION;
         _external.reset();
     }
 
@@ -903,6 +913,8 @@ public:
     void clear_framebuffer(const geometry::Range2d<int>& region,
         const agg::rgba8& color)
     {
+       GNASH_REPORT_FUNCTION;
+
         assert(region.isFinite());
 
         // add 1 to width since we have still to draw a pixel when 
@@ -925,6 +937,8 @@ public:
     // Clean up after rendering a frame. 
     void end_display()
     {
+       GNASH_REPORT_FUNCTION;
+       
         if (m_drawing_mask) {
             log_debug(_("Warning: rendering ended while drawing a mask"));
         }
@@ -940,6 +954,7 @@ public:
     void drawLine(const std::vector<point>& coords, const rgba& color,
             const SWFMatrix& line_mat)
     {
+       GNASH_REPORT_FUNCTION;
 
         assert(m_pixf.get());
         
@@ -1023,6 +1038,7 @@ public:
   void drawGlyph(const SWF::ShapeRecord& shape, const rgba& color,
           const SWFMatrix& mat) 
   {
+       GNASH_REPORT_FUNCTION;
     
     // select relevant clipping bounds
     if (shape.getBounds().is_null()) {
@@ -1111,6 +1127,7 @@ public:
 
     void drawShape(const SWF::ShapeRecord& shape, const Transform& xform)
     {
+       GNASH_REPORT_FUNCTION;
         // check if the character needs to be rendered at all
         SWFRect cur_bounds;
 
@@ -1138,6 +1155,7 @@ public:
         const std::vector<Path>& objpaths, const SWFMatrix& mat,
         const SWFCxForm& cx)
     {
+       GNASH_REPORT_FUNCTION;
 
         bool have_shape, have_outline;
 
@@ -1890,6 +1908,7 @@ public:
   void drawPoly(const point* corners, size_t corner_count, const rgba& fill, 
     const rgba& outline, const SWFMatrix& mat, bool masked) {
     
+       GNASH_REPORT_FUNCTION;
     if (masked && !_alphaMasks.empty()) {
     
       // apply mask
@@ -1974,6 +1993,7 @@ public:
   }
   
   virtual void set_invalidated_regions(const InvalidatedRanges& ranges) {
+       GNASH_REPORT_FUNCTION;
     using gnash::geometry::Range2d;
     
     int count=0;
@@ -2114,6 +2134,7 @@ bool is_little_endian_host() {
 
 DSOEXPORT Renderer_agg_base*  create_Renderer_agg(const char *pixelformat)
 {
+       GNASH_REPORT_FUNCTION;
 
   if (!pixelformat) return NULL;
 
diff --git a/librender/cairo/Renderer_cairo.h b/librender/cairo/Renderer_cairo.h
index ea8846d..ae4fc82 100644
--- a/librender/cairo/Renderer_cairo.h
+++ b/librender/cairo/Renderer_cairo.h
@@ -124,11 +124,11 @@ public:
 
 private:
     /// The cairo context.
-    cairo_t* _cr;
+    cairo_t     *_cr;
     boost::scoped_array<boost::uint8_t> _video_buffer;
     std::vector<PathVec> _masks;
-    size_t _video_bufsize;
-    bool _drawing_mask;
+    size_t      _video_bufsize;
+    bool        _drawing_mask;
     InvalidatedRanges _invalidated_ranges;
     cairo_matrix_t _stage_mat;
 };
diff --git a/librender/directfb/DirectFBDevice.h 
b/librender/directfb/DirectFBDevice.h
index 2fc9ca9..9c61e09 100644
--- a/librender/directfb/DirectFBDevice.h
+++ b/librender/directfb/DirectFBDevice.h
@@ -78,10 +78,13 @@ class DirectFBDevice : public GnashDevice
     }
 
     int getRedSize() {
+        return 0;
     };
     int getGreenSize() {
+        return 0;
     };
     int getBlueSize() {
+        return 0;
     };
     
     bool isSingleBuffered() {
@@ -113,7 +116,7 @@ class DirectFBDevice : public GnashDevice
         return 0;
     }
 
-    virtual bool supportsRenderer(rtype_t rtype) { return true; };
+    virtual bool supportsRenderer(rtype_t /* rtype */) { return true; };
 
     // Overload some of the base class methods to deal with Device specific
     // data types.
diff --git a/librender/eglDevice.cpp b/librender/eglDevice.cpp
index cf91f73..527530b 100644
--- a/librender/eglDevice.cpp
+++ b/librender/eglDevice.cpp
@@ -228,16 +228,7 @@ EGLDevice::initDevice(int argc, char *argv[])
     EGLDevice::rtype_t rtype;
     
     GNASH_REPORT_FUNCTION;
-
     
-    // // FIXME: for now, always run verbose till this supports command line 
args
-    // dbglogfile.setVerbosity();
-
-#ifdef HAVE_GTK2+XX
-    // As gdk_init() wants the command line arguments, we have to create
-    // fake ones, as we don't care about the X11 options at this point.
-    gdk_init(&argc, &argv);
-#endif
 #ifdef HAVE_LIBX11
     _x11.initDevice(argc, argv);
 #endif
@@ -400,7 +391,7 @@ EGLDevice::bindClient(rtype_t rtype)
           }
           break;
       }
-      case GnashDevice::X11:
+      case GnashDevice::XORG:
       case GnashDevice::VAAPI:
       default:
           break;
diff --git a/librender/eglDevice.h b/librender/eglDevice.h
index 904d478..087b74a 100644
--- a/librender/eglDevice.h
+++ b/librender/eglDevice.h
@@ -37,11 +37,25 @@
 # error "This file needs EGL, which is part of OpenGL-ES"
 #endif
 
-namespace gnash
-{
+namespace gnash {
 
 namespace renderer {
 
+struct eglVertex {
+    eglVertex(float x, float y)
+        : _x(x), _y(y)
+        {
+        }
+  
+    eglVertex(const point& p)
+        : _x(p.x), _y(p.y)
+        {
+        }
+
+    float _x;
+    float _y;
+};
+
 class EGLDevice : public GnashDevice
 {
   public:
diff --git a/librender/opengl/Renderer_ogl.cpp 
b/librender/opengl/Renderer_ogl.cpp
index 00a5374..0ea96ec 100644
--- a/librender/opengl/Renderer_ogl.cpp
+++ b/librender/opengl/Renderer_ogl.cpp
@@ -580,6 +580,8 @@ bitmap_info_ogl::~bitmap_info_ogl()
 void
 bitmap_info_ogl::setup() const
 {      
+    GNASH_REPORT_FUNCTION;
+    
     oglScopeEnable enabler(_ogl_img_type);
   
     glGenTextures(1, &_texture_id);
@@ -723,6 +725,8 @@ public:
   
   void init()
   {
+    GNASH_REPORT_FUNCTION;
+    
     // Turn on alpha blending.
     // FIXME: do this when it's actually used?
     glEnable(GL_BLEND);
@@ -811,6 +815,8 @@ public:
 
   boost::shared_ptr<GnashTexture> getCachedTexture(image::GnashImage *frame)
   {
+    GNASH_REPORT_FUNCTION;
+    
       boost::shared_ptr<GnashTexture> texture;
       gnash::GnashTextureFormat frameFormat(frame->type());
       unsigned int frameFlags;
@@ -995,6 +1001,8 @@ public:
     int viewport_width, int viewport_height,
     float x0, float x1, float y0, float y1)
   {
+    GNASH_REPORT_FUNCTION;
+    
     glViewport(0, 0, viewport_width, viewport_height);
     glLoadIdentity();
 
@@ -1027,6 +1035,8 @@ public:
   virtual void
   end_display()
   {
+    GNASH_REPORT_FUNCTION;
+    
     glEndList();    
     
 #if NO_ANTIALIASING
@@ -1110,6 +1120,8 @@ public:
   virtual void drawLine(const std::vector<point>& coords, const rgba& color,
                   const SWFMatrix& mat)
   {
+    GNASH_REPORT_FUNCTION;
+    
     oglScopeMatrix scope_mat(mat);
 
     const size_t numPoints = coords.size();
@@ -1142,6 +1154,8 @@ public:
   virtual void  drawPoly(const point* corners, size_t corner_count, 
     const rgba& fill, const rgba& outline, const SWFMatrix& mat, bool /* 
masked */)
   {
+    GNASH_REPORT_FUNCTION;
+    
     if (corner_count < 1) {
       return;
     }
@@ -1174,6 +1188,8 @@ public:
     
   virtual void begin_submit_mask()
   {
+    GNASH_REPORT_FUNCTION;
+    
     PathVec mask;
     _masks.push_back(mask);
     
@@ -1182,6 +1198,8 @@ public:
   
   virtual void end_submit_mask()
   {
+    GNASH_REPORT_FUNCTION;
+    
     _drawing_mask = false;
     
     apply_mask();
@@ -1197,6 +1215,8 @@ public:
   /// the number of masks.
   void apply_mask()
   {
+    GNASH_REPORT_FUNCTION;
+    
     if (_masks.empty()) {
       return;
     }
@@ -1632,6 +1652,8 @@ public:
   
   void draw_mask(const PathVec& path_vec)
   {    
+    GNASH_REPORT_FUNCTION;
+    
     for (PathVec::const_iterator it = path_vec.begin(), end = path_vec.end();
          it != end; ++it) {
       const Path& cur_path = *it;
@@ -1784,6 +1806,7 @@ public:
 
   virtual void drawShape(const SWF::ShapeRecord& shape, const Transform& xform)
   {
+    GNASH_REPORT_FUNCTION;    
   
     const PathVec& path_vec = shape.paths();
 
@@ -1977,6 +2000,8 @@ sampleGradient(const GradientFill& fill, boost::uint8_t 
ratio)
 const CachedBitmap*
 createGradientBitmap(const GradientFill& gf, Renderer& renderer)
 {
+    GNASH_REPORT_FUNCTION;
+    
     std::auto_ptr<image::ImageRGBA> im;
 
     switch (gf.type())
diff --git a/librender/opengles1/Renderer_gles1.cpp 
b/librender/opengles1/Renderer_gles1.cpp
index 444f92f..7925f87 100644
--- a/librender/opengles1/Renderer_gles1.cpp
+++ b/librender/opengles1/Renderer_gles1.cpp
@@ -57,11 +57,12 @@
 #include "SWFMatrix.h"
 #include "swf/ShapeRecord.h"
 
-#include "Renderer_gles1.h"
-
 #include <boost/utility.hpp>
 #include <boost/bind.hpp>
 
+#include "Renderer_gles1.h"
+#include "GnashDevice.h"
+
 // Defined to 1 to disable (slow) anti-aliasing with the accumulation buffer
 #define NO_ANTIALIASING 1
 
@@ -99,7 +100,7 @@ Renderer_gles1::Renderer_gles1()
 
 Renderer_gles1::~Renderer_gles1()
 {
-
+    GNASH_REPORT_FUNCTION;
 }
 
 void
@@ -111,7 +112,7 @@ Renderer_gles1::init(float x, float y)
 CachedBitmap *
 Renderer_gles1::createCachedBitmap(std::auto_ptr<gnash::image::GnashImage>)
 {
-
+    GNASH_REPORT_FUNCTION;
 }
 
 void
@@ -119,6 +120,7 @@ Renderer_gles1::drawVideoFrame(image::GnashImage* /* frame 
*/,
                                const gnash::Transform& t/* m */,
                                const SWFRect* /* bounds */, bool /*smooth*/)
 {
+    GNASH_REPORT_FUNCTION;
     log_unimpl("drawVideoFrame");  
 }
 
@@ -232,7 +234,7 @@ void
 Renderer_gles1::begin_submit_mask()
 {
 #if 0
-    PathVec mask;
+    GnashDevice::PathVec mask;
     _masks.push_back(mask);
     
     _drawing_mask = true;
@@ -260,6 +262,7 @@ Renderer_gles1::disable_mask()
 void
 Renderer_gles1::set_scale(float xscale, float yscale)
 {
+    GNASH_REPORT_FUNCTION;
 #if 0
     _xscale = xscale;
     _yscale = yscale;
@@ -271,11 +274,13 @@ Renderer_gles1::set_scale(float xscale, float yscale)
 void
 Renderer_gles1::set_invalidated_regions(const InvalidatedRanges& /* ranges */)
 {
+    GNASH_REPORT_FUNCTION;
 }
 
 bool
 Renderer_gles1::initTestBuffer(unsigned int width, unsigned int height)
 {
+    GNASH_REPORT_FUNCTION;
 #if 0
     int size = width * height; // * getBytesPerPixel();
     
@@ -292,20 +297,21 @@ Renderer_gles1::initTestBuffer(unsigned int width, 
unsigned int height)
 Renderer *
 Renderer_gles1::startInternalRender(gnash::image::GnashImage&)
 {
+    GNASH_REPORT_FUNCTION;
 }
 
 void
 Renderer_gles1::endInternalRender()
 {
+    GNASH_REPORT_FUNCTION;
 }
 
 Renderer *
 create_handler(const char *pixelformat)
 {
-  Renderer_gles1 *renderer = new Renderer_gles1;
-  return renderer;
-
-  return 0;
+    GNASH_REPORT_FUNCTION;
+    Renderer_gles1 *renderer = new Renderer_gles1;
+    return renderer;
 }  
 
 } // namespace gnash::renderer::gles1
diff --git a/librender/opengles1/Renderer_gles1.h 
b/librender/opengles1/Renderer_gles1.h
index 1094dc1..bbc4b1d 100644
--- a/librender/opengles1/Renderer_gles1.h
+++ b/librender/opengles1/Renderer_gles1.h
@@ -134,6 +134,8 @@ class  DSOEXPORT Renderer_gles1: public Renderer, public 
EGLDevice
 public:
     std::string description() const { return "OpenGLES1"; }
     Renderer_gles1();
+    Renderer_gles1(GnashDevice::dtype_t dtype);
+    
     ~Renderer_gles1();
         
     void init(float x, float y);
diff --git a/librender/openvg/Renderer_ovg.cpp 
b/librender/openvg/Renderer_ovg.cpp
index 64ce79e..d8652f5 100644
--- a/librender/openvg/Renderer_ovg.cpp
+++ b/librender/openvg/Renderer_ovg.cpp
@@ -43,6 +43,7 @@
 #include "Renderer_ovg_bitmap.h"
 #include "SWFMatrix.h"
 #include "swf/ShapeRecord.h"
+#include "CachedBitmap.h"
 
 #define GNASH_IMAGE_QUALITY     VG_IMAGE_QUALITY_FASTER
 #define GNASH_RENDER_QUALITY    VG_RENDERING_QUALITY_FASTER
@@ -181,8 +182,8 @@ bitmap_info_ovg::bitmap_info_ovg(gnash::image::GnashImage* 
img,
 bitmap_info_ovg::~bitmap_info_ovg()
 {
     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);
+    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);
 
     vgDestroyImage(_image);
 }
@@ -234,32 +235,47 @@ Renderer_ovg::Renderer_ovg()
       _display_height(0.0),
       _drawing_mask(false)
 {
+    GNASH_REPORT_FUNCTION;
+}
 
-//    if (!initDevice(EGLDevice::OPENVG))
-    if (!initDevice(0, 0)) {
-        log_error("Couldn't initialize EGL Device!");
-    }
-#ifdef HAVE_GTK2 
-    if (!attachWindow(0)) {
-        log_error("Couldn't initialize EGL Window!");
-    }
-    EGLint value;
-    eglQuerySurface(_eglDisplay, _eglSurface, EGL_WIDTH, &value);
-    _display_width = value;
-    eglQuerySurface(_eglDisplay, _eglSurface, EGL_HEIGHT, &value);
-    _display_height = value;
-#else
-#warning "Must initialize a native window!"
-#endif
+Renderer_ovg::Renderer_ovg(renderer::GnashDevice::dtype_t dtype)
+    : _display_width(0.0),
+      _display_height(0.0),
+      _drawing_mask(false)
+{
+    GNASH_REPORT_FUNCTION;
+    setDevice(dtype);
     
-    set_scale(1.0f, 1.0f);
-    m_fillpaint = vgCreatePaint();
-    m_strokepaint = vgCreatePaint();
-
-    vgSetPaint (m_fillpaint,   VG_FILL_PATH);
-    vgSetPaint (m_strokepaint, VG_STROKE_PATH);
+    if (_device) {
+        _device->initDevice(0, 0);
+        
+        set_scale(1.0f, 1.0f);
+        m_fillpaint = vgCreatePaint();
+        m_strokepaint = vgCreatePaint();
+        
+        vgSetPaint (m_fillpaint,   VG_FILL_PATH);
+        vgSetPaint (m_strokepaint, VG_STROKE_PATH);
+    } else {
+        log_error(_("No EGL Device to initialize!"));
+    }
 }
 
+// void
+// Renderer_ovg::setDevice(GnashDevice::dtype_t dtype)
+// {
+    
+// #if 0
+// #ifdef HAVE_GTK2 
+//     if (!_eglDevicea.attachWindow(0)) {
+//         log_error(_("Couldn't initialize EGL Window!"));
+//     }
+// #else
+// #warning "Must initialize a native window!"
+// #endif
+// #else
+// #endif
+// }
+
 void
 Renderer_ovg::init(float x, float y)
 {
@@ -313,25 +329,25 @@ Renderer_ovg::~Renderer_ovg()
 #endif
 }
 
-#if 0
-FIXME
-    // Given an image, returns a pointer to a bitmap_info class
+// Given an image, returns a pointer to a bitmap_info class
 // that can later be passed to fill_styleX_bitmap(), to set a
 // bitmap fill style.
-gnash::BitmapInfo *
-Renderer_ovg::createBitmapInfo(std::auto_ptr<GnashImage> im)
+CachedBitmap *
+Renderer_ovg::createCachedBitmap(std::auto_ptr<image::GnashImage> im)
 {
     GNASH_REPORT_FUNCTION;
     
     // OpenVG don't support 24bit RGB, need translate colorspace
     switch (im->type()) {
-      case GNASH_IMAGE_RGBA:   
-          return new bitmap_info_ovg(im.get(), VG_sARGB_8888, m_fillpaint);
+      case image::TYPE_RGBA:   
+//          return new bitmap_info_ovg(im.get(), VG_sARGB_8888, m_fillpaint);
+          break;
+      case image::TYPE_RGB:
+          break;
       default:
           std::abort();
     }
 }
-#endif
 
 // Since we store drawing operations in display lists, we take special care
 // to store video frame operations in their own display list, lest they be
@@ -1510,15 +1526,16 @@ Renderer_ovg::initTestBuffer(unsigned int width, 
unsigned int height)
 #ifdef HAVE_GTK2
     // new surface
     // makeCurrentContext
+    
 #else
     
     // _testBuffer = static_cast<unsigned char *>(realloc(_testBuffer, size));
     _testBuffer = new unsigned char[size];
     memset(_testBuffer, 0, size);
     printf("\tRenderer Test memory at: %p\n", _testBuffer);
-#endif
-    
+
     attachWindow(0);
+#endif
     
     init_buffer(_testBuffer, size, width, height, width * getBitsPerPixel());
 //    init(width, height);
@@ -1579,11 +1596,6 @@ Renderer_ovg::drawVideoFrame(gnash::image::GnashImage*, 
gnash::Transform const&,
 {
 
 }
-CachedBitmap *
-Renderer_ovg::createCachedBitmap(std::auto_ptr<gnash::image::GnashImage>)
-{
-
-}
 
 unsigned int
 Renderer_ovg::getBitsPerPixel()
diff --git a/librender/openvg/Renderer_ovg.h b/librender/openvg/Renderer_ovg.h
index 46e1423..647d19c 100644
--- a/librender/openvg/Renderer_ovg.h
+++ b/librender/openvg/Renderer_ovg.h
@@ -28,15 +28,19 @@
 #include <VG/vgext.h>
 #include <vector>
 #include <boost/scoped_array.hpp>
+#include <boost/scoped_ptr.hpp>
 
 #include "Geometry.h"
-//#include "BitmapInfo.h"
 #include "Renderer.h"
 #include "eglDevice.h"
+#include "directfb/DirectFBDevice.h"
+#include "GnashDevice.h"
+#include "CachedBitmap.h"
 
 namespace gnash {
 
 class SWFCxForm;
+class GnashImage;
 
 namespace renderer {
 
@@ -47,28 +51,16 @@ typedef std::vector<Path> PathVec;
 typedef std::vector<geometry::Range2d<int> > ClipBounds;
 typedef std::vector<const Path*> PathPtrVec;
 
-struct eglVertex {
-    eglVertex(float x, float y)
-        : _x(x), _y(y)
-        {
-        }
-  
-    eglVertex(const point& p)
-        : _x(p.x), _y(p.y)
-        {
-        }
-
-    VGfloat _x;
-    VGfloat _y;
-};
-
 // typedef std::map<const Path*, VGPath > PathPointMap;
 
-class  DSOEXPORT Renderer_ovg: public Renderer, public EGLDevice
+class  DSOEXPORT Renderer_ovg: public Renderer
 {
 public:
     std::string description() const { return "OpenVG"; }
+
     Renderer_ovg();
+    Renderer_ovg(GnashDevice::dtype_t dtype);
+    
     ~Renderer_ovg();
         
     void init(float x, float y);
@@ -130,11 +122,7 @@ public:
     void printVGPath();
     
 #if 0
-    // These are all required by thr Render class
-    void set_scale(float xscale, float yscale);
-    void set_translation(float xoff, float yoff);
-    CachedBitmap *createCachedBitmap(std::auto_ptr<image::GnashImage> im);
-
+    // These are all required by the Render class
     void drawLine(const std::vector<point>& coords, const rgba& color,
                           const SWFMatrix& mat);
 
@@ -217,6 +205,8 @@ public:
     VGMaskLayer m_mask;
 #endif
     unsigned char *_testBuffer; // buffer used by initTestBuffer() only
+    
+    boost::scoped_ptr<GnashDevice> _device;
 };
 
 DSOEXPORT Renderer* create_handler(const char *pixelformat);
diff --git a/librender/testr.cpp b/librender/testr.cpp
index f5bf8a1..9cd3ba9 100644
--- a/librender/testr.cpp
+++ b/librender/testr.cpp
@@ -45,6 +45,7 @@
 #include "SWFMatrix.h"
 #include "Renderer.h"
 #include "Transform.h"
+#include "CachedBitmap.h"
 #include "GnashVaapiImage.h"
 #include "GnashVaapiImageProxy.h"
 #include "boost/date_time/posix_time/posix_time.hpp"
@@ -161,7 +162,7 @@ main(int argc, char *argv[])
 #ifdef RENDERER_AGG
     Timer tagg("AGG");
     Renderer *renderer1 = create_Renderer_agg(pixelformat);
-#ifdef HAVE_GTK2
+#ifdef HAVE_GTK2_XX
     GtkWidget *canvas = create_GTK_window();
     GdkVisual* visual = gdk_drawable_get_visual(canvas->window);
     GdkImage *offscreenbuf = gdk_image_new (GDK_IMAGE_FASTEST, visual, 
200,200);
@@ -185,9 +186,11 @@ main(int argc, char *argv[])
 #ifdef RENDERER_OPENVG
     Timer tovg("OpenVG");
     Renderer *renderer2 = renderer::openvg::create_handler(pixelformat);
-    EGLDevice *ovg = dynamic_cast<EGLDevice *>(renderer2);
-    ovg->initDevice(0, 0);
-    ovg->attachWindow(*(reinterpret_cast<EGLNativeWindowType *>(canvas)));
+//     EGLDevice *ovg = dynamic_cast<EGLDevice *>(renderer2);
+//     if (ovg) {
+//         ovg->initDevice(0, 0);
+// //        ovg->attachWindow(*(reinterpret_cast<EGLNativeWindowType 
*>(canvas)));
+//         ovg->attachWindow(0);
     if (renderer2) {
         test_renderer(renderer2, "OpenVG");
         test_geometry(renderer2, "OpenVG");
@@ -297,6 +300,15 @@ test_renderer(Renderer *renderer, const std::string &type)
         runtest.fail("getBitsPerPixel()");
     }
 
+    image::GnashImage *frame1 = new image::ImageRGBA(10, 10);
+    std::auto_ptr<image::GnashImage> im1(frame1);
+    CachedBitmap *cb = renderer->createCachedBitmap(im1);
+    if (cb) {
+        runtest.pass("createCachedBitmap()");
+    } else {
+        runtest.fail("createCachedBitmap()");
+    }
+
 #ifdef HAVE_GTK2
     GtkWidget *canvas = create_GTK_window();
     if (type == "AGG") {
@@ -554,6 +566,12 @@ test_iterators(Renderer *renderer, const std::string &type)
 #endif
 }
 
+#if 0
+FIXME:
+ add tests for
+Renderer_ovg::createBitmapInfo(std::auto_ptr<GnashImage> im)
+#endif
+
 // Local Variables:
 // mode: C++
 // indent-tabs-mode: nil
diff --git a/librender/testr_gtk.cpp b/librender/testr_gtk.cpp
index df399a1..45d399a 100644
--- a/librender/testr_gtk.cpp
+++ b/librender/testr_gtk.cpp
@@ -120,7 +120,7 @@ initVGDemo(void)
     path  = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
                          1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
 
-    vguArc(path, x, y, w, h, startAngle, angleExtent, (VGUArcType)arcType);
+//    vguArc(path, x, y, w, h, startAngle, angleExtent, (VGUArcType)arcType);
 
     vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
     vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_BEVEL);
diff --git a/librender/x11/X11Device.h b/librender/x11/X11Device.h
index d8f17c8..34a489a 100644
--- a/librender/x11/X11Device.h
+++ b/librender/x11/X11Device.h
@@ -72,7 +72,7 @@ class X11Device : public GnashDevice
     
     bool isSingleBuffered() { return true; }
     
-    bool supportsRenderer(GnashDevice::rtype_t rtype) { return false; }
+    bool supportsRenderer(GnashDevice::rtype_t /* rtype */) { return false; }
     
     bool isBufferDestroyed() { return false; }
     // bool isBufferDestroyed(IX11Surface surface) {

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

Summary of changes:
 librender/GnashDevice.h                |   15 ++++--
 librender/Renderer.h                   |   83 ++++++++++++++++++++++++++++-
 librender/agg/Renderer_agg.cpp         |   23 ++++++++-
 librender/cairo/Renderer_cairo.h       |    6 +-
 librender/directfb/DirectFBDevice.h    |    5 ++-
 librender/eglDevice.cpp                |   11 +----
 librender/eglDevice.h                  |   18 ++++++-
 librender/opengl/Renderer_ogl.cpp      |   25 +++++++++
 librender/opengles1/Renderer_gles1.cpp |   24 +++++---
 librender/opengles1/Renderer_gles1.h   |    2 +
 librender/openvg/Renderer_ovg.cpp      |   90 ++++++++++++++++++--------------
 librender/openvg/Renderer_ovg.h        |   34 ++++--------
 librender/testr.cpp                    |   26 ++++++++--
 librender/testr_gtk.cpp                |    2 +-
 librender/x11/X11Device.h              |    2 +-
 15 files changed, 266 insertions(+), 100 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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