- p->viewport()->update(x, y, w, h);
-}
-
-
-void GuiWorkArea::paintEvent(QPaintEvent * ev)
-{
- QRectF const rc = ev->rect();
- // LYXERR(Debug::PAINTING, "paintEvent begin: x: " << rc.x()
- // << " y: " << rc.y() << " w: " << rc.width() << " h: " << rc.height());
-
- if (d->needResize()) {
- d->resetScreen();
- d->resizeBufferView();
- if (d->cursor_visible_) {
- d->hideCursor();
- d->showCursor();
- }
- }
-
- QPainter pain(viewport());
- double const pr = pixelRatio();
- QRectF const rcs = QRectF(rc.x() * pr, rc.y() * pr, rc.width() * pr, rc.height() * pr);
-
- if (lyxrc.use_qimage) {
- QImage const & image = static_cast<QImage const &>(*d->screen_);
- pain.drawImage(rc, image, rcs);
- } else {
- QPixmap const & pixmap = static_cast<QPixmap const &>(*d->screen_);
- pain.drawPixmap(rc, pixmap, rcs);
- }
- d->cursor_->draw(pain);
- ev->accept();
-}
-
-
-void GuiWorkArea::Private::updateScreen()
-{
- GuiPainter pain(screen_, p->pixelRatio());
- buffer_view_->draw(pain);
-}
-
-
-void GuiWorkArea::Private::showCursor(int x, int y, int h,
- bool l_shape, bool rtl, bool completable)
-{
- if (schedule_redraw_) {
- // This happens when a graphic conversion is finished. As we don't know
- // the size of the new graphics, it's better the update everything.
- // We can't use redraw() here because this would trigger a infinite
- // recursive loop with showCursor().
- buffer_view_->resize(p->viewport()->width(), p->viewport()->height());
- updateScreen();
- updateScrollbar();
- p->viewport()->update(QRect(0, 0, p->viewport()->width(), p->viewport()->height()));
- schedule_redraw_ = false;
- // Show the cursor immediately after the update.
- hideCursor();
- p->toggleCursor();