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


From: Rob Savoye
Subject: [Gnash-commit] [SCM] Gnash branch, openvg, updated. c0bc7552f2464c31781acd3a7d4c907c74089126
Date: Sat, 29 Jan 2011 05:38:03 +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  c0bc7552f2464c31781acd3a7d4c907c74089126 (commit)
       via  de6b803da7d7345a5eae6ab826bc95c8c43251b7 (commit)
      from  787c8b4bbd171a494badd69b8a01709d707aa869 (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=c0bc7552f2464c31781acd3a7d4c907c74089126


commit c0bc7552f2464c31781acd3a7d4c907c74089126
Author: Rob Savoye <address@hidden>
Date:   Fri Jan 28 22:37:47 2011 -0700

    cleanup image creation

diff --git a/librender/openvg/OpenVGBitmap.cpp 
b/librender/openvg/OpenVGBitmap.cpp
index f3eefcc..d214299 100644
--- a/librender/openvg/OpenVGBitmap.cpp
+++ b/librender/openvg/OpenVGBitmap.cpp
@@ -35,10 +35,8 @@ OpenVGBitmap::OpenVGBitmap(VGPaint paint)
     : _vgimage(VG_INVALID_HANDLE),
 #ifdef BUILD_X11_DEVICE
       _pixel_format(VG_sARGB_8888),
-      _stride(4),
 #else
       _pixel_format(VG_sRGB_565),
-      _stride(2),
 #endif
       _vgpaint(paint)
 {
@@ -49,21 +47,19 @@ OpenVGBitmap::OpenVGBitmap(CachedBitmap *bitmap, VGPaint 
vgpaint)
     : _vgimage(VG_INVALID_HANDLE),
 #ifdef BUILD_X11_DEVICE
       _pixel_format(VG_sARGB_8888),
-      _stride(4),
 #else
       _pixel_format(VG_sRGB_565),
-      _stride(2),
 #endif
        _vgpaint(vgpaint)
 {
     GNASH_REPORT_FUNCTION;
 
-    // Store the reference so so it's available to createPatternBitmap()
-    //    _image.reset(&im);
-
     // extract a reference to the image from the cached bitmap
     image::GnashImage &im = bitmap->image();
 
+    // Store the reference so so it's available to createPatternBitmap()
+    _image.reset(&im);
+
     // Create a VG image
     _vgimage = vgCreateImage(_pixel_format, im.width(), im.height(),
                              VG_IMAGE_QUALITY_FASTER);    
@@ -89,30 +85,27 @@ OpenVGBitmap::OpenVGBitmap(CachedBitmap *bitmap, VGPaint 
vgpaint)
     default:
         std::abort();
     }
-
-    vgSetParameteri (_vgpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
-    vgPaintPattern (_vgpaint, _vgimage);
 }
 
-// 
-// VG_sRGB_565
-// VG_sRGBA_5551
-// VG_sRGBA_4444
-// VG_A_8
-// VG_A_4
+// FIXME: this caches the GnashImage, but we should really cache the VG Image.
 OpenVGBitmap::OpenVGBitmap(image::GnashImage *image, VGPaint vgpaint)
     : _image(image),
       _vgimage(VG_INVALID_HANDLE),
 #ifdef BUILD_X11_DEVICE
       _pixel_format(VG_sARGB_8888),
-      _stride(4),
 #else
       _pixel_format(VG_sRGB_565),
-      _stride(2),
 #endif
     _vgpaint(vgpaint)
 {
     GNASH_REPORT_FUNCTION;
+    // Create a VG image
+    _vgimage = vgCreateImage(_pixel_format, image->width(), image->height(),
+                             VG_IMAGE_QUALITY_FASTER);    
+    if (_vgimage == VG_INVALID_HANDLE) {
+        log_error("Failed to create VG image! %s",
+                  Renderer_ovg::getErrorString(vgGetError()));
+    }
     
     switch (image->type()) {
     case image::TYPE_RGB:
@@ -124,49 +117,19 @@ OpenVGBitmap::OpenVGBitmap(image::GnashImage *image, 
VGPaint vgpaint)
     case image::TYPE_RGBA:
         log_debug("Image has RGBA Pixel Format, Stride is %d",
                   image->stride());
+        // Copy the image data into the VG image container
         vgImageSubData(_vgimage, image->begin(), image->stride(), 
VG_sRGBA_8888,
                    0, 0, image->width(), image->height());
         break;
     default:
         std::abort();
     }
-
-    size_t width = _image->width();
-    size_t height = _image->height();
-
-    // Create a VG image, and copy the GnashImage data into it
-    _vgimage = vgCreateImage(_pixel_format, width, height,
-                             VG_IMAGE_QUALITY_FASTER);    
-    
-    vgImageSubData(_vgimage, image->begin(), image->stride(), _pixel_format,
-                   0, 0, width, height);
-
-    // vgSetParameteri(vgpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
-    //    vgSetParameteri(vgpaint, VG_PAINT_PATTERN_TILING_MODE, 
VG_TILE_REPEAT);
-    vgPaintPattern(vgpaint, _vgimage);
-    vgDrawImage(_vgimage);
-    vgFlush();
-    
-#if 0
-    _tex_size += width * height * 4;
-    log_debug("Add Texture size:%d (%d x %d x %dbpp)", width * height * 4, 
-              width, height, 4);
-    log_debug("Current Texture size: %d", _tex_size);
-#endif
 } 
 
 OpenVGBitmap::~OpenVGBitmap()
 {
     // GNASH_REPORT_FUNCTION;
     
-#if 0
-    _tex_size -= _image->width() * _image->height() * 4;
-    log_debug(_("Remove Texture size:%d (%d x %d x %dbpp)"),
-              _image->width() * _image->height() * 4,
-              _image->width(), _image->height(), 4);
-    log_debug(_("Current Texture size: %d"), _tex_size);
-#endif
-    
     vgDestroyPaint(_vgpaint);
     vgDestroyImage(_vgimage);
 }
@@ -174,7 +137,8 @@ OpenVGBitmap::~OpenVGBitmap()
 image::GnashImage&
 OpenVGBitmap::image()
 {
-    GNASH_REPORT_FUNCTION;
+    // GNASH_REPORT_FUNCTION;
+
     if (_image) {
         return *_image;
     }
@@ -252,45 +216,22 @@ OpenVGBitmap::createLinearBitmap(float x0, float y0, 
float x1, float y1,
     return this;
 }
 
-    // Create and fill pattern image
+// Create and fill pattern image
 OpenVGBitmap *
-OpenVGBitmap::createPatternBitmap(CachedBitmap *bitmap, const 
gnash::SWFMatrix& matrix,
-                                  bitmap_wrap_mode mode)
+OpenVGBitmap::applyPatternBitmap(const gnash::SWFMatrix& matrix,
+                                 bitmap_wrap_mode mode, VGPaint paint)
 {
     GNASH_REPORT_FUNCTION;
 
-    // extract a reference to the image from the cached bitmap
-    image::GnashImage &im = bitmap->image();
-
-    // 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",
+        log_error("No VG image to paint! %s",
                   Renderer_ovg::getErrorString(vgGetError()));
-    }
-    
-    switch (im.type()) {
-    case image::TYPE_RGB:
-        log_debug("Image has RGB Pixel Format, Stride is %d",
-                  im.stride());
-        vgImageSubData(_vgimage, im.begin(), im.stride(), VG_sRGBA_8888,
-                   0, 0, im.width(), im.height());
-        break;
-    case image::TYPE_RGBA:
-        log_debug("Image has RGBA Pixel Format, Stride is %d",
-                  im.stride());
-        // Copy the image data into the VG image container
-        vgImageSubData(_vgimage, im.begin(), im.stride(), VG_sRGBA_8888,
-                   0, 0, im.width(), im.height());
-        break;
-    default:
-        log_error("");
         return 0;
     }
 
+    _vgpaint = paint;
+        
     vgSetParameteri (_vgpaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
-//    vgPaintPattern (_vgpaint, _vgimage);
 
     gnash::SWFMatrix mat;
     VGfloat     vmat[9];
@@ -335,8 +276,6 @@ OpenVGBitmap::createPatternBitmap(CachedBitmap *bitmap, 
const gnash::SWFMatrix&
     }
 
     vgPaintPattern(_vgpaint, _vgimage);
-//    vgDrawImage(_vgimage);
-//    vgFlush();
 
     return this;
 }
diff --git a/librender/openvg/OpenVGBitmap.h b/librender/openvg/OpenVGBitmap.h
index b2ca95c..d0eeabb 100644
--- a/librender/openvg/OpenVGBitmap.h
+++ b/librender/openvg/OpenVGBitmap.h
@@ -47,6 +47,7 @@ public:
     bool disposed() const { return !_image.get(); }
 
     image::GnashImage& image();
+    VGPaint &vgimage() { return _vgimage; };
     
     // Accessors for the GnashImage internal data
     VGPaint getFillPaint() const { return _vgpaint; }
@@ -57,21 +58,26 @@ public:
     /// 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.
+    ///
+    /// @param x0 The X coordinate of the origin point
+    /// @param y0 The Y coordinate of the origin point
+    /// @param x1 The X coordinate of the opposite corner point
+    /// @param y1 The Y coordinate of the opposite corner point
+    /// @param incolor The base color of the gradient
+    /// @param paint The VG paint surface
     OpenVGBitmap *createRadialBitmap(float x0, float y0, float x1,
                                      float y1, float radial,
                                      const rgba &incolor, VGPaint paint);
     OpenVGBitmap *createLinearBitmap(float x0, float y0, float x1, float y1,
                                      const rgba &incolor, const VGPaint paint);
 
-    // This is for images
-    OpenVGBitmap *createPatternBitmap(CachedBitmap *bitmap, const 
gnash::SWFMatrix& matrix,
-                                      bitmap_wrap_mode mode);
+    OpenVGBitmap *applyPatternBitmap(const gnash::SWFMatrix& matrix,
+                                      bitmap_wrap_mode mode, VGPaint paint);
     
 private:
     boost::scoped_ptr<image::GnashImage> _image;
     VGImageFormat   _pixel_format;
     VGImage         _vgimage;
-    int             _stride;
     VGPaint         _vgpaint;
 //    int             _tex_size;
 };
diff --git a/librender/openvg/OpenVGRenderer.cpp 
b/librender/openvg/OpenVGRenderer.cpp
index b3a2921..84d9220 100644
--- a/librender/openvg/OpenVGRenderer.cpp
+++ b/librender/openvg/OpenVGRenderer.cpp
@@ -297,14 +297,15 @@ Renderer_ovg::~Renderer_ovg()
 
 // Given an image, returns a pointer to a CachedBitmap class
 // that can later be passed to fill_styleX_bitmap(), to set a
-// bitmap fill style.
+// bitmap fill style. This unfortunately doesn't support
+// hardware acceleration libraries like OpenVG, which have their
+// own image type, which is what should be cached to avoid
+// recalculating it.
 CachedBitmap *
 Renderer_ovg::createCachedBitmap(std::auto_ptr<image::GnashImage> im)
 {
     // GNASH_REPORT_FUNCTION;
 
-    // OpenVG don't support 24bit RGB, so we need to translate
-    // the colorspace
     image::GnashImage *image = im.release();
     return reinterpret_cast<CachedBitmap *>(new OpenVGBitmap(image, 
_fillpaint));
 }
@@ -839,13 +840,19 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
           log_error("Fill Style Type: Gradient, you shouldn't be here!");
           break;
       }
