|
From: <ka...@us...> - 2012-12-28 04:11:48
|
Revision: 7700
http://paintown.svn.sourceforge.net/paintown/?rev=7700&view=rev
Author: kazzmir
Date: 2012-12-28 04:11:41 +0000 (Fri, 28 Dec 2012)
Log Message:
-----------
avoid a call to al_set_target_bitmap if possible
Modified Paths:
--------------
trunk/src/util/graphics/allegro5/bitmap.cpp
Modified: trunk/src/util/graphics/allegro5/bitmap.cpp
===================================================================
--- trunk/src/util/graphics/allegro5/bitmap.cpp 2012-12-27 23:35:03 UTC (rev 7699)
+++ trunk/src/util/graphics/allegro5/bitmap.cpp 2012-12-28 04:11:41 UTC (rev 7700)
@@ -191,10 +191,16 @@
void changeTarget(const Bitmap & from, const Bitmap & who){
/* pray that if drawing is held then who is already the current target */
if (!al_is_bitmap_drawing_held()){
- al_set_target_bitmap(who.getData()->getBitmap());
+ if (al_get_target_bitmap() != who.getData()->getBitmap()){
+ al_set_target_bitmap(who.getData()->getBitmap());
+ }
if ((al_get_bitmap_flags(who.getData()->getBitmap()) & ALLEGRO_VIDEO_BITMAP) &&
(al_get_bitmap_flags(from.getData()->getBitmap()) & ALLEGRO_MEMORY_BITMAP)){
+
((Bitmap&) from).convertToVideo();
+ /* How can from == who? If they were the same then the bitmap flags above
+ * would not have been different.
+ */
if (&from == &who){
al_set_target_bitmap(who.getData()->getBitmap());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|