mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 23:20:26 +02:00
cocoa: fix drawing of empty text
git-svn-id: trunk@41796 -
This commit is contained in:
parent
e9d31145a5
commit
da9bdae897
@ -1037,9 +1037,6 @@ var
|
|||||||
Indexes: array of NSUInteger;
|
Indexes: array of NSUInteger;
|
||||||
I, Count: NSUInteger;
|
I, Count: NSUInteger;
|
||||||
begin
|
begin
|
||||||
// ToDo: empty text: draw background of given rect
|
|
||||||
if FText = '' then
|
|
||||||
Exit;
|
|
||||||
if not ctx.isFlipped then
|
if not ctx.isFlipped then
|
||||||
Context := NSGraphicsContext.graphicsContextWithGraphicsPort_flipped(ctx.graphicsPort, True)
|
Context := NSGraphicsContext.graphicsContextWithGraphicsPort_flipped(ctx.graphicsPort, True)
|
||||||
else
|
else
|
||||||
@ -1617,7 +1614,7 @@ begin
|
|||||||
BkBrush.Solid := BrushSolid;
|
BkBrush.Solid := BrushSolid;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (Options and ETO_CLIPPED) <> 0 then
|
if ((Options and ETO_CLIPPED) <> 0) and (Count > 0) then
|
||||||
begin
|
begin
|
||||||
CGContextBeginPath(CGContext);
|
CGContextBeginPath(CGContext);
|
||||||
CGContextAddRect(CGContext, RectToCGrect(Rect^));
|
CGContextAddRect(CGContext, RectToCGrect(Rect^));
|
||||||
@ -1625,11 +1622,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FillBg := BkMode = OPAQUE;
|
if (Count > 0) then
|
||||||
if FillBg then
|
begin
|
||||||
FText.BackgroundColor := BkBrush.ColorRef;
|
FillBg := BkMode = OPAQUE;
|
||||||
FText.SetText(UTF8Chars, Count);
|
if FillBg then
|
||||||
FText.Draw(ctx, X, Y, FillBg, CharsDelta);
|
FText.BackgroundColor := BkBrush.ColorRef;
|
||||||
|
FText.SetText(UTF8Chars, Count);
|
||||||
|
FText.Draw(ctx, X, Y, FillBg, CharsDelta);
|
||||||
|
end;
|
||||||
|
|
||||||
ctx.restoreGraphicsState;
|
ctx.restoreGraphicsState;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user