qt4 optimisation:

* 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
This commit is contained in:
Abdelrazak Younes 2006-05-21 08:49:02 +00:00
parent 2496781ffb
commit 3efac59557
3 changed files with 16 additions and 11 deletions

View 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());
}

View 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_;

View 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;
}