>>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:

Georg> I tried the attached. Each text is now only drawn once, and I
Georg> think the display is OK now. I am not sure whether the
Georg> coordcache is still valid. Do you now how this could be tested?

I had a different idea while driving home, which was to avoid the draw
when there is no selection. It is somewhat orthogonal to your version,
but I think both make sense. What about the following combined patch?

I also added the line
+       pinop.base = pi.base;
which somehow makes me feel safer.

Georg> Great detective work btw! I also spent some time investigating
Georg> this bug, but since I only searched in the qt font code I could
Georg> not find anything.

Actually I instrumented the painter to be able to prove that different
fonts were used. When I saw the multiple draws I thought "this is not
good; I should look at it later". It really took time to realize that
drawing the same text several times was a problem.

JMarc

Index: src/mathed/math_nestinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.180
diff -u -p -r1.180 math_nestinset.C
--- src/mathed/math_nestinset.C	11 Jan 2006 17:08:50 -0000	1.180
+++ src/mathed/math_nestinset.C	27 Jan 2006 09:09:39 -0000
@@ -51,6 +51,7 @@
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
 #include "frontends/Painter.h"
+#include "frontends/nullpainter.h"
 
 #include <sstream>
 
@@ -219,15 +220,18 @@ void MathNestInset::draw(PainterInfo & p
 
 void MathNestInset::drawSelection(PainterInfo & pi, int x, int y) const
 {
-	// FIXME: hack to get position cache warm
-	draw(pi, x, y);
-
 	// this should use the x/y values given, not the cached values
 	LCursor & cur = pi.base.bv->cursor();
 	if (!cur.selection())
 		return;
 	if (!ptr_cmp(&cur.inset(), this))
 		return;
+
+	// FIXME: hack to get position cache warm
+	static NullPainter nop;
+	PainterInfo pinop(pi.base.bv, nop);
+	pinop.base = pi.base;
+	draw(pinop, x, y);
 
 	CursorSlice s1 = cur.selBegin();
 	CursorSlice s2 = cur.selEnd();

Reply via email to