Martin Vermeer wrote:
> On Wed, 2005-04-27 at 10:41, Angus Leeming wrote:
>> Martin Vermeer wrote:
>> > I don't think it has anything to do with moving the graphic. What I
>> > notice on my 256k/256k ADSL modem is traffic going on all the time
>> > when a document is open. It starts with the splash screen; when that
>> > is loaded, it stops. Then when you open a document or start a new one,
>> > it starts again and never stops.
>> >
>> > There is some inefficient redrawing going on somewhere. Cursor blink
>> > code?
>>
>> I wonder...
>>
>> One thing we do with graphics images is *monitor* the state of the
>> original file. Does disabling this in support/FileMonitor.C make life
>> better?
>
> Haven't tried that, but I did find the following when using the testing
> code:
>
> Index: QLPainter.C
> ===================================================================
> RCS file:
> /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPainter.C,v
> retrieving revision 1.35
> diff -u -p -r1.35 QLPainter.C
> --- QLPainter.C 31 Jan 2005 15:26:39 -0000 1.35
> +++ QLPainter.C 27 Apr 2005 09:29:17 -0000
> @@ -171,6 +171,7 @@ void QLPainter::image(int x, int y, int
> static_cast<lyx::graphics::QLImage const &>(i);
>
> fillRectangle(x, y, w, h, LColor::graphicsbg);
> + lyxerr << "Drawing an image" << endl;
> qp_->drawImage(x, y, qlimage.qimage(), 0, 0, w, h);
> }
>
> When placing an external xfig object and enabling its graphic display,
> the lyxerr printout is triggered once. Then, when typing characters even
> into paragraphs well below the graphic, _every time_ the printout is
> triggered. That's a lot of drawing work for a single character :-)
>
> Whan scrolling the graphic to outside the visible window, also the
> printouts disappear.
>
> Is there an easy way to make the drawing more parsimonious? We used to
> have that and it was horribly complicated, and Andre cleaned it up, as I
> remember. Would it be worth pursuing in this case?
Martin, does this patch fix the problem for you? It shoudl buffer the
pixmap.
--
Angus
Index: src/frontends/qt2/QLImage.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLImage.C,v
retrieving revision 1.34
diff -u -p -r1.34 QLImage.C
--- src/frontends/qt2/QLImage.C 6 Nov 2004 16:14:21 -0000 1.34
+++ src/frontends/qt2/QLImage.C 27 Apr 2005 21:44:22 -0000
@@ -112,7 +112,8 @@ QLImage::QLImage()
QLImage::QLImage(QLImage const & other)
: Image(other), original_(other.original_),
- transformed_(other.original_)
+ transformed_(other.original_),
+ transformed_pixmap_(other.original_)
{}
@@ -204,6 +205,7 @@ bool QLImage::setPixmap_impl(Params cons
break;
}
+ transformed_pixmap_ = transformed_;
return true;
}
Index: src/frontends/qt2/QLImage.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLImage.h,v
retrieving revision 1.10
diff -u -p -r1.10 QLImage.h
--- src/frontends/qt2/QLImage.h 2 May 2004 12:45:26 -0000 1.10
+++ src/frontends/qt2/QLImage.h 27 Apr 2005 21:44:22 -0000
@@ -30,7 +30,7 @@ public:
static FormatList loadableFormats();
~QLImage();
- QImage const & qimage() const { return transformed_; }
+ QPixmap const & qpixmap() const { return transformed_pixmap_; }
private:
/// Create a copy
@@ -70,6 +70,8 @@ private:
/// The transformed image for display.
QImage transformed_;
+ /// Buffer the pixmap itself
+ QPixmap transformed_pixmap_;
};
} // namespace graphics
Index: src/frontends/qt2/QLPainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPainter.C,v
retrieving revision 1.35
diff -u -p -r1.35 QLPainter.C
--- src/frontends/qt2/QLPainter.C 31 Jan 2005 15:26:39 -0000 1.35
+++ src/frontends/qt2/QLPainter.C 27 Apr 2005 21:44:23 -0000
@@ -171,7 +171,7 @@ void QLPainter::image(int x, int y, int
static_cast<lyx::graphics::QLImage const &>(i);
fillRectangle(x, y, w, h, LColor::graphicsbg);
- qp_->drawImage(x, y, qlimage.qimage(), 0, 0, w, h);
+ qp_->drawPixmap(x, y, qlimage.qpixmap(), 0, 0, w, h);
}