]> 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 84fc6b429d98dfa7cebf055cc8a4fcc1422efe24..08a394b68b58a0dbfd560bb8d5c7e8c43785225b 100644 (file)
@@ -68,7 +68,7 @@ Image::FormatList QLImage::loadableFormats()
 
 //     lyxerr[Debug::GRAPHICS]
 //             << "D:/msys/home/yns/src/lyx-devel/lib/images/banner.ppm is of format: "
-//             << (const char*) Pic.pictureFormat("D:/msys/home/yns/src/lyx-devel/lib/images/banner.ppm")
+//             << fromqstr(Pic.pictureFormat("D:/msys/home/yns/src/lyx-devel/lib/images/banner.ppm"))
 //             << endl;
 //     if (Pic.pictureFormat("D:/msys/home/yns/src/lyx-devel/lib/images/banner.ppm"))
 //             lyxerr[Debug::GRAPHICS]
@@ -87,7 +87,7 @@ Image::FormatList QLImage::loadableFormats()
        for (QList<QByteArray>::const_iterator it =qt_formats.begin(); it != qt_formats.end(); ++it) {
 
                lyxerr[Debug::GRAPHICS] << (const char *) *it << ", ";
-               
+
                string ext = lowercase((const char *) *it);
 
                // special case
@@ -183,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]);
@@ -209,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;
        }
 
@@ -217,7 +217,7 @@ bool QLImage::setPixmap_impl(Params const & params)
                break;
        }
 
-       transformed_pixmap_ = transformed_;
+       transformed_pixmap_ = QPixmap::fromImage(transformed_);
        return true;
 }
 
@@ -264,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);
 }
 
 
@@ -283,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