From 8dde11e9ab01472d3bb8d3e8db8f12d78848252c Mon Sep 17 00:00:00 2001 From: tombo Date: Thu, 6 Mar 2008 10:59:05 +0000 Subject: [PATCH] LCL Carbon: exclude last pixel when rasterizating line git-svn-id: trunk@14445 - --- lcl/interfaces/carbon/carboncanvas.pp | 20 +++++++++++++++----- lcl/interfaces/carbon/carbongdiobjects.pp | 3 +++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lcl/interfaces/carbon/carboncanvas.pp b/lcl/interfaces/carbon/carboncanvas.pp index d743de3807..e21404795f 100644 --- a/lcl/interfaces/carbon/carboncanvas.pp +++ b/lcl/interfaces/carbon/carboncanvas.pp @@ -1042,11 +1042,21 @@ end; ------------------------------------------------------------------------------} procedure TCarbonDeviceContext.LineTo(X, Y: Integer); begin - CGContextBeginPath(CGContext); - // add 0.5 to both coordinates for better rasterization - CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5); - CGContextAddLineToPoint(CGContext, X + 0.5, Y + 0.5); - CGContextStrokePath(CGContext); + if CurrentPen.Width = 1 then + begin + CGContextSaveGState(CGContext); + ExcludeClipRect(X, Y, X + 1, Y + 1); + end; + + try + CGContextBeginPath(CGContext); + // add 0.5 to both coordinates for better rasterization + CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5); + CGContextAddLineToPoint(CGContext, X + 0.5, Y + 0.5); + CGContextStrokePath(CGContext); + finally + if CurrentPen.Width = 1 then CGContextRestoreGState(CGContext); + end; FPenPos.x := X; FPenPos.y := Y; diff --git a/lcl/interfaces/carbon/carbongdiobjects.pp b/lcl/interfaces/carbon/carbongdiobjects.pp index 80d60fca73..b682427642 100644 --- a/lcl/interfaces/carbon/carbongdiobjects.pp +++ b/lcl/interfaces/carbon/carbongdiobjects.pp @@ -198,6 +198,9 @@ type constructor Create(AGlobal: Boolean); // create default pen constructor Create(ALogPen: TLogPen); procedure Apply(ADC: TCarbonContext; UseROP2: Boolean = True); + + property Width: Integer read FWidth; + property Style: LongWord read FStyle; end; { TCarbonBitmap }