From c83eaea4d22695e5cab7b94970365eeab2b87887 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 15 Aug 2003 12:09:25 +0000 Subject: [PATCH] draw a bit more than strictly necessary..... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7553 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/qscreen.C | 29 +++------------------ src/frontends/xforms/xscreen.C | 47 +++------------------------------- src/text2.C | 2 +- 3 files changed, 8 insertions(+), 70 deletions(-) diff --git a/src/frontends/qt2/qscreen.C b/src/frontends/qt2/qscreen.C index f5b85dbdab..02e4e66db6 100644 --- a/src/frontends/qt2/qscreen.C +++ b/src/frontends/qt2/qscreen.C @@ -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(); } diff --git a/src/frontends/xforms/xscreen.C b/src/frontends/xforms/xscreen.C index c8ca235ce2..c917944ad3 100644 --- a/src/frontends/xforms/xscreen.C +++ b/src/frontends/xforms/xscreen.C @@ -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); } diff --git a/src/text2.C b/src/text2.C index e4425f9355..bf67799b0e 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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) { -- 2.39.5