LCL Carbon: exclude last pixel when rasterizating line

git-svn-id: trunk@14445 -
This commit is contained in:
tombo 2008-03-06 10:59:05 +00:00
parent 8aedb53f6c
commit 8dde11e9ab
2 changed files with 18 additions and 5 deletions

View File

@ -1042,11 +1042,21 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TCarbonDeviceContext.LineTo(X, Y: Integer); procedure TCarbonDeviceContext.LineTo(X, Y: Integer);
begin begin
CGContextBeginPath(CGContext); if CurrentPen.Width = 1 then
// add 0.5 to both coordinates for better rasterization begin
CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5); CGContextSaveGState(CGContext);
CGContextAddLineToPoint(CGContext, X + 0.5, Y + 0.5); ExcludeClipRect(X, Y, X + 1, Y + 1);
CGContextStrokePath(CGContext); 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.x := X;
FPenPos.y := Y; FPenPos.y := Y;

View File

@ -198,6 +198,9 @@ type
constructor Create(AGlobal: Boolean); // create default pen constructor Create(AGlobal: Boolean); // create default pen
constructor Create(ALogPen: TLogPen); constructor Create(ALogPen: TLogPen);
procedure Apply(ADC: TCarbonContext; UseROP2: Boolean = True); procedure Apply(ADC: TCarbonContext; UseROP2: Boolean = True);
property Width: Integer read FWidth;
property Style: LongWord read FStyle;
end; end;
{ TCarbonBitmap } { TCarbonBitmap }