<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Destroying sub bitmaps?</title>
		<link>http://www.allegro.cc/forums/view/610726</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 31 Jul 2012 10:26:28 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What happens when you destroy a sub-bitmap? Is destroying sub-bitmaps necessary?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Itachihro)</author>
		<pubDate>Mon, 30 Jul 2012 18:48:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/610726/961604#target">Itachihro</a> said:</div><div class="quote"><p>What happens when you destroy a sub-bitmap?</p></div></div><p>
The sub bitmap is destroyed. The parent bitmap is untouched.
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Is destroying sub-bitmaps necessary?</p></div></div><p>
Yes.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Mon, 30 Jul 2012 18:54:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well damn, in that case I somehow need a special case for handling sub-bitmaps in my sprite managers. I knew this wasn&#39;t going to be quite as easy as I thought it would.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Itachihro)</author>
		<pubDate>Mon, 30 Jul 2012 18:57:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Maybe this will help: <span class="source-code"><a href="http://www.allegro.cc/manual/al_is_sub_bitmap"><span class="a">al_is_sub_bitmap</span></a><span class="k2">(</span><span class="k2">)</span></span>. Otherwise, not sure what you could be doing that would be difficult to deal with.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Todd Cope)</author>
		<pubDate>Mon, 30 Jul 2012 23:12:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m managing my resources with smart pointers, so for sub bitmaps I have to keep a reference to the parent bitmap (so it doesn&#39;t get destroyed prematurely) as well as to the actual sub bitmap, so it made it a little less pleasant (I previously hoped I&#39;d get away with ignoring the differences between the two) (I ended up writing subclasses for both cases, and then wrapping those in another class to hide pointer usage).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Itachihro)</author>
		<pubDate>Tue, 31 Jul 2012 01:26:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Perhaps you could maintain an array of pointers to reference which sub-bitmaps have branched from a parent one? Or a basic reference counter, one of the two. That way if you need to destroy a parent bitmap for whatever reason, it won&#39;t happen if it&#39;s in use.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Temia Eszteri)</author>
		<pubDate>Tue, 31 Jul 2012 10:26:28 +0000</pubDate>
	</item>
</rss>
