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
// so make sure that the buffer view has an up to date metrics.
d->buffer_view_->resize(viewport()->width(), viewport()->height());
// << " y: " << rc.y() << " w: " << rc.width() << " h: " << rc.height());
if (d->need_resize_) {
- d->screen_ = QPixmap(viewport()->width(), viewport()->height());
+ d->resetScreen();
d->resizeBufferView();
if (d->cursor_visible_) {
d->hideCursor();
}
QPainter pain(viewport());
+#ifdef USE_QIMAGE
+ pain.drawImage(rc, d->screen_, rc);
+#else
pain.drawPixmap(rc, d->screen_, rc);
+#endif
d->cursor_->draw(pain);
ev->accept();
}
#ifndef 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 "qt_helpers.h"
#include <QAbstractScrollArea>
#include <QMouseEvent>
+#ifdef USE_QIMAGE
+#include <QImage>
+#else
#include <QPixmap>
+#endif
#include <QTimer>
class QContextMenuEvent;
void updateCursorShape();
///
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;
///
CursorWidget * cursor_;
///
- QPixmap screen_;
- ///
bool need_resize_;
///
bool schedule_redraw_;