Selective expose patch

* metricsinfo.h
	(ViewMetricsInfo): add size parameter

	* BufferView_pimpl.C
	(BufferView::Pimpl::metrics): return size

	* frontends/screen.C
	(LyXScreen::redraw): expose selectively, using y1, y2 in vi, and
	exposing lower grey at end using size test



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13432 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2006-03-20 15:05:07 +00:00
parent 206e3745a2
commit a193ea09f9
3 changed files with 11 additions and 4 deletions

View File

@ -1348,6 +1348,8 @@ ViewMetricsInfo BufferView::Pimpl::metrics(bool singlepar)
theCoords.clear();
BufferView & bv = *bv_;
LyXText * const text = bv.text();
lyx::pit_type size = int(text->paragraphs().size());
if (anchor_ref_ > int(text->paragraphs().size() - 1)) {
anchor_ref_ = int(text->paragraphs().size() - 1);
offset_ref_ = 0;
@ -1434,7 +1436,8 @@ ViewMetricsInfo BufferView::Pimpl::metrics(bool singlepar)
<< " pit2: " << pit2
<< " npit: " << npit
<< " singlepar: " << singlepar
<< "size: " << size
<< endl;
return ViewMetricsInfo(pit1, pit2, y1, y2, singlepar);
return ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size);
}

View File

@ -219,7 +219,10 @@ void LyXScreen::redraw(BufferView & bv, ViewMetricsInfo const & vi)
workarea().getPainter().start();
paintText(bv, vi);
lyxerr[Debug::DEBUG] << "Redraw screen" << endl;
expose(0, 0, workarea().workWidth(), workarea().workHeight());
int const ymin = std::max(vi.y1, 0);
int const ymax =
( vi.p2 < vi.size - 1 ? vi.y2 : workarea().workHeight() );
expose(0, ymin, workarea().workWidth(), ymax - ymin);
workarea().getPainter().end();
theCoords.doneUpdating();
}

View File

@ -102,13 +102,14 @@ class ViewMetricsInfo
{
public:
ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2, int y1, int y2,
bool singlepar) : p1(p1), p2(p2), y1(y1), y2(y2),
singlepar(singlepar) {}
bool singlepar, lyx::pit_type size) : p1(p1), p2(p2),
y1(y1), y2(y2), singlepar(singlepar), size(size) {}
lyx::pit_type p1;
lyx::pit_type p2;
int y1;
int y2;
bool singlepar;
lyx::pit_type size;
};