>>>>> "Alfredo" == Alfredo Braunstein <[EMAIL PROTECTED]> writes:

>> I am not sure I understand FontIterator::operator*(), since
>> inlining it did not improve the situation.

Alfredo> Could the problem be LyXFont's copy constructor?

Sure, we are not supposed to make a copy here. The attached patch
makes FontIterator::operator* go away from the profile. The strange
thing is that this does not change the timings...

Lars, is it OK nevertheless? It looks like a natural thing to do,
unless there is something I do not understand about how C++ works.

>> getFont and friends are a real problem (looking for current font at
>> each character of a paragraph), and I think that the use of a
>> FontIterator (or directly of Paragraph::getEndOfFontSpan) in for
>> example RowPainter::paintChars would help. However, the RtL code in
>> there scares me :)

Alfredo> ;-) You're not the only one here.

I am not sure how this should be done...

JMarc

Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2147
diff -u -p -r1.2147 ChangeLog
--- src/ChangeLog	6 Apr 2005 07:38:24 -0000	1.2147
+++ src/ChangeLog	6 Apr 2005 13:53:23 -0000
@@ -1,3 +1,7 @@
+2005-04-06  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* FontIterator.C (operator*): avoid a copy of the font.
+
 2005-04-06  Martin Vermeer  <[EMAIL PROTECTED]>
 
 	* CutAndPaste.C (eraseSelection): more precise fix for bug 1654,
Index: src/FontIterator.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FontIterator.C,v
retrieving revision 1.6
diff -u -p -r1.6 FontIterator.C
--- src/FontIterator.C	30 Nov 2004 01:59:32 -0000	1.6
+++ src/FontIterator.C	6 Apr 2005 13:53:23 -0000
@@ -27,7 +27,7 @@ FontIterator::FontIterator(LyXText const
 {}
 
 
-LyXFont FontIterator::operator*() const
+LyXFont const & FontIterator::operator*() const
 {
 	return font_;
 }
Index: src/FontIterator.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/FontIterator.h,v
retrieving revision 1.5
diff -u -p -r1.5 FontIterator.h
--- src/FontIterator.h	30 Nov 2004 01:59:32 -0000	1.5
+++ src/FontIterator.h	6 Apr 2005 13:53:23 -0000
@@ -34,7 +34,7 @@ public:
 	///
 	FontIterator(LyXText const & text, Paragraph const & par, lyx::pos_type pos);
 	///
-	LyXFont operator*() const;
+	LyXFont const & operator*() const;
 	///
 	FontIterator & operator++();
 	///

Reply via email to