]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/QLImage.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QLImage.C
index 877e8aabd4db5848636a9f4d5b78ee7f5e1550b6..08a394b68b58a0dbfd560bb8d5c7e8c43785225b 100644 (file)
@@ -9,10 +9,6 @@
  * Full author contact details are available in file CREDITS.
  */
 
-#ifndef QT3_SUPPORT
- #define QT3_SUPPORT
-#endif
-
 #include <config.h>
 
 #include "QLImage.h"
@@ -187,9 +183,9 @@ QImage & toGray(QImage & img)
        int const pixels = img.depth() > 8 ?
                img.width() * img.height() : img.numColors();
 
-       unsigned int * const data = img.depth() > 8 ?
-               (unsigned int *)img.bits() :
-               (unsigned int *)img.jumpTable();
+       unsigned int *data = img.depth() > 8 ? 
+               reinterpret_cast<unsigned int *>(img.bits()) :
+               reinterpret_cast<unsigned int *>(&img.colorTable()[0]);
 
        for(int i = 0; i < pixels; ++i){
                int const val = qGray(data[i]);
@@ -213,7 +209,7 @@ bool QLImage::setPixmap_impl(Params const & params)
        }
 
        case MonochromeDisplay: {
-               transformed_.convertDepth(transformed_.depth(), Qt::MonoOnly);
+               transformed_.convertToFormat(transformed_.format(), Qt::MonoOnly);
                break;
        }
 
@@ -221,7 +217,7 @@ bool QLImage::setPixmap_impl(Params const & params)
                break;
        }
 
-       transformed_pixmap_ = transformed_;
+       transformed_pixmap_ = QPixmap::fromImage(transformed_);
        return true;
 }
 
@@ -268,8 +264,7 @@ void QLImage::rotate_impl(Params const & params)
        QMatrix m;
        m.rotate(-params.angle);
 
-       transformed_.setAlphaBuffer(true);
-       transformed_ = transformed_.xForm(m);
+       transformed_ = transformed_.transformed(m);
 }
 
 
@@ -287,7 +282,7 @@ void QLImage::scale_impl(Params const & params)
 
        QMatrix m;
        m.scale(double(width) / getWidth(), double(height) / getHeight());
-       transformed_ = transformed_.xForm(m);
+       transformed_ = transformed_.transformed(m);
 }
 
 } // namespace graphics