Cache each image file only once, even if it is used multiple times.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 3 Dec 2007 18:25:49 +0000 (18:25 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 3 Dec 2007 18:25:49 +0000 (18:25 +0000)
git-svn-id: http://svn.voria.com/code@1175 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/listimporter.cpp
synfig-core/trunk/src/synfig/listimporter.h

index 11b59ea..30bb899 100644 (file)
@@ -112,10 +112,10 @@ ListImporter::get_frame(Surface &surface,Time time, ProgressCallback *cb)
 
 //                     DEBUGPOINT();
        // See if that frame is cached
-       std::list<std::pair<int,Surface> >::iterator iter;
+       std::list<std::pair<String,Surface> >::iterator iter;
        for(iter=frame_cache.begin();iter!=frame_cache.end();++iter)
        {
-               if(iter->first==frame)
+               if(iter->first==filename_list[frame])
                {
 //                     DEBUGPOINT();
                        surface.mirror(iter->second);
@@ -150,7 +150,7 @@ ListImporter::get_frame(Surface &surface,Time time, ProgressCallback *cb)
 
 //     DEBUGPOINT();
 
-       frame_cache.push_back(std::pair<int,Surface>(frame,surface));
+       frame_cache.push_back(std::pair<String,Surface>(filename_list[frame],surface));
 
 //     DEBUGPOINT();
 
index 5cd1b2b..84d5179 100644 (file)
@@ -50,7 +50,7 @@ class ListImporter : public Importer
 {
        float fps;
        std::vector<String> filename_list;
-       std::list<std::pair<int,Surface> > frame_cache;
+       std::list<std::pair<String,Surface> > frame_cache;
 protected:
        ListImporter(const String &filename);