+      // FIXME: Bitmap cacheing needs to be improved. Currently the GnahInage
+      // is cached, but the VG image is not. This forces the VG Image to be
+      // recalculated all the time from the GnashImage. Ideally the VG Image
+      // should be cached instead.
       case SWF::FILL_TILED_BITMAP_HARD:
       case SWF::FILL_TILED_BITMAP:
       {
           log_debug("Fill Style Type: Tiled Bitmap");
           CachedBitmap *cb = boost::apply_visitor(GetBitmap(), style.fill);
-          OpenVGBitmap *binfo = new OpenVGBitmap(_fillpaint);
-          binfo->createPatternBitmap(cb, sm, OpenVGBitmap::WRAP_REPEAT);
+          // Convert the GnashImage to a VG Image
+          OpenVGBitmap *binfo = new OpenVGBitmap(cb, _fillpaint);
+          // Apply the transformation and paint
+          binfo->applyPatternBitmap(sm, OpenVGBitmap::WRAP_FILL, _fillpaint);
           break;
       }
       
@@ -854,8 +861,16 @@ Renderer_ovg::apply_fill_style(const FillStyle& style, 
const SWFMatrix& mat,
       {     
           log_debug("Fill Style Type: Clipped Bitmap");
           CachedBitmap *cb = boost::apply_visitor(GetBitmap(), style.fill);
-          OpenVGBitmap *binfo = new OpenVGBitmap(_fillpaint);
-          binfo->createPatternBitmap(cb, sm, OpenVGBitmap::WRAP_FILL);
+          // Convert the GnashImage to a VG Image
+#if 1
+          OpenVGBitmap *binfo = new OpenVGBitmap(cb, _fillpaint);
+          // Apply the transformation and paint
+          binfo->applyPatternBitmap(sm, OpenVGBitmap::WRAP_FILL, _fillpaint);
+#else
+          OpenVGBitmap *binfo = reinterpret_cast<OpenVGBitmap *>(cb);
+          // Apply the transformation and paint
+          binfo->applyPatternBitmap(sm, OpenVGBitmap::WRAP_FILL, _fillpaint);
+#endif
           break;
       } 
       case SWF::FILL_SOLID:

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


commit de6b803da7d7345a5eae6ab826bc95c8c43251b7
Author: Rob Savoye <address@hidden>
Date:   Fri Jan 28 14:36:49 2011 -0700

    only minor formatting changes

diff --git a/gui/gui.cpp b/gui/gui.cpp
index 4197b09..51341f0 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -166,7 +166,9 @@ Gui::Gui(unsigned long xid, float scale, bool loop, 
RunResources& r)
 
 Gui::~Gui()
 {
-    if ( _movieDef.get() ) log_debug("~Gui - _movieDef refcount: %d", 
_movieDef->get_ref_count());
+    if ( _movieDef.get() ) {
+        log_debug("~Gui - _movieDef refcount: %d", _movieDef->get_ref_count());
+    }
 
 #ifdef GNASH_FPS_DEBUG
     if ( fps_timer_interval ) {
@@ -214,14 +216,14 @@ Gui::hideMenu()
 bool
 Gui::showMouse(bool /* show */)
 {
-       LOG_ONCE(log_unimpl(_("Mouse show/hide not yet supported in this 
GUI")));
-       return true;
+    LOG_ONCE(log_unimpl(_("Mouse show/hide not yet supported in this GUI")));
+    return true;
 }
 
 void
 Gui::showMenu(bool /* show */)
 {
-       LOG_ONCE(log_unimpl(_("menushow not yet supported in this GUI")));
+    LOG_ONCE(log_unimpl(_("menushow not yet supported in this GUI")));
 }
 
 void
@@ -240,20 +242,19 @@ void
 Gui::toggleFullscreen()
 {
     /// Sends request to Gnash core to change display state.
-       if (_fullscreen) {
-               _stage->setStageDisplayState(movie_root::DISPLAYSTATE_NORMAL);
-       }
-       else {
-               
_stage->setStageDisplayState(movie_root::DISPLAYSTATE_FULLSCREEN);
-       } 
+    if (_fullscreen) {
+        _stage->setStageDisplayState(movie_root::DISPLAYSTATE_NORMAL);
+    } else {
+        _stage->setStageDisplayState(movie_root::DISPLAYSTATE_FULLSCREEN);
+    } 
 }
 
 void
 Gui::restart()
 {
-       _stage->reset();
-       _started = false;
-       start();
+    _stage->reset();
+    _started = false;
+    start();
 }
 
 void
@@ -289,8 +290,7 @@ Gui::updateStageMatrix()
             // Scale proportionally, using smallest scale
             if (_xscale < _yscale) {
                 _yscale = _xscale;
-            } 
-            else if (_yscale < _xscale) {
+            } else if (_yscale < _xscale) {
                 _xscale = _yscale;
             }
             break;
@@ -303,8 +303,7 @@ Gui::updateStageMatrix()
             // Scale proportionally, using biggest scale
             if (_xscale > _yscale) {
                 _yscale = _xscale;
-            } 
-            else if (_yscale > _xscale) {
+            } else if (_yscale > _xscale) {
                 _xscale = _yscale;
             }
             break;
@@ -330,66 +329,66 @@ Gui::updateStageMatrix()
     
     // Handle horizontal alignment
     switch ( halign ) {
-    case movie_root::STAGE_H_ALIGN_L:
-        {
-            // _xoffset=0 is fine
-            break;
-        }
-        
-    case movie_root::STAGE_H_ALIGN_R:
-        {
-            // Offsets in pixels
-            float defWidth = swfwidth *= _xscale;
-            float diffWidth = _width-defWidth;
-            _xoffset = diffWidth;
-            break;
-        }
+      case movie_root::STAGE_H_ALIGN_L:
+      {
+          // _xoffset=0 is fine
+          break;
+      }
+      
+      case movie_root::STAGE_H_ALIGN_R:
+      {
+          // Offsets in pixels
+          float defWidth = swfwidth *= _xscale;
+          float diffWidth = _width-defWidth;
+          _xoffset = diffWidth;
+          break;
+      }
         
-    case movie_root::STAGE_V_ALIGN_C:
-        {
-            // Offsets in pixels
-            float defWidth = swfwidth *= _xscale;
-            float diffWidth = _width-defWidth;
-            _xoffset = diffWidth/2.0;
-            break;
-        }
+      case movie_root::STAGE_V_ALIGN_C:
+      {
+          // Offsets in pixels
+          float defWidth = swfwidth *= _xscale;
+          float diffWidth = _width-defWidth;
+          _xoffset = diffWidth/2.0;
+          break;
+      }
         
-    default:
-        {
-            log_error("Invalid horizontal align %d", valign);
-            break;
-        }
+      default:
+      {
+          log_error("Invalid horizontal align %d", valign);
+          break;
+      }
     }
     
     // Handle vertical alignment
     switch ( valign ) {
-    case movie_root::STAGE_V_ALIGN_T:
-        {
-            // _yoffset=0 is fine
-            break;
-        }
-        
-    case movie_root::STAGE_V_ALIGN_B:
-        {
-            float defHeight = swfheight *= _yscale;
-            float diffHeight = _height-defHeight;
-            _yoffset = diffHeight;
-            break;
-        }
+      case movie_root::STAGE_V_ALIGN_T:
+      {
+          // _yoffset=0 is fine
+          break;
+      }
+      
+      case movie_root::STAGE_V_ALIGN_B:
+      {
+          float defHeight = swfheight *= _yscale;
+          float diffHeight = _height-defHeight;
+          _yoffset = diffHeight;
+          break;
+      }
         
-    case movie_root::STAGE_V_ALIGN_C:
-        {
-            float defHeight = swfheight *= _yscale;
-            float diffHeight = _height-defHeight;
-            _yoffset = diffHeight/2.0;
-            break;
-        }
+      case movie_root::STAGE_V_ALIGN_C:
+      {
+          float defHeight = swfheight *= _yscale;
+          float diffHeight = _height-defHeight;
+          _yoffset = diffHeight/2.0;
+          break;
+      }
         
-    default:
-        {
-            log_error("Invalid vertical align %d", valign);
-            break;
-        }
+      default:
+      {
+          log_error("Invalid vertical align %d", valign);
+          break;
+      }
     }
     
     //log_debug("updateStageMatrix: scaleMode:%d, valign:%d, halign:%d",
@@ -422,13 +421,15 @@ Gui::resize_view(int width, int height)
         _stage->setDimensions(width, height);
     }
 
-       _width = width;
-       _height = height;
-       _validbounds.setTo(0, 0, _width, _height);
-
-       updateStageMatrix();
-
-       if ( _stage && _started ) display(_stage);
+    _width = width;
+    _height = height;
+    _validbounds.setTo(0, 0, _width, _height);
+    
+    updateStageMatrix();
+    
+    if ( _stage && _started ) {
+        display(_stage);
+    }
 }
 
 
@@ -450,53 +451,44 @@ Gui::toggleSound()
 void
 Gui::notifyMouseMove(int ux, int uy) 
 {
-       movie_root* m = _stage;
-
-       if ( ! _started ) return;
-
-       if ( _stopped ) return;
-
-       // A stage pseudopixel is user pixel / _xscale wide
-       boost::int32_t x = (ux-_xoffset) / _xscale;
-
-       // A stage pseudopixel is user pixel / _xscale high
-       boost::int32_t y = (uy-_yoffset) / _yscale;
-
+    movie_root* m = _stage;
+    
+    if ( ! _started ) return;
+    
+    if ( _stopped ) return;
+    
+    // A stage pseudopixel is user pixel / _xscale wide
+    boost::int32_t x = (ux-_xoffset) / _xscale;
+    
+    // A stage pseudopixel is user pixel / _xscale high
+    boost::int32_t y = (uy-_yoffset) / _yscale;
+    
 #ifdef DEBUG_MOUSE_COORDINATES
-       log_debug(_("mouse @ %d,%d"), x, y);
+    log_debug(_("mouse @ %d,%d"), x, y);
 #endif
-
-       if ( m->mouseMoved(x, y) )
-       {
-               // any action triggered by the
-               // event required screen refresh
-               display(m);
-       }
     
-       DisplayObject* activeEntity = m->getActiveEntityUnderPointer();
-       if ( activeEntity )
-       {
-               if ( activeEntity->isSelectableTextField() )
-               {
-                       setCursor(CURSOR_INPUT);
-               }
-               else if ( activeEntity->allowHandCursor() )
-               {
-                       setCursor(CURSOR_HAND);
-               }
-               else
-               {
-                       setCursor(CURSOR_NORMAL);
-               }
-       }
-       else
-       {
-               setCursor(CURSOR_NORMAL);
-       }
-
+    if ( m->mouseMoved(x, y) ) {
+        // any action triggered by the
+        // event required screen refresh
+        display(m);
+    }
+    
+    DisplayObject* activeEntity = m->getActiveEntityUnderPointer();
+    if ( activeEntity ) {
+        if ( activeEntity->isSelectableTextField() ) {
+            setCursor(CURSOR_INPUT);
+        } else if ( activeEntity->allowHandCursor() ) {
+            setCursor(CURSOR_HAND);
+        } else {
+            setCursor(CURSOR_NORMAL);
+        }
+    } else {
+        setCursor(CURSOR_NORMAL);
+    }
+    
 #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS
-       _xpointer = ux;
-       _ypointer = uy;
+    _xpointer = ux;
+    _ypointer = uy;
 #endif
 
 
@@ -505,33 +497,33 @@ Gui::notifyMouseMove(int ux, int uy)
 void
 Gui::notifyMouseWheel(int delta)
 {
-       movie_root* m = _stage;
-       assert(m);
+    movie_root* m = _stage;
+    assert(m);
 
     if (!_started) return;
     if (_stopped) return;
 
-       if (m->mouseWheel(delta)) {
-               // any action triggered by the
-               // event required screen refresh
-               display(m);
-       }
+    if (m->mouseWheel(delta)) {
+        // any action triggered by the
+        // event required screen refresh
+        display(m);
+    }
 } 
 
 void
 Gui::notifyMouseClick(bool mouse_pressed) 
 {
-       movie_root* m = _stage;
-       assert(m);
+    movie_root* m = _stage;
+    assert(m);
 
     if (!_started) return;
     if (_stopped) return;
 
-       if (m->mouseClick(mouse_pressed)) {
-               // any action triggered by the
-               // event required screen refresh
-               display(m);
-       }
+    if (m->mouseClick(mouse_pressed)) {
+        // any action triggered by the
+        // event required screen refresh
+        display(m);
+    }
 }
 
 void
@@ -551,7 +543,7 @@ void
 Gui::notify_key_event(gnash::key::code k, int modifier, bool pressed) 
 {
 
-       /* Handle GUI shortcuts */
+    // Handle GUI shortcuts
     if (pressed) {
         if (k == gnash::key::ESCAPE) {
             if (isFullscreen()) {
@@ -683,158 +675,153 @@ Gui::display(movie_root* m)
     assert(m == _stage); // why taking this arg ??
 
     assert(_started);
-
-       InvalidatedRanges changed_ranges;
-       bool redraw_flag;
-
-       // Should the frame be rendered completely, even if it did not change?
+    
+    InvalidatedRanges changed_ranges;
+    bool redraw_flag;
+    
+    // Should the frame be rendered completely, even if it did not change?
 #ifdef FORCE_REDRAW
-  redraw_flag = true;
+    redraw_flag = true;
 #else  
-       redraw_flag = _redraw_flag || want_redraw();
+    redraw_flag = _redraw_flag || want_redraw();
 #endif 
+    
+    // reset class member if we do a redraw now
+    if (redraw_flag) _redraw_flag=false;
+    
+    // Find out the surrounding frame of all characters which
+    // have been updated. This just checks what region of the stage has changed
+    // due to ActionScript code, the timeline or user events. The GUI can still
+    // choose to render a different part of the stage. 
+    //
+    if (!redraw_flag) {
+        
+        // choose snapping ranges factor 
+        changed_ranges.setSnapFactor(1.3f);  
        
-       // reset class member if we do a redraw now
-       if (redraw_flag) _redraw_flag=false;
-
-       // Find out the surrounding frame of all characters which
-       // have been updated. This just checks what region of the stage has 
changed
-       // due to ActionScript code, the timeline or user events. The GUI can 
still
-       // choose to render a different part of the stage. 
-       //
-       if (!redraw_flag) {
-               
-               // choose snapping ranges factor 
-               changed_ranges.setSnapFactor(1.3f);  
-                       
-               // Use multi ranges only when GUI/Renderer supports it
-               // (Useless CPU overhead, otherwise)
-               changed_ranges.setSingleMode(!want_multiple_regions());
-
-               // scan through all sprites to compute invalidated bounds  
-               m->add_invalidated_bounds(changed_ranges, false);
-               
-               // grow ranges by a 2 pixels to avoid anti-aliasing issues      
        
-               changed_ranges.growBy(40.0f / _xscale);
-               
-               // optimize ranges
-               changed_ranges.combineRanges();
-               
-       }
+        // Use multi ranges only when GUI/Renderer supports it
+        // (Useless CPU overhead, otherwise)
+        changed_ranges.setSingleMode(!want_multiple_regions());
+        
+        // scan through all sprites to compute invalidated bounds  
+        m->add_invalidated_bounds(changed_ranges, false);
+       
+        // grow ranges by a 2 pixels to avoid anti-aliasing issues             
+        changed_ranges.growBy(40.0f / _xscale);
+       
+        // optimize ranges
+        changed_ranges.combineRanges();        
+    }
     
     // TODO: Remove this and want_redraw to avoid confusion!?
-       if (redraw_flag)  {
-               changed_ranges.setWorld();
-       }
-       
-       // DEBUG ONLY:
-  // This is a good place to inspect the invalidated bounds state. Enable
-  // the following block (and parts of it) if you need to. 
-#if 0
-  {
-    // This may print a huge amount of information, but is useful to analyze
-    // the (visible) object structure of the movie and the flags of the
-    // characters. For example, a characters should have set the 
-    // m_child_invalidated flag if at least one of it's childs has the
-    // invalidated flag set.
-    log_debug("DUMPING CHARACTER TREE"); 
+    if (redraw_flag)  {
+        changed_ranges.setWorld();
+    }
     
-    InfoTree tr;
-    InfoTree::iterator top = tr.begin();
-    _stage->getMovieInfo(tr, top);
-
-    for (InfoTree::iterator i = tr.begin(), e = tr.end();
-            i != e; ++i) {
-        std::cout << std::string(tr.depth(i) * 2, ' ') << i->first << ": " << 
-            i->second << std::endl;
+    // DEBUG ONLY:
+    // This is a good place to inspect the invalidated bounds state. Enable
+    // the following block (and parts of it) if you need to. 
+#if 0
+    {
+        // This may print a huge amount of information, but is useful to 
analyze
+        // the (visible) object structure of the movie and the flags of the
+        // characters. For example, a characters should have set the 
+        // m_child_invalidated flag if at least one of it's childs has the
+        // invalidated flag set.
+        log_debug("DUMPING CHARACTER TREE"); 
+        
+        InfoTree tr;
+        InfoTree::iterator top = tr.begin();
+        _stage->getMovieInfo(tr, top);
+        
+        for (InfoTree::iterator i = tr.begin(), e = tr.end();
+             i != e; ++i) {
+            std::cout << std::string(tr.depth(i) * 2, ' ') << i->first << ": " 
<< 
+                i->second << std::endl;
+        }
+        
+        
+        // less verbose, and often necessary: see the exact coordinates of the
+        // invalidated bounds (mainly to see if it's NULL or something else).  
+        std::cout << "Calculated changed ranges: " << changed_ranges << "\n";
     }
-
-
-    // less verbose, and often necessary: see the exact coordinates of the
-    // invalidated bounds (mainly to see if it's NULL or something else).      
-    std::cout << "Calculated changed ranges: " << changed_ranges << "\n";
-  }
 #endif
-  
-       // Avoid drawing of stopped movies
-       if ( ! changed_ranges.isNull() ) // use 'else'?
-       {
-               // Tell the GUI(!) that we only need to update this
-               // region. Note the GUI can do whatever it wants with
-               // this information. It may simply ignore the bounds
-               // (which will normally lead into a complete redraw),
-               // or it may extend or shrink the bounds as it likes. So,
-               // by calling set_invalidated_bounds we have no guarantee
-               // that only this part of the stage is rendered again.
+    
+    // Avoid drawing of stopped movies
+    if ( ! changed_ranges.isNull() ) { // use 'else'?
+        // Tell the GUI(!) that we only need to update this
+        // region. Note the GUI can do whatever it wants with
+        // this information. It may simply ignore the bounds
+        // (which will normally lead into a complete redraw),
+        // or it may extend or shrink the bounds as it likes. So,
+        // by calling set_invalidated_bounds we have no guarantee
+        // that only this part of the stage is rendered again.
 #ifdef REGION_UPDATES_DEBUGGING_FULL_REDRAW
-               // redraw the full screen so that only the
-               // *new* invalidated region is visible
-               // (helps debugging)
-               InvalidatedRanges world_ranges;
-               world_ranges.setWorld();
-               setInvalidatedRegions(world_ranges);
+        // redraw the full screen so that only the
+        // *new* invalidated region is visible
+        // (helps debugging)
+        InvalidatedRanges world_ranges;
+        world_ranges.setWorld();
+        setInvalidatedRegions(world_ranges);
 #else
-               setInvalidatedRegions(changed_ranges);
+        setInvalidatedRegions(changed_ranges);
 #endif
-
-               // TODO: should this be called even if we're late ?
-               beforeRendering();
-
-               // Render the frame, if not late.
-               // It's up to the GUI/renderer combination
-               // to do any clipping, if desired.     
-               m->display();
-  
-               // show invalidated region using a red rectangle
-               // (Flash debug style)
-               IF_DEBUG_REGION_UPDATES (
-               if (_renderer.get() && !changed_ranges.isWorld())
-               {
-               
-                       for (size_t rno = 0; rno < changed_ranges.size(); 
rno++) {
-                       
-                               const geometry::Range2d<int>& bounds = 
-                                       changed_ranges.getRange(rno);
-
-                               point corners[4];
-                               float xmin = bounds.getMinX();
-                               float xmax = bounds.getMaxX();
-                               float ymin = bounds.getMinY();
-                               float ymax = bounds.getMaxY();
-                               
-                               corners[0].x = xmin;
-                               corners[0].y = ymin;
-                               corners[1].x = xmax;
-                               corners[1].y = ymin;
-                               corners[2].x = xmax;
-                               corners[2].y = ymax;
-                               corners[3].x = xmin;
-                               corners[3].y = ymax;
-                               SWFMatrix no_transform;
-                               _renderer->drawPoly(corners, 4,
+        
+        // TODO: should this be called even if we're late ?
+        beforeRendering();
+        
+        // Render the frame, if not late.
+        // It's up to the GUI/renderer combination
+        // to do any clipping, if desired.     
+        m->display();
+        
+        // show invalidated region using a red rectangle
+        // (Flash debug style)
+        IF_DEBUG_REGION_UPDATES (
+            if (_renderer.get() && !changed_ranges.isWorld()) {
+                for (size_t rno = 0; rno < changed_ranges.size(); rno++) {
+                    const geometry::Range2d<int>& bounds = 
+                        changed_ranges.getRange(rno);
+                    
+                    point corners[4];
+                    float xmin = bounds.getMinX();
+                    float xmax = bounds.getMaxX();
+                    float ymin = bounds.getMinY();
+                    float ymax = bounds.getMaxY();
+                    
+                    corners[0].x = xmin;
+                    corners[0].y = ymin;
+                    corners[1].x = xmax;
+                    corners[1].y = ymin;
+                    corners[2].x = xmax;
+                    corners[2].y = ymax;
+                    corners[3].x = xmin;
+                    corners[3].y = ymax;
+                    SWFMatrix no_transform;
+                    _renderer->drawPoly(corners, 4,
                                        rgba(0,0,0,0), rgba(255,0,0,255), 
no_transform, false);
-                                       
-                       }
-               }
-               );
-
-               // show frame on screen
-               renderBuffer();
+                    
+                }
+            }
+            );
+        
+        // show frame on screen
+        renderBuffer();
        
-       };
-  
-       return true;
+    };
+    
+    return true;
 }
 
 void
 Gui::play()
 {
     if ( ! _stopped ) return;
-
+    
     _stopped = false;
-    if ( ! _started ) start();
-    else
-    {
+    if ( ! _started ) {
+        start();
+    } else {
         assert (_stage);
         // @todo since we registered the sound handler, shouldn't we know
         //       already what it is ?!

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

Summary of changes:
 gui/gui.cpp                         |  519 +++++++++++++++++------------------
 librender/openvg/OpenVGBitmap.cpp   |  101 ++------
 librender/openvg/OpenVGBitmap.h     |   14 +-
 librender/openvg/OpenVGRenderer.cpp |   29 ++-
 4 files changed, 305 insertions(+), 358 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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