gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-562-g918cc12
Date: Thu, 21 Jul 2011 13:43:11 +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, master has been updated
       via  918cc12b38e01e6bf6ecadb77b121836f1e8ed04 (commit)
       via  e8f800772566192cbabf0b83f9c9c5014e49992f (commit)
       via  90a59480540682bd997dcb74c3dd2bbbbb3938a4 (commit)
       via  0fddb5bd1cbe5bdd5f961b8a84576c7523a6dc3b (commit)
      from  8129ff420ebf8e4c4667a07d3f5a05503db48a09 (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=918cc12b38e01e6bf6ecadb77b121836f1e8ed04


commit 918cc12b38e01e6bf6ecadb77b121836f1e8ed04
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Jul 21 15:14:36 2011 +0200

    Remove unused variable.

diff --git a/gui/Player.cpp b/gui/Player.cpp
index 4dfe69a..b144fa6 100644
--- a/gui/Player.cpp
+++ b/gui/Player.cpp
@@ -571,7 +571,6 @@ Player::run(int argc, char* argv[], const std::string& 
infile,
 
     it = _params.find("allowscriptaccess");
     if (it != _params.end()) {
-        std::string access = it->second;
         StringNoCaseEqual noCaseCompare;
         const std::string& str = it->second;
                 

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


commit e8f800772566192cbabf0b83f9c9c5014e49992f
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Jul 21 14:48:15 2011 +0200

    Remove another member function.
    
    Make fillRect a non-member function.

diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp 
b/libcore/asobj/flash/display/BitmapData_as.cpp
index bd10e94..7ccff4d 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -124,7 +124,7 @@ namespace {
     /// @param y    The y co-ordinate of the top left corner.
     /// @param w    The width of the rectangle.
     /// @param h    The height of the rectangle.
-    void adjustRect(int& x, int& y, int& w, int& h, BitmapData_as& b);
+    void adjustRect(int& x, int& y, int& w, int& h, const BitmapData_as& b);
 
     boost::uint32_t setChannel(boost::uint32_t targ, boost::uint8_t bitmask,
             boost::uint8_t value);
@@ -134,6 +134,19 @@ namespace {
     void floodFill(const BitmapData_as& bd, size_t startx, size_t starty,
             boost::uint32_t old, boost::uint32_t fill);
 
+    /// Fill a rectangle of the BitmapData_as
+    //
+    /// Do not call on a disposed BitmapData_as!
+    //
+    /// @param bd       The BitmapData_as to operate on.
+    /// @param x        The x co-ordinate of the rectangle's top left corner.
+    /// @param y        The y co-ordinate of the rectangle's top left corner.
+    /// @param w        The width of the rectangle.
+    /// @param h        The height of the rectangle.
+    /// @param color    The ARGB colour to fill with.
+    void fillRect(const BitmapData_as& bd, int x, int y, int w, int h,
+            boost::uint32_t color);
+
     inline bool oneBitSet(boost::uint8_t mask) {
         return mask == (mask & -mask);
     }
@@ -240,7 +253,6 @@ struct CopyChannel
         _destchans(destchans)
     {}
 
-    /// 
     boost::uint32_t operator()(typename iterator_type::value_type p) const {
         // If multiple source channels, we set the destination channel
         // to black. Else to the value of the requested channel.
@@ -611,33 +623,6 @@ BitmapData_as::updateObjects() const
 }
 
 void
-BitmapData_as::fillRect(int x, int y, int w, int h, boost::uint32_t color)
-{
-    if (disposed()) return;
-
-    adjustRect(x, y, w, h, *this);
-
-    // Make sure that the rectangle has some area in the 
-    // bitmap and that its bottom corner is within the
-    // the bitmap.    
-    if (w == 0 || h == 0) return;
-    
-    iterator it = begin() + y * width();
-    iterator e = it + width() * h;
-    
-    assert(e <= end());
-
-    while (it != e) {
-        // Fill from x for the width of the rectangle.
-        std::fill_n(it + x, w, color);
-        it += width();
-    }
-
-    updateObjects();
-
-}
-
-void
 BitmapData_as::dispose()
 {
     if (_cachedBitmap) _cachedBitmap->dispose();
@@ -904,59 +889,6 @@ bitmapdata_copyChannel(const fn_call& fn)
     return as_value();
 }
 
-boost::uint8_t
-getChannel(boost::uint32_t src, boost::uint8_t bitmask)
-{
-    if (bitmask & BitmapData_as::CHANNEL_RED) {
-        // Red
-        return (src >> 16) & 0xff;
-    }
-    if (bitmask & BitmapData_as::CHANNEL_GREEN) {
-        // Green
-        return (src >> 8) & 0xff;
-    }
-    if (bitmask & BitmapData_as::CHANNEL_BLUE) {
-        // Blue
-        return src & 0xff;
-    }
-    if (bitmask & BitmapData_as::CHANNEL_ALPHA) {
-        // Alpha
-        return src >> 24;
-    }
-    return 0;
-}
-
-boost::uint32_t
-setChannel(boost::uint32_t targ, boost::uint8_t bitmask, boost::uint8_t value)
-{
-    boost::uint32_t bytemask = 0;
-    boost::uint32_t valmask = 0;
-    if (bitmask & BitmapData_as::CHANNEL_RED) {
-        // Red
-        bytemask = 0xff0000;
-        valmask = value << 16;
-    }
-    else if (bitmask & BitmapData_as::CHANNEL_GREEN) {
-        // Green
-        bytemask = 0xff00;
-        valmask = value << 8;
-    }
-    else if (bitmask & BitmapData_as::CHANNEL_BLUE) {
-        // Blue
-        bytemask = 0xff;
-        valmask = value;
-    }
-    else if (bitmask & BitmapData_as::CHANNEL_ALPHA) {
-        // Alpha
-        bytemask = 0xff000000;
-        valmask = value << 24;
-    }
-    targ &= ~bytemask;
-    targ |= valmask;
-    return targ;
-}
-
-
 // sourceBitmap: BitmapData,
 // sourceRect: Rectangle,
 // destPoint: Point,
@@ -1165,7 +1097,7 @@ bitmapdata_fillRect(const fn_call& fn)
 {
     BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
 
-    if (fn.nargs < 2) return as_value();
+    if (fn.nargs < 2 || ptr->disposed()) return as_value();
     
     const as_value& arg = fn.arg(0);
     
@@ -1192,7 +1124,7 @@ bitmapdata_fillRect(const fn_call& fn)
 
     const boost::uint32_t color = toInt(fn.arg(1), getVM(fn));
        
-    ptr->fillRect(toInt(x, getVM(fn)), toInt(y, getVM(fn)),
+    fillRect(*ptr, toInt(x, getVM(fn)), toInt(y, getVM(fn)),
             toInt(w, getVM(fn)), toInt(h, getVM(fn)), color);
     
     return as_value();
@@ -1830,6 +1762,32 @@ setPixel32(const BitmapData_as& bd, size_t x, size_t y, 
boost::uint32_t color)
 }
 
 void
+fillRect(const BitmapData_as& bd, int x, int y, int w, int h,
+        boost::uint32_t color)
+{
+    adjustRect(x, y, w, h, bd);
+
+    // Make sure that the rectangle has some area in the 
+    // bitmap and that its bottom corner is within the
+    // the bitmap.    
+    if (w == 0 || h == 0) return;
+    
+    const size_t width = bd.width();
+
+    BitmapData_as::iterator it = bd.begin() + y * width;
+    BitmapData_as::iterator e = it + width * h;
+    
+    assert(e <= bd.end());
+
+    while (it != e) {
+        // Fill from x for the width of the rectangle.
+        std::fill_n(it + x, w, color);
+        it += width;
+    }
+    bd.updateObjects();
+}
+
+void
 floodFill(const BitmapData_as& bd, size_t startx, size_t starty,
         boost::uint32_t old, boost::uint32_t fill)
 {
@@ -1910,7 +1868,7 @@ floodFill(const BitmapData_as& bd, size_t startx, size_t 
starty,
 }
 
 void
-adjustRect(int& x, int& y, int& w, int& h, BitmapData_as& b) 
+adjustRect(int& x, int& y, int& w, int& h, const BitmapData_as& b) 
 {
     // No negative width or height
     if (w < 0 || h < 0) {
@@ -1946,5 +1904,58 @@ adjustRect(int& x, int& y, int& w, int& h, 
BitmapData_as& b)
 }
 
 
+boost::uint8_t
+getChannel(boost::uint32_t src, boost::uint8_t bitmask)
+{
+    if (bitmask & BitmapData_as::CHANNEL_RED) {
+        // Red
+        return (src >> 16) & 0xff;
+    }
+    if (bitmask & BitmapData_as::CHANNEL_GREEN) {
+        // Green
+        return (src >> 8) & 0xff;
+    }
+    if (bitmask & BitmapData_as::CHANNEL_BLUE) {
+        // Blue
+        return src & 0xff;
+    }
+    if (bitmask & BitmapData_as::CHANNEL_ALPHA) {
+        // Alpha
+        return src >> 24;
+    }
+    return 0;
+}
+
+boost::uint32_t
+setChannel(boost::uint32_t targ, boost::uint8_t bitmask, boost::uint8_t value)
+{
+    boost::uint32_t bytemask = 0;
+    boost::uint32_t valmask = 0;
+    if (bitmask & BitmapData_as::CHANNEL_RED) {
+        // Red
+        bytemask = 0xff0000;
+        valmask = value << 16;
+    }
+    else if (bitmask & BitmapData_as::CHANNEL_GREEN) {
+        // Green
+        bytemask = 0xff00;
+        valmask = value << 8;
+    }
+    else if (bitmask & BitmapData_as::CHANNEL_BLUE) {
+        // Blue
+        bytemask = 0xff;
+        valmask = value;
+    }
+    else if (bitmask & BitmapData_as::CHANNEL_ALPHA) {
+        // Alpha
+        bytemask = 0xff000000;
+        valmask = value << 24;
+    }
+    targ &= ~bytemask;
+    targ |= valmask;
+    return targ;
+}
+
+
 } // anonymous namespace
 } // end of gnash namespace
diff --git a/libcore/asobj/flash/display/BitmapData_as.h 
b/libcore/asobj/flash/display/BitmapData_as.h
index ddf1e1f..aae03c5 100644
--- a/libcore/asobj/flash/display/BitmapData_as.h
+++ b/libcore/asobj/flash/display/BitmapData_as.h
@@ -112,11 +112,6 @@ public:
         return _cachedBitmap.get();
     }
 
-    /// Fill the bitmap with a colour starting at x, y
-    //
-    /// Negative values are handled correctly.
-    void fillRect(int x, int y, int w, int h, boost::uint32_t color);
-
     /// Free the bitmap data
     //
     /// This potentially frees the data.

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


commit 90a59480540682bd997dcb74c3dd2bbbbb3938a4
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Jul 21 14:33:09 2011 +0200

    More documentation and cleanup.
    
    Make floodFill non-member function. Improve documentation of
    BitmapData_as, especially cost of access. Store more data in functions
    to avoid very frequent calls to data().

diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp 
b/libcore/asobj/flash/display/BitmapData_as.cpp
index 53107a3..bd10e94 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -131,6 +131,9 @@ namespace {
 
     boost::uint8_t getChannel(boost::uint32_t src, boost::uint8_t bitmask);
 
+    void floodFill(const BitmapData_as& bd, size_t startx, size_t starty,
+            boost::uint32_t old, boost::uint32_t fill);
+
     inline bool oneBitSet(boost::uint8_t mask) {
         return mask == (mask & -mask);
     }
@@ -584,7 +587,7 @@ BitmapData_as::BitmapData_as(as_object* owner,
     _cachedBitmap(0)
 {
     assert(im->width() <= 2880);
-    assert(im->width() <= 2880);
+    assert(im->height() <= 2880);
     
     // If there is a renderer, cache the image there, otherwise we store it.
     Renderer* r = getRunResources(*_owner).renderer();
@@ -601,7 +604,7 @@ BitmapData_as::setReachable()
 }
 
 void
-BitmapData_as::updateObjects()
+BitmapData_as::updateObjects() const
 {
     std::for_each(_attachedObjects.begin(), _attachedObjects.end(),
             std::mem_fun(&DisplayObject::update));
@@ -667,84 +670,6 @@ BitmapData_as::draw(MovieClip& mc, const Transform& 
transform)
     updateObjects();
 }
 
-void
-BitmapData_as::floodFill(size_t startx, size_t starty, boost::uint32_t old,
-        boost::uint32_t fill)
-{
-    if (startx >= width() || starty >= height()) return;
-
-    // We never compare alpha for RGB images.
-    if (!transparent()) fill |= 0xff000000;
-    if (old == fill) return;
-
-    std::queue<PixelIndexer> pixelQueue;
-    pixelQueue.push(
-            PixelIndexer(startx, starty, pixelAt(*this, startx, starty)));
-
-    while (!pixelQueue.empty()) {
-
-        const PixelIndexer& p = pixelQueue.front();
-        const size_t x = p.x;
-        const size_t y = p.y;
-        iterator pix = p.pix;
-
-        pixelQueue.pop();
-
-        assert(pix != end());
-
-        if (*pix != old) continue;
-
-        // Go east!
-        iterator east(pix);
-        if (x + 1 < width()) {
-            ++east;
-            const iterator eaststop(pix + (width() - x));
-            while (east != eaststop && *east == old) ++east;
-            std::fill(pix, east, fill);
-        }
-        size_t edone = (east - pix);
-        if (!edone) ++edone;
-
-        // Add north pixels
-        if (y > 0) {
-            iterator north(pix - width());
-            iterator northend(north + edone);
-            const size_t ny = y - 1;
-            for (size_t nx = x; nx != (x + edone); ++nx, ++north) {
-                if (*north == old) {
-                    pixelQueue.push(PixelIndexer(nx, ny, north));
-                }
-            }
-        }
-
-        // Go west!
-        iterator west(pix);
-        if (x > 0) {
-            --west;
-            const iterator weststop(pix - x);
-            while (west != weststop && *west == old) --west;
-            std::fill(west + 1, pix, fill);
-        }
-        size_t wdone = (pix - west);
-        if (!wdone) ++wdone;
-         
-        // Add south pixels
-        if (y + 1 < height()) {
-            iterator south(pix + width());
-            iterator southend(south - wdone);
-            const size_t sy = y + 1;
-            for (size_t sx = x; sx != x - wdone; --sx, --south) {
-                if (*south == old) {
-                    pixelQueue.push(PixelIndexer(sx, sy, south));
-                }
-            }
-        }
-
-    }
-
-    updateObjects();
-}
-
 // extern 
 void
 bitmapdata_class_init(as_object& where, const ObjectURI& uri)
@@ -960,6 +885,9 @@ bitmapdata_copyChannel(const fn_call& fn)
     typedef CopyChannel<BitmapData_as::iterator> Copier;
     Copier c(multiple, srcchans, destchans);
 
+    const size_t ourwidth = ptr->width();
+    const size_t srcwidth = source->width();
+
     // Note that copying the same channel to a range starting in the
     // source range produces unexpected effects because the source
     // range is changed while it is being copied. This is verified
@@ -967,8 +895,8 @@ bitmapdata_copyChannel(const fn_call& fn)
     for (int i = 0; i < destH; ++i) {
         Copier::iterator_type zip(boost::make_tuple(src, targ));
         std::transform(zip, zip + destW, targ, c);
-        targ += ptr->width();
-        src += source->width();
+        targ += ourwidth;
+        src += srcwidth;
     }
 
     ptr->updateObjects();
@@ -1132,6 +1060,9 @@ bitmapdata_copyPixels(const fn_call& fn)
     assert(destX + destW <= static_cast<int>(ptr->width()));
     assert(destY + destH <= static_cast<int>(ptr->height()));
 
+    const size_t ourwidth = ptr->width();
+    const size_t srcwidth = source->width();
+
     // Copy for the width and height of the *dest* image.
     // We have already ensured that the copied area
     // is inside both bitmapdatas.
@@ -1142,8 +1073,8 @@ bitmapdata_copyPixels(const fn_call& fn)
     // right to left.
     if (copyToYRange) {
         assert(destH > 0);
-        targ += (destH - 1) * ptr->width();
-        src += (destH - 1) * source->width();
+        targ += (destH - 1) * ourwidth;
+        src += (destH - 1) * srcwidth;
         // Copy from bottom to top.
         for (int i = destH; i > 0; --i) {
             if (copyToXRange) {
@@ -1152,8 +1083,8 @@ bitmapdata_copyPixels(const fn_call& fn)
             else {
                 std::copy(src, src + destW, targ);
             }
-            targ -= ptr->width();
-            src -= source->width();
+            targ -= ourwidth;
+            src -= srcwidth;
         }
     }
     else {
@@ -1165,8 +1096,8 @@ bitmapdata_copyPixels(const fn_call& fn)
             else {
                 std::copy(src, src + destW, targ);
             }
-            targ += ptr->width();
-            src += source->width();
+            targ += ourwidth;
+            src += srcwidth;
         }
     }
 
@@ -1296,7 +1227,7 @@ bitmapdata_floodFill(const fn_call& fn)
     const boost::uint32_t old = *pixelAt(*ptr, x, y);
 
     // This checks whether the colours are the same.
-    ptr->floodFill(x, y, old, fill);
+    floodFill(*ptr, x, y, old, fill);
     
     return as_value();
 }
@@ -1865,8 +1796,9 @@ attachBitmapDataStaticProperties(as_object& o)
 BitmapData_as::iterator
 pixelAt(const BitmapData_as& bd, size_t x, size_t y)
 {
-    if (x >= bd.width() || y >= bd.height()) return bd.end();
-    return (bd.begin() + y * bd.width() + x);
+    const size_t width = bd.width();
+    if (x >= width || y >= bd.height()) return bd.end();
+    return (bd.begin() + y * width + x);
 }
 
 boost::uint32_t
@@ -1898,6 +1830,86 @@ setPixel32(const BitmapData_as& bd, size_t x, size_t y, 
boost::uint32_t color)
 }
 
 void
+floodFill(const BitmapData_as& bd, size_t startx, size_t starty,
+        boost::uint32_t old, boost::uint32_t fill)
+{
+    const size_t width = bd.width();
+    const size_t height = bd.height();
+
+    if (startx >= width || starty >= height) return;
+
+    // We never compare alpha for RGB images.
+    if (!bd.transparent()) fill |= 0xff000000;
+    if (old == fill) return;
+
+    std::queue<PixelIndexer> pixelQueue;
+    pixelQueue.push(PixelIndexer(startx, starty, pixelAt(bd, startx, starty)));
+
+    while (!pixelQueue.empty()) {
+
+        const PixelIndexer& p = pixelQueue.front();
+        const size_t x = p.x;
+        const size_t y = p.y;
+        BitmapData_as::iterator pix = p.pix;
+
+        pixelQueue.pop();
+
+        assert(pix != bd.end());
+
+        if (*pix != old) continue;
+
+        // Go east!
+        BitmapData_as::iterator east(pix);
+        if (x + 1 < width) {
+            ++east;
+            const BitmapData_as::iterator eaststop(pix + (width - x));
+            while (east != eaststop && *east == old) ++east;
+            std::fill(pix, east, fill);
+        }
+        size_t edone = (east - pix);
+        if (!edone) ++edone;
+
+        // Add north pixels
+        if (y > 0) {
+            BitmapData_as::iterator north(pix - width);
+            BitmapData_as::iterator northend(north + edone);
+            const size_t ny = y - 1;
+            for (size_t nx = x; nx != (x + edone); ++nx, ++north) {
+                if (*north == old) {
+                    pixelQueue.push(PixelIndexer(nx, ny, north));
+                }
+            }
+        }
+
+        // Go west!
+        BitmapData_as::iterator west(pix);
+        if (x > 0) {
+            --west;
+            const BitmapData_as::iterator weststop(pix - x);
+            while (west != weststop && *west == old) --west;
+            std::fill(west + 1, pix, fill);
+        }
+        size_t wdone = (pix - west);
+        if (!wdone) ++wdone;
+         
+        // Add south pixels
+        if (y + 1 < height) {
+            BitmapData_as::iterator south(pix + width);
+            BitmapData_as::iterator southend(south - wdone);
+            const size_t sy = y + 1;
+            for (size_t sx = x; sx != x - wdone; --sx, --south) {
+                if (*south == old) {
+                    pixelQueue.push(PixelIndexer(sx, sy, south));
+                }
+            }
+        }
+
+    }
+
+    bd.updateObjects();
+}
+
+void
 adjustRect(int& x, int& y, int& w, int& h, BitmapData_as& b) 
 {
     // No negative width or height
diff --git a/libcore/asobj/flash/display/BitmapData_as.h 
b/libcore/asobj/flash/display/BitmapData_as.h
index 15ae82e..ddf1e1f 100644
--- a/libcore/asobj/flash/display/BitmapData_as.h
+++ b/libcore/asobj/flash/display/BitmapData_as.h
@@ -48,8 +48,18 @@ namespace gnash {
 
 /// Implements the BitmapData native type.
 //
-/// All functions can be called if the BitmapData has been disposed. Callers
-/// do not need to check.
+/// This class gives access to a Bitmap that may be attached to a MovieClip
+/// and rendered directly. The underlying data may therefore be stored
+/// in a Renderer, for instance, and only retrieved from there when a
+/// BitmapData instance requires access to it.
+//
+/// Because this retrieval can be expensive, it is advisable not to call
+/// member functions frequently, but rather to access the data through
+/// iterators. To facilitate this, iterators are random access.
+//
+/// There is also overhead to calling functions such as width() and height(),
+/// again because the image data is retrieve from the Renderer. The size is
+/// immutable, so these dimensions can safely be cached.
 class BitmapData_as : public Relay
 {
 public:
@@ -87,11 +97,17 @@ public:
         return data()->height();
     }
 
+    /// Whether the BitmapData_as has transparency.
+    //
+    /// Do not call if disposed!
     bool transparent() const {
         assert(data());
         return (data()->type() == image::TYPE_RGBA);
     }
 
+    /// Return the image data
+    //
+    /// This is only for use by containes
     const CachedBitmap* bitmapInfo() const {
         return _cachedBitmap.get();
     }
@@ -101,10 +117,9 @@ public:
     /// Negative values are handled correctly.
     void fillRect(int x, int y, int w, int h, boost::uint32_t color);
 
-    void floodFill(size_t x, size_t y, boost::uint32_t old,
-            boost::uint32_t fill);
-    
     /// Free the bitmap data
+    //
+    /// This potentially frees the data.
     void dispose();
     
     /// Draw a MovieClip to a BitmapData
@@ -121,22 +136,29 @@ public:
     virtual void setReachable();
 
     /// Whether the BitmapData has been disposed.
+    //
+    /// Any callers requiring access to the data or any properties should
+    /// check that this is false first. Particularly width(), height(), 
+    /// transparent(), begin(), end() may only be called if the BitmapData_as
+    /// has not been disposed.
     bool disposed() const {
         return !data();
     }
  
+    /// Return a BitmapData_as::iterator to the first pixel in the data.
     iterator begin() const {
         assert(!disposed());
         return image::begin<image::ARGB>(*data());
     }
     
+    /// Return a BitmapData_as::iterator to a one-past-the end pixel.
     iterator end() const {
         assert(!disposed());
         return image::end<image::ARGB>(*data());
     }
 
     /// Inform any attached objects that the data has changed.
-    void updateObjects();
+    void updateObjects() const;
 
 private:
     

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


commit 0fddb5bd1cbe5bdd5f961b8a84576c7523a6dc3b
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Jul 21 13:59:08 2011 +0200

    Documentation.

diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp 
b/libcore/asobj/flash/display/BitmapData_as.cpp
index ed40e14..53107a3 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -425,7 +425,16 @@ struct Point
 struct
 PointTransformer
 {
+    /// Construct a PointTransformer for an x by y grid.
+    //
+    /// @param x    The product of the grid size and the x base.
+    /// @param y    The product of the grid size and the y base.
     PointTransformer(size_t x, size_t y) : _x(x), _y(y) {}
+
+    /// Get a point within the grid.
+    //
+    /// Positive co-ordinates are left unchanged, negative ones translated
+    /// to an offset from the end of the grid.
     Point operator()(Point const& p) const {
         if (p.x >= 0 && p.y >= 0) return p;
         const int x = p.x > 0 ? p.x : _x - std::abs(p.x) % _x;
@@ -435,13 +444,27 @@ PointTransformer
 private:
     const size_t _x;
     const size_t _y;
-
 };
 
 /// Adapt the PerlinNoise generator for ActionScript's needs.
+//
+/// @tparam Generator   A type with a double operator()(size_t, size_t, size_t)
+///                     that returns a perlin noise value when passed two
+///                     positive co-ordinates and a sequence offset value.
 template<typename Generator>
 struct PerlinAdapter
 {
+    /// Create an adapter for Perlin noise.
+    //
+    /// @param g        The PerlinNoise generator.
+    /// @param octaves  The number of octaves to generate
+    /// @param baseX    The scale of the grid along the X axis.
+    /// @param baseY    The scale of the grid along the Y axis.
+    /// @param fractal  Whether to apply |f(n)| (false) or f(n) (true) to
+    ///                 the colour values.
+    /// @param offsets  A vector of offsets; each element applies to a
+    ///                 successive octave. Any remaining octaves will have no
+    ///                 offset applied.
     PerlinAdapter(Generator& g, size_t octaves, double baseX, double baseY,
             bool fractal, const std::vector<Point>& offsets)
         :
@@ -451,13 +474,18 @@ struct PerlinAdapter
         _baseY(baseY),
         _fractal(fractal)
     {
-        /// Make sure all offsets represent a valid positive value.
+        // Make sure all offsets represent a valid positive value within
+        // the grid.
         std::transform(offsets.begin(), offsets.end(), 
                 std::back_inserter(_offsets),
                 PointTransformer(_baseX * _gen.size(), _baseY * _gen.size()));
     }
 
-    ///
+    /// Return a noise value for the co-ordinate (x, y).
+    //
+    /// Optionally you can pass a sequence offset so that the noise pattern
+    /// is overlaid at an offset; this means that the same generator can be
+    /// used for several channels without them appearing to be the same.
     //
     /// Fractal noise adds f(i * freq) * amp to the mid value.
     /// Normal noise adds |f(i * freq) * amp| to 0.

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

Summary of changes:
 gui/Player.cpp                                |    1 -
 libcore/asobj/flash/display/BitmapData_as.cpp |  409 ++++++++++++++-----------
 libcore/asobj/flash/display/BitmapData_as.h   |   39 ++-
 3 files changed, 258 insertions(+), 191 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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