X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Flistimporter.cpp;h=6245b997d5329995ce002f0b0f688de6b5b379a7;hb=34d470416675482ca866146fd6b3201a19f8e4e6;hp=a2c14f7a1b9d8496a533140100d0c0116cb10a32;hpb=28f28705612902c15cd0702cc891fba35bf2d2df;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/listimporter.cpp b/synfig-core/trunk/src/synfig/listimporter.cpp index a2c14f7..6245b99 100644 --- a/synfig-core/trunk/src/synfig/listimporter.cpp +++ b/synfig-core/trunk/src/synfig/listimporter.cpp @@ -2,19 +2,20 @@ /*! \file listimporter.cpp ** \brief Template File ** -** $Id: listimporter.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -62,7 +63,7 @@ ListImporter::ListImporter(const String &filename) return; } String line; - String prefix=etl::dirname(filename)+ETL_DIRECTORY_SEPERATOR; + String prefix=etl::dirname(filename)+ETL_DIRECTORY_SEPARATOR; while(!stream.eof()) { getline(stream,line); @@ -94,37 +95,30 @@ ListImporter::~ListImporter() bool ListImporter::get_frame(Surface &surface,Time time, ProgressCallback *cb) { -// DEBUGPOINT(); - int frame=static_cast(time*fps); -// DEBUGPOINT(); - + int frame=round_to_int(time*fps); + if(!filename_list.size()) { if(cb)cb->error(_("No images in list")); else synfig::error(_("No images in list")); return false; } - -// DEBUGPOINT(); + if(frame<0)frame=0; if(frame>=(signed)filename_list.size())frame=filename_list.size()-1; - -// DEBUGPOINT(); + // See if that frame is cached - std::list >::iterator iter; + std::list >::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); return static_cast(surface); } } - + Importer::Handle importer(Importer::open(filename_list[frame])); - -// DEBUGPOINT(); if(!importer) { @@ -132,8 +126,6 @@ ListImporter::get_frame(Surface &surface,Time time, ProgressCallback *cb) else synfig::error(_("Unable to open ")+filename_list[frame]); return false; } - -// DEBUGPOINT(); if(!importer->get_frame(surface,0,cb)) { @@ -141,22 +133,14 @@ ListImporter::get_frame(Surface &surface,Time time, ProgressCallback *cb) else synfig::error(_("Unable to get frame from ")+filename_list[frame]); return false; } - -// DEBUGPOINT(); if(frame_cache.size()>=LIST_IMPORTER_CACHE_SIZE) frame_cache.pop_front(); -// DEBUGPOINT(); - - frame_cache.push_back(std::pair(frame,surface)); - -// DEBUGPOINT(); + frame_cache.push_back(std::pair(filename_list[frame],surface)); surface.mirror(frame_cache.back().second); -// DEBUGPOINT(); - return static_cast(surface); }