if we can load direct without conversion, then do that.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3618 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-02-28 19:55:26 +00:00
parent 23a28bf25b
commit 1bb8334771
2 changed files with 18 additions and 9 deletions

View File

@ -12,6 +12,9 @@
* GraphicsImageXPM.C (copy c-tor): don't copy pixmap.
* GraphicsCacheItem.C (findTargetFormat): if we can load direct without
conversion, then do that.
2002-02-27 Angus Leeming <a.leeming@ic.ac.uk>
* GraphicsCache.C: improve commentary to graphicsInit and where it

View File

@ -401,19 +401,25 @@ string const findTargetFormat(string const & from)
// There must be a format to load from.
lyx::Assert(!formats.empty());
grfx::GConverter const & graphics_converter = grfx::GConverter::get();
FormatList::const_iterator it = formats.begin();
// First ascertain if we can load directly with no conversion
FormatList::const_iterator it1 = formats.begin();
FormatList::const_iterator end = formats.end();
for (; it != end; ++it) {
if (graphics_converter.isReachable(from, *it))
break;
for (; it1 != end; ++it1) {
if (from == *it1)
return *it1;
}
if (it == end)
return string();
// So, we have to convert to a loadable format. Can we?
grfx::GConverter const & graphics_converter = grfx::GConverter::get();
return *it;
FormatList::const_iterator it2 = formats.begin();
for (; it2 != end; ++it2) {
if (graphics_converter.isReachable(from, *it2))
return *it2;
}
// Failed!
return string();
}
} // anon namespace