Gtk2: fixed text background drawing in TGtk2WidgetSet.ExtTextOut() when BkMode = OPAQUE.issue #19384

git-svn-id: trunk@36929 -
This commit is contained in:
zeljko 2012-04-20 13:45:52 +00:00
parent 140d76e610
commit ca6e3b563c

View File

@ -3812,7 +3812,7 @@ var
TopY, LineLen, LineHeight: Integer;
TxtPt: TPoint;
DCOrigin: TPoint;
Foreground: PGDKColor;
Foreground, BackgroundColor: PGDKColor;
CurDx: PInteger;
CurStr: PChar;
@ -3827,7 +3827,7 @@ var
while CurCount > 0 do
begin
CharLen := UTF8CharacterLength(CurStr);
DevCtx.DrawTextWithColors(CurStr, CharLen, CurScreenX, Y, Foreground, nil);
DevCtx.DrawTextWithColors(CurStr, CharLen, CurScreenX, Y, Foreground, BackgroundColor);
inc(CurScreenX, CurDx^);
inc(CurDx);
inc(CurStr, CharLen);
@ -3835,7 +3835,7 @@ var
end;
end
else
DevCtx.DrawTextWithColors(Str, Count, X, Y, Foreground, nil);
DevCtx.DrawTextWithColors(Str, Count, X, Y, Foreground, BackgroundColor);
end;
begin
@ -3854,6 +3854,8 @@ begin
exit;
end;
BackgroundColor := nil;
// to reduce flickering calculate first and then paint
DCOrigin := DevCtx.Offset;
@ -3892,6 +3894,16 @@ begin
Width, Height);
end;
if (DevCtx.GDIObjects[gdiBrush] <> nil) and
((Options and ETO_OPAQUE) = 0) and (DevCtx.BkMode = OPAQUE) then
// (Rect = nil) then TODO: see if Rect<> nil is needed
begin
//writeln('<*> Brush ? ',DevCtx.GDIObjects[gdiBrush]^.GDIBrushFill,' MODE ',DevCtx.BkMode,
// ' ClipRect ',dbgs(RectFromGdkRect(DevCtx.ClipRect)));
BackGroundColor := @DevCtx.GDIObjects[gdiBrush]^.GDIBrushColor.Color;
end;
EnsureGCColor(DC, dccCurrentTextColor, True, False);
Foreground := nil;//StyleForegroundColor(CurrentTextColor.ColorRef, nil);