mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-28 06:49:43 +00:00
add some extra smarts about when to paint immediately.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5291 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c2faf7df76
commit
be865e22f2
@ -1,3 +1,8 @@
|
|||||||
|
2002-09-12 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* qscreen.h:
|
||||||
|
* qscreen.C: be even smarter about repaint() vs. update()
|
||||||
|
|
||||||
2002-09-12 John Levon <levon@movementarian.org>
|
2002-09-12 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* QPrint.C: don't reset unless different buffer
|
* QPrint.C: don't reset unless different buffer
|
||||||
|
@ -146,17 +146,19 @@ void QScreen::hideCursor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QScreen::repaint()
|
||||||
|
{
|
||||||
|
QWidget * content(owner_.getContent());
|
||||||
|
content->repaint(0, 0, content->width(), content->height());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QScreen::expose(int x, int y, int w, int h)
|
void QScreen::expose(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::GUI] << "expose " << w << "x" << h
|
lyxerr[Debug::GUI] << "expose " << w << "x" << h
|
||||||
<< "+" << x << "+" << y << endl;
|
<< "+" << x << "+" << y << endl;
|
||||||
|
|
||||||
// if we're scrolling, we want immediate paint, otherwise not.
|
owner_.getContent()->update(x, y, w, h);
|
||||||
QWidget * content(owner_.getContent());
|
|
||||||
if (content->width() == w && content->height() == h)
|
|
||||||
content->repaint(x, y, w, h);
|
|
||||||
else
|
|
||||||
content->update(x, y, w, h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -172,9 +174,12 @@ void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
|
|||||||
bool const internal = (text == bv->text);
|
bool const internal = (text == bv->text);
|
||||||
text->first_y = y;
|
text->first_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?
|
// is any optimization possible?
|
||||||
if ((y - old_first) < owner_.workHeight()
|
if (y - old_first < owner_.workHeight()
|
||||||
&& (old_first - y) < owner_.workHeight()) {
|
&& old_first - y < owner_.workHeight()) {
|
||||||
if (text->first_y < old_first) {
|
if (text->first_y < old_first) {
|
||||||
int const dest_y = old_first - text->first_y;
|
int const dest_y = old_first - text->first_y;
|
||||||
drawFromTo(text, bv, 0, dest_y, 0, 0, internal);
|
drawFromTo(text, bv, 0, dest_y, 0, 0, internal);
|
||||||
@ -187,9 +192,9 @@ void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
|
|||||||
expose(0, owner_.height() - src_y, owner_.workWidth(), src_y);
|
expose(0, owner_.height() - src_y, owner_.workWidth(), src_y);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// make a dumb redraw
|
lyxerr[Debug::GUI] << "dumb full redraw" << endl;
|
||||||
drawFromTo(text, bv, 0, owner_.height(), 0, 0, internal);
|
drawFromTo(text, bv, 0, owner_.height(), 0, 0, internal);
|
||||||
expose(0, 0, owner_.workWidth(), owner_.height());
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
owner_.getPainter().end();
|
owner_.getPainter().end();
|
||||||
|
@ -58,6 +58,9 @@ protected:
|
|||||||
/// get the work area
|
/// get the work area
|
||||||
virtual WorkArea & workarea() const { return owner_; }
|
virtual WorkArea & workarea() const { return owner_; }
|
||||||
|
|
||||||
|
/// repaint the whole content immediately
|
||||||
|
void repaint();
|
||||||
|
|
||||||
/// copies specified area of pixmap to screen
|
/// copies specified area of pixmap to screen
|
||||||
virtual void expose(int x, int y, int exp_width, int exp_height);
|
virtual void expose(int x, int y, int exp_width, int exp_height);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user