draw a bit more than strictly necessary.....

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7553 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-08-15 12:09:25 +00:00
parent 221f1be82d
commit c83eaea4d2
3 changed files with 8 additions and 70 deletions

View File

@ -54,7 +54,7 @@ QScreen::~QScreen()
void QScreen::repaint()
{
QWidget * content(owner_.getContent());
QWidget * content = owner_.getContent();
content->repaint(0, 0, content->width(), content->height());
}
@ -70,35 +70,14 @@ void QScreen::expose(int x, int y, int w, int h)
void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
{
QPixmap * p(owner_.getPixmap());
QPixmap * p = owner_.getPixmap();
owner_.getPainter().start();
int const old_first = text->top_y();
text->top_y(y);
// If you want to fix the warning below, fix it so it
// actually scrolls properly. Hint: a cast won't do.
// is any optimization possible?
if (y - old_first < owner_.workHeight()
&& old_first - y < owner_.workHeight()) {
if (text->top_y() < old_first) {
int const dest_y = old_first - text->top_y();
drawFromTo(text, bv, 0, dest_y, 0, 0);
copyInPixmap(p, dest_y, 0, owner_.workWidth(), owner_.height() - dest_y);
expose(0, 0, owner_.workWidth(), dest_y);
} else {
int const src_y = text->top_y() - old_first;
drawFromTo(text, bv, owner_.height() - src_y, owner_.height(), 0, 0);
copyInPixmap(p, 0, 0, owner_.workWidth(), owner_.height() - src_y);
expose(0, owner_.height() - src_y, owner_.workWidth(), src_y);
}
} else {
lyxerr[Debug::GUI] << "dumb full redraw" << endl;
drawFromTo(text, bv, 0, owner_.height(), 0, 0);
repaint();
}
drawFromTo(text, bv, 0, owner_.height(), 0, 0);
repaint();
owner_.getPainter().end();
}

View File

@ -176,50 +176,9 @@ void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
int const old_first = text->top_y();
text->top_y(y);
// is any optimization possible?
if ((y - old_first) < owner_.workHeight()
&& (old_first - y) < owner_.workHeight())
{
if (text->top_y() < old_first) {
drawFromTo(text, bv, 0, old_first - text->top_y(), 0, 0);
XCopyArea(fl_get_display(),
owner_.getWin(),
owner_.getWin(),
gc_copy,
owner_.xpos(),
owner_.ypos(),
owner_.workWidth(),
owner_.workHeight() - old_first + text->top_y(),
owner_.xpos(),
owner_.ypos() + old_first - text->top_y()
);
// expose the area drawn
expose(0, 0,
owner_.workWidth(),
old_first - text->top_y());
} else {
drawFromTo(text, bv,
owner_.workHeight() + old_first - text->top_y(),
owner_.workHeight(), 0, 0);
XCopyArea(fl_get_display(),
owner_.getWin(),
owner_.getWin(),
gc_copy,
owner_.xpos(),
owner_.ypos() + text->top_y() - old_first,
owner_.workWidth(),
owner_.workHeight() + old_first - text->top_y(),
owner_.xpos(),
owner_.ypos());
// expose the area drawn
expose(0, owner_.workHeight() + old_first - text->top_y(),
owner_.workWidth(), text->top_y() - old_first);
}
} else {
// make a dumb new-draw
drawFromTo(text, bv, 0, owner_.workHeight(), 0, 0);
expose(0, 0, owner_.workWidth(), owner_.workHeight());
}
// make a dumb new-draw
drawFromTo(text, bv, 0, owner_.workHeight(), 0, 0);
expose(0, 0, owner_.workWidth(), owner_.workHeight());
XSync(fl_get_display(), 0);
}

View File

@ -1383,7 +1383,7 @@ void LyXText::setCursor(LyXCursor & cur, ParagraphList::iterator pit,
// None of these should happen, but we're scaredy-cats
if (pos > pit->size()) {
lyxerr << "dont like 1 please report" << endl;
lyxerr << "dont like 1, pos: " << pos << " size: " << pit->size() << endl;
pos = 0;
cur.pos(0);
} else if (pos > last + 1) {