You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by hd...@apache.org on 2014/06/13 13:09:15 UTC

svn commit: r1602370 - in /openoffice/branches/AOO410: ./ main/ main/vcl/aqua/source/gdi/ctlayout.cxx main/vcl/aqua/source/gdi/salgdiutils.cxx

Author: hdu
Date: Fri Jun 13 11:09:15 2014
New Revision: 1602370

URL: http://svn.apache.org/r1602370
Log:
#i125020# fix the repainting problem for update rectangles with CoreText

by doing the calculation before CTLineDraw() updates the text position.
Requesting the update early is possible because that update region is
not used until AquaSalInstance::Yield().

The fix also accounts for worst-case rounding effects when the processing
the repaint rectangles.

Merged from AOO's trunk revisions 1599169, 1599173 and 1599174

Modified:
    openoffice/branches/AOO410/   (props changed)
    openoffice/branches/AOO410/main/   (props changed)
    openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx
    openoffice/branches/AOO410/main/vcl/aqua/source/gdi/salgdiutils.cxx

Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
  Merged /openoffice/trunk:r1599169,1599173-1599174

Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
  Merged /openoffice/trunk/main:r1599169,1599173-1599174

Modified: openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx?rev=1602370&r1=1602369&r2=1602370&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx (original)
+++ openoffice/branches/AOO410/main/vcl/aqua/source/gdi/ctlayout.cxx Fri Jun 13 11:09:15 2014
@@ -265,13 +265,7 @@ void CTLayout::DrawText( SalGraphics& rG
 
 	CGContextSetTextPosition( rAquaGraphics.mrContext, aTextPos.x, aTextPos.y );
 
-	// set the text color as fill color (see kCTForegroundColorFromContextAttributeName)
-	CGContextSetFillColor( rAquaGraphics.mrContext, rAquaGraphics.maTextColor.AsArray() );
-
-	// draw the text
-	CTLineDraw( mpCTLine, rAquaGraphics.mrContext );
-
-	// request an update of the changed window area
+	// request an update of the to-be-changed window area
 	if( rAquaGraphics.IsWindowGraphics() )
 	{
 		const CGRect aInkRect = CTLineGetImageBounds( mpCTLine, rAquaGraphics.mrContext );
@@ -279,6 +273,12 @@ void CTLayout::DrawText( SalGraphics& rG
 		rAquaGraphics.RefreshRect( aRefreshRect );
 	}
 
+	// set the text color as fill color (see kCTForegroundColorFromContextAttributeName)
+	CGContextSetFillColor( rAquaGraphics.mrContext, rAquaGraphics.maTextColor.AsArray() );
+
+	// draw the text
+	CTLineDraw( mpCTLine, rAquaGraphics.mrContext );
+
 	// restore the original graphic context transformations
 	CGContextRestoreGState( rAquaGraphics.mrContext );
 }

Modified: openoffice/branches/AOO410/main/vcl/aqua/source/gdi/salgdiutils.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/aqua/source/gdi/salgdiutils.cxx?rev=1602370&r1=1602369&r2=1602370&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/vcl/aqua/source/gdi/salgdiutils.cxx (original)
+++ openoffice/branches/AOO410/main/vcl/aqua/source/gdi/salgdiutils.cxx Fri Jun 13 11:09:15 2014
@@ -243,10 +243,13 @@ void AquaSalGraphics::RefreshRect(float 
     {
         // update a little more around the designated rectangle
         // this helps with antialiased rendering
+        // Rounding down x and width can accumulate a rounding error of up to 2
+        // The decrementing of x, the rounding error and the antialiasing border
+        // require that the width and the height need to be increased by four
         const Rectangle aVclRect(Point(static_cast<long int>(lX-1),
 					static_cast<long int>(lY-1) ),
-				 Size( 	static_cast<long int>(lWidth+2), 
-					static_cast<long int>(lHeight+2) ) );
+				 Size( 	static_cast<long int>(lWidth+4), 
+					static_cast<long int>(lHeight+4) ) );
         mpFrame->maInvalidRect.Union( aVclRect );
     }
 }