diff --git a/lcl/interfaces/gtk2/gtk2winapi.inc b/lcl/interfaces/gtk2/gtk2winapi.inc index 36c8c9b363..ea2d23cb65 100644 --- a/lcl/interfaces/gtk2/gtk2winapi.inc +++ b/lcl/interfaces/gtk2/gtk2winapi.inc @@ -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);