]> git.lyx.org Git - features.git/commitdiff
if we can load direct without conversion, then do that.
authorAngus Leeming <leeming@lyx.org>
Thu, 28 Feb 2002 19:55:26 +0000 (19:55 +0000)
committerAngus Leeming <leeming@lyx.org>
Thu, 28 Feb 2002 19:55:26 +0000 (19:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3618 a592a061-630c-0410-9148-cb99ea01b6c8

src/graphics/ChangeLog
src/graphics/GraphicsCacheItem.C

index ba63ef609331f96344c416daf8882ce57deb6617..a6de1db24366a5002f5182b6bcf65519bd780643 100644 (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
index ed69a468e8973507625e3ccb9812629d211cab69..19fdc7bdccbcdc7c40978489eaf335bc77b0d1ae 100644 (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();
+
+       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