Gtk2: fixed drawing of text with solid brush. issue #21863

git-svn-id: trunk@37029 -
This commit is contained in:
zeljko 2012-04-26 06:48:06 +00:00
parent 83ced3ec16
commit d9d4cafa40

View File

@ -3899,8 +3899,7 @@ begin
((Options and ETO_OPAQUE) = 0) and (DevCtx.BkMode = OPAQUE) then ((Options and ETO_OPAQUE) = 0) and (DevCtx.BkMode = OPAQUE) then
// (Rect = nil) then TODO: see if Rect<> nil is needed // (Rect = nil) then TODO: see if Rect<> nil is needed
begin begin
//writeln('<*> Brush ? ',DevCtx.GDIObjects[gdiBrush]^.GDIBrushFill,' MODE ',DevCtx.BkMode, EnsureGCColor(DC, dccGDIBrushColor, DevCtx.GDIObjects[gdiBrush]^.GDIBrushFill = GDK_SOLID, True);
// ' ClipRect ',dbgs(RectFromGdkRect(DevCtx.ClipRect)));
BackGroundColor := @DevCtx.GDIObjects[gdiBrush]^.GDIBrushColor.Color; BackGroundColor := @DevCtx.GDIObjects[gdiBrush]^.GDIBrushColor.Color;
end; end;
@ -9629,6 +9628,7 @@ var
DevCtx: TGtk2DeviceContext absolute DC; DevCtx: TGtk2DeviceContext absolute DC;
DCOrigin: TPoint; DCOrigin: TPoint;
yOffset: integer; yOffset: integer;
BackGroundColor: PGdkColor;
begin begin
Result := IsValidDC(DC); Result := IsValidDC(DC);
if not Result then Exit; if not Result then Exit;
@ -9649,9 +9649,16 @@ begin
DevCtx.SelectedColors := dcscCustom; DevCtx.SelectedColors := dcscCustom;
EnsureGCColor(DC, dccCurrentTextColor, True, False); EnsureGCColor(DC, dccCurrentTextColor, True, False);
BackGroundColor := nil;
if (DevCtx.GDIObjects[gdiBrush] <> nil) and (DevCtx.BkMode = OPAQUE) then
begin
EnsureGCColor(DC, dccCurrentBackColor, DevCtx.GDIObjects[gdiBrush]^.GDIBrushFill = GDK_SOLID, True);
BackGroundColor := @DevCtx.CurrentBackColor.Color;
end;
DevCtx.DrawTextWithColors(Str, Count, DevCtx.DrawTextWithColors(Str, Count,
X + DCOrigin.X, Y + DCOrigin.Y + yOffset, X + DCOrigin.X, Y + DCOrigin.Y + yOffset,
nil, nil); nil, BackGroundColor);
end; end;
function TGtk2WidgetSet.UpdateWindow(Handle: HWND): Boolean; function TGtk2WidgetSet.UpdateWindow(Handle: HWND): Boolean;