mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Introduce new USE_QIMAGE macro to optionally use a QImage drawing backend instead of a QPixmap. This may help when running locally under X11 with some graphics cards (there were some complain about that in the user list).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39932 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7fec736162
commit
383b31a868
@ -274,7 +274,7 @@ void GuiWorkArea::init()
|
|||||||
d->cursor_timeout_.setInterval(500);
|
d->cursor_timeout_.setInterval(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->screen_ = QPixmap(viewport()->width(), viewport()->height());
|
d->resetScreen();
|
||||||
// With Qt4.5 a mouse event will happen before the first paint event
|
// With Qt4.5 a mouse event will happen before the first paint event
|
||||||
// so make sure that the buffer view has an up to date metrics.
|
// so make sure that the buffer view has an up to date metrics.
|
||||||
d->buffer_view_->resize(viewport()->width(), viewport()->height());
|
d->buffer_view_->resize(viewport()->width(), viewport()->height());
|
||||||
@ -1101,7 +1101,7 @@ void GuiWorkArea::paintEvent(QPaintEvent * ev)
|
|||||||
// << " y: " << rc.y() << " w: " << rc.width() << " h: " << rc.height());
|
// << " y: " << rc.y() << " w: " << rc.width() << " h: " << rc.height());
|
||||||
|
|
||||||
if (d->need_resize_) {
|
if (d->need_resize_) {
|
||||||
d->screen_ = QPixmap(viewport()->width(), viewport()->height());
|
d->resetScreen();
|
||||||
d->resizeBufferView();
|
d->resizeBufferView();
|
||||||
if (d->cursor_visible_) {
|
if (d->cursor_visible_) {
|
||||||
d->hideCursor();
|
d->hideCursor();
|
||||||
@ -1110,7 +1110,11 @@ void GuiWorkArea::paintEvent(QPaintEvent * ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QPainter pain(viewport());
|
QPainter pain(viewport());
|
||||||
|
#ifdef USE_QIMAGE
|
||||||
|
pain.drawImage(rc, d->screen_, rc);
|
||||||
|
#else
|
||||||
pain.drawPixmap(rc, d->screen_, rc);
|
pain.drawPixmap(rc, d->screen_, rc);
|
||||||
|
#endif
|
||||||
d->cursor_->draw(pain);
|
d->cursor_->draw(pain);
|
||||||
ev->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,11 @@
|
|||||||
#ifndef WORKAREA_PRIVATE_H
|
#ifndef WORKAREA_PRIVATE_H
|
||||||
#define WORKAREA_PRIVATE_H
|
#define WORKAREA_PRIVATE_H
|
||||||
|
|
||||||
|
// Comment out to use QImage backend instead of QPixmap. This won't have any
|
||||||
|
// effect on Windows, MacOSX and most X11 environment when running locally.
|
||||||
|
// When running remotely on X11, this may have a big performance penalty.
|
||||||
|
//#define USE_QIMAGE
|
||||||
|
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
|
|
||||||
@ -20,7 +25,11 @@
|
|||||||
|
|
||||||
#include <QAbstractScrollArea>
|
#include <QAbstractScrollArea>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#ifdef USE_QIMAGE
|
||||||
|
#include <QImage>
|
||||||
|
#else
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
#endif
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
class QContextMenuEvent;
|
class QContextMenuEvent;
|
||||||
@ -117,6 +126,23 @@ struct GuiWorkArea::Private
|
|||||||
void updateCursorShape();
|
void updateCursorShape();
|
||||||
///
|
///
|
||||||
void setCursorShape(Qt::CursorShape shape);
|
void setCursorShape(Qt::CursorShape shape);
|
||||||
|
|
||||||
|
#ifdef USE_QIMAGE
|
||||||
|
void resetScreen()
|
||||||
|
{
|
||||||
|
screen_ = QImage(p->viewport()->width(), p->viewport()->height(),
|
||||||
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage screen_;
|
||||||
|
#else
|
||||||
|
void resetScreen()
|
||||||
|
{
|
||||||
|
screen_ = QPixmap(p->viewport()->width(), p->viewport()->height());
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap screen_;
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
GuiWorkArea * p;
|
GuiWorkArea * p;
|
||||||
|
|
||||||
@ -139,8 +165,6 @@ struct GuiWorkArea::Private
|
|||||||
///
|
///
|
||||||
CursorWidget * cursor_;
|
CursorWidget * cursor_;
|
||||||
///
|
///
|
||||||
QPixmap screen_;
|
|
||||||
///
|
|
||||||
bool need_resize_;
|
bool need_resize_;
|
||||||
///
|
///
|
||||||
bool schedule_redraw_;
|
bool schedule_redraw_;
|
||||||
|
Loading…
Reference in New Issue
Block a user