Index: sprite.cpp =================================================================== RCS file: /var/lib/cvs/Libs/ClanLib-0.7/Sources/Display/sprite.cpp,v retrieving revision 1.64 diff -u -r1.64 sprite.cpp --- sprite.cpp 21 Jan 2004 02:54:22 -0000 1.64 +++ sprite.cpp 24 Jan 2004 21:33:56 -0000 @@ -198,40 +198,29 @@ // Create SpriteFrames const std::list &frames = spritedescription.get_frames(); std::list::const_iterator it_frames; - - // Lock all pixelbuffers to avoid multiple loadings of same pb's: - for (it_frames = frames.begin(); it_frames != frames.end(); ++it_frames) - { - CL_PixelBuffer *buffer = (*it_frames).first; - buffer->lock(); - } - -// CL_Log::log("debug", "New sprite:"); - CL_PixelBuffer *buf = NULL; + std::map surfaces; for(it_frames = frames.begin(); it_frames != frames.end(); ++it_frames) - { - if ((*it_frames).first != buf) + { + CL_Sprite_Generic::SpriteFrame frame; + + std::map::iterator i = surfaces.find((*it_frames).first); + if (i == surfaces.end()) { - buf = (*it_frames).first; -// CL_Log::log("debug", "- Unpacked texture %1x%2", buf->get_width(), buf->get_height()): + frame.surface = CL_Surface((*it_frames).first); + surfaces[(*it_frames).first] = frame.surface; } - - CL_Sprite_Generic::SpriteFrame frame; - frame.surface = (*it_frames).first; + else + { + frame.surface = i->second; + } + frame.position = (*it_frames).second; frame.delay = 0.06f; impl->frames.push_back(frame); } - - // Unlock all pixelbuffers: - for (it_frames = frames.begin(); it_frames != frames.end(); ++it_frames) - { - CL_PixelBuffer *buffer = (*it_frames).first; - buffer->unlock(); - } } restart();