From 1338de1ea21d84114dc89e853e1d674e9672ae67 Mon Sep 17 00:00:00 2001
From: Gwenole Beauchesne
Date: Thu, 5 Aug 2010 12:35:49 +0200
Subject: [PATCH] Fix build with older Boost version (< 1.36).
---
libcore/asobj/flash/display/BitmapData_as.cpp | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp b/libcore/asobj/flash/display/BitmapData_as.cpp
index 2da403b..996abd4 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -79,6 +79,25 @@ namespace {
}
+static inline void reset(boost::intrusive_ptr &lhs,
+ CachedBitmap *rhs = 0)
+{
+ if (rhs) {
+#if BOOST_VERSION < 103500 /* 1.35.0 */
+ boost::intrusive_ptr(rhs).swap(lhs);
+#else
+ lhs.reset(rhs);
+#endif
+ }
+ else {
+#if BOOST_VERSION < 103600 /* 1.36.0 */
+ boost::intrusive_ptr().swap(lhs);
+#else
+ lhs.reset();
+#endif
+ }
+}
+
BitmapData_as::BitmapData_as(as_object* owner, std::auto_ptr im,
boost::uint32_t fillColor)
:
@@ -92,7 +111,7 @@ BitmapData_as::BitmapData_as(as_object* owner, std::auto_ptr im,
// If there is a renderer, cache the image there, otherwise we store it.
Renderer* r = getRunResources(*_owner).renderer();
- if (r) _cachedBitmap.reset(r->createCachedBitmap(im));
+ if (r) reset(_cachedBitmap, r->createCachedBitmap(im));
else _image.reset(im.release());
}
@@ -194,7 +213,7 @@ void
BitmapData_as::dispose()
{
if (_cachedBitmap) _cachedBitmap->dispose();
- _cachedBitmap.reset();
+ reset(_cachedBitmap);
_image.reset();
updateObjects();
}
--
1.5.4.3