Re: [Libreoffice] how to handle this bug (if this is one?)

2011-08-27 Thread Eike Rathke
Hi Pierre-André,

On Friday, 2011-08-26 23:19:34 +0200, Pierre-André Jacquod wrote:

 in vcl/win/source/gdi/winlayout.cxx, around line 695 there is:
 
  long SimpleWinLayout::FillDXArray( long* pDXArray ) const
  {
 +if( !mnWidth )
 +{
 +long mnWidth = mnBaseAdv;
 +for( int i = 0; i  mnGlyphCount; ++i )
 +mnWidth += mpGlyphAdvances[ i ];
 +}
 
 +if( pDXArray != NULL )
  {
 +for( int i = 0; i  mnCharCount; ++i )
 + pDXArray[ i ] = mpCharWidths[ i ];
  }
 
 +return mnWidth;
  }
 
 the statement within th IF does not make any sense for my poor
 understanding. As I read the code, the first IF could also be
 totally removed, since as soon as exiting the first IF, all value
 are lost.

Looks like a leftover from the previous version where nWidth was
calculated only locally without the result ever being assigned to
mnWidth and the local nWidth being returned. With the change that logic
changed, the mnWidth member variable still not being assigned a value
but returning mnWidth. I guess the correct approach would be to remove
the local long declaration so that it reads

if( !mnWidth )
{
mnWidth = mnBaseAdv;
for( int i = 0; i  mnGlyphCount; ++i )
mnWidth += mpGlyphAdvances[ i ];
}


  Eike

-- 
 PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication.
 Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD


signature.asc
Description: Digital signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] how to handle this bug (if this is one?)

2011-08-26 Thread Pierre-André Jacquod

hello,
in vcl/win/source/gdi/winlayout.cxx, around line 695 there is:

 long SimpleWinLayout::FillDXArray( long* pDXArray ) const
 {
+if( !mnWidth )
+{
+long mnWidth = mnBaseAdv;
+for( int i = 0; i  mnGlyphCount; ++i )
+mnWidth += mpGlyphAdvances[ i ];
+}

+if( pDXArray != NULL )
 {
+for( int i = 0; i  mnCharCount; ++i )
+ pDXArray[ i ] = mpCharWidths[ i ];
 }

+return mnWidth;
 }

the statement within th IF does not make any sense for my poor 
understanding. As I read the code, the first IF could also be totally 
removed, since as soon as exiting the first IF, all value are lost.


It seems to me that this is more or less what happened with the early 
code before the change of commit 2f382d6c2579a2 in 2003. But I do not 
sucess to match both logic.

Has someone more / better hints?
Thanks
Pierre-André

long SimpleWinLayout::FillDXArray( long* pDXArray ) const
 {
-if( mnWidth  !pDXArray )
-return mnWidth;
-
-long nWidth = 0;

-for( int i = 0; i  mnGlyphCount; ++i )
 {
-int j = !mpChars2Glyphs ? i : mpChars2Glyphs[i];
-nWidth += mpGlyphAdvances[j];
-if( pDXArray )
-pDXArray[i] = nWidth;
 }

-return nWidth;
 }

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice