From: Angus Leeming Date: Thu, 28 Feb 2002 19:55:26 +0000 (+0000) Subject: if we can load direct without conversion, then do that. X-Git-Tag: 1.6.10~19778 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1bb8334771e55752807458be227154bae29ce657;p=features.git 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 --- diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index ba63ef6093..a6de1db243 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -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 * GraphicsCache.C: improve commentary to graphicsInit and where it diff --git a/src/graphics/GraphicsCacheItem.C b/src/graphics/GraphicsCacheItem.C index ed69a468e8..19fdc7bdcc 100644 --- a/src/graphics/GraphicsCacheItem.C +++ b/src/graphics/GraphicsCacheItem.C @@ -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(); + + FormatList::const_iterator it2 = formats.begin(); + for (; it2 != end; ++it2) { + if (graphics_converter.isReachable(from, *it2)) + return *it2; + } - return *it; + // Failed! + return string(); } } // anon namespace