]> git.lyx.org Git - features.git/commitdiff
fix http://bugzilla.lyx.org/show_bug.cgi?id=5002
authorAbdelrazak Younes <younes@lyx.org>
Wed, 16 Jul 2008 09:43:46 +0000 (09:43 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 16 Jul 2008 09:43:46 +0000 (09:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25659 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiImage.cpp
src/frontends/qt4/GuiImage.h

index 3af803831f2500f8d1bfaf77842922e3e2991662..2e83bd63909631738e739a830c67d5aa4d400278 100644 (file)
@@ -70,7 +70,9 @@ bool GuiImage::load(FileName const & filename)
                return false;
        }
 
-       if (!original_.load(toqstr(filename.absFilename()))) {
+       fname_ = toqstr(filename.absFilename());
+
+       if (!original_.load(fname_)) {
                LYXERR(Debug::GRAPHICS, "Unable to open image");
                return false;
        }
@@ -80,15 +82,22 @@ bool GuiImage::load(FileName const & filename)
 
 bool GuiImage::setPixmap(Params const & params)
 {
-       if (original_.isNull() || !params.display)
+       if (!params.display)
                return false;
 
+       if (original_.isNull()) {
+               if (original_.load(fname_))
+                       return false;
+       }
+               
        is_transformed_ = clip(params);
        is_transformed_ |= rotate(params);
        is_transformed_ |= scale(params);
 
-       if (!is_transformed_)
-               // Clear it out to save some memory.
+       // Clear the pixmap to save some memory.
+       if (is_transformed_)
+               original_ = QPixmap();
+       else
                transformed_ = QPixmap();
 
        return true;
index f531dd589d9ae430fc5a639d36534dae75ba3f1e..2bdfb6af73e084cffffe55cff6e0ed642f6cbf13 100644 (file)
@@ -16,6 +16,7 @@
 #include "graphics/GraphicsImage.h"
 
 #include <QPixmap>
+#include <QString>
 
 namespace lyx {
 namespace graphics {
@@ -69,6 +70,8 @@ private:
        QPixmap transformed_;
        /// Buffer the pixmap itself
        bool is_transformed_;
+       ///
+       QString fname_;
 };
 
 } // namespace graphics