]> git.lyx.org Git - lyx.git/commitdiff
qt4 optimisation:
authorAbdelrazak Younes <younes@lyx.org>
Sun, 21 May 2006 08:49:02 +0000 (08:49 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 21 May 2006 08:49:02 +0000 (08:49 +0000)
* qfont_loader.h: enable the font caching
* QWorkArea: disable intermediate QImage caching, use QPixmap directly.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13893 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/QWorkArea.C
src/frontends/qt4/QWorkArea.h
src/frontends/qt4/qfont_loader.h

index 6693c5f28c95710bbe67222213ea31e0671a4082..86261069edc1fd2ecb877e4454ff454ea4dc4cd7 100644 (file)
@@ -493,8 +493,9 @@ void QWorkArea::resizeEvent(QResizeEvent * resizeEvent)
 
        verticalScrollBar()->setPageStep(viewport()->height());
 
-       screen_device_ = QPixmap(viewport()->width(), viewport()->height());
-       paint_device_ = QImage(viewport()->width(), viewport()->height(), QImage::Format_RGB32);
+//     screen_device_ = QPixmap(viewport()->width(), viewport()->height());
+//     paint_device_ = QImage(viewport()->width(), viewport()->height(), QImage::Format_RGB32);
+       paint_device_ = QPixmap(viewport()->width(), viewport()->height());
 
        view_.view()->workAreaResize();
 
@@ -513,8 +514,8 @@ void QWorkArea::resizeEvent(QResizeEvent * resizeEvent)
 void QWorkArea::update(int x, int y, int w, int h)
 {
        //screen_device_.fromImage(paint_device_);
-       QPainter q(&screen_device_);
-       q.drawImage(x, y, paint_device_.copy(x, y, w, h));
+       //QPainter q(&screen_device_);
+       //q.drawImage(x, y, paint_device_.copy(x, y, w, h));
 
        viewport()->update(x, y, w, h);
 }
@@ -536,18 +537,18 @@ void QWorkArea::paintEvent(QPaintEvent * e)
                << endl;
        */
        QPainter q(viewport());
-       q.drawPixmap(e->rect(), screen_device_, e->rect());
+       q.drawPixmap(e->rect(), paint_device_, e->rect());
 }
 
 
 QPixmap QWorkArea::copyScreen(int x, int y, int w, int h) const
 {
-       return screen_device_.copy(x, y, w, h);
+       return paint_device_.copy(x, y, w, h);
 }
 
 void QWorkArea::drawScreen(int x, int y, QPixmap pixmap)
 {
-       QPainter q(&screen_device_);
+       QPainter q(&paint_device_);
        q.drawPixmap(x, y, pixmap);
        viewport()->update(x, y, pixmap.width(), pixmap.height());
 }
index 92bd7f57c5d818ec32e82152eade9869aa008fe1..6ca7a88e126ebc93008093e747e0e70d8c8ee2dd 100644 (file)
@@ -208,10 +208,11 @@ private:
        SyntheticMouseEvent synthetic_mouse_event_;
 
        /// Our client side painting device.
-       QImage paint_device_;
+       //QImage paint_device_;
+       QPixmap paint_device_;
 
        /// Our server side painting device.
-       QPixmap screen_device_;
+       //QPixmap screen_device_;
 
        /// \todo remove
        QTimer step_timer_;
index 2e782267a451516c223862acb6e889f0629609a0..ef283ff046d0418772d4a38a0a7ad50bcbf14c6c 100644 (file)
@@ -83,10 +83,13 @@ public:
 
        /// Get font info (font + metrics) for the given LyX font.
        QLFontInfo & fontinfo(LyXFont const & f) {
-               QLFontInfo * fi =
+               QLFontInfo * fi =
                        fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
-               if (!fi)
+               if (!fi) {
                        fi = new QLFontInfo(f);
+                       fontinfo_[f.family()][f.series()][f.realShape()][f.size()]
+                               = fi;
+               }
                return *fi;
        }