From 6176cdadd9c7a09cc165140f6a6f6a25fa82d971 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 29 Sep 2008 05:04:11 +0000 Subject: [PATCH] lcl: don't SetBkColor when Brush has hatched style (or we'll have solid fill on windows) git-svn-id: trunk@16777 - --- lcl/include/brush.inc | 2 +- lcl/include/canvas.inc | 6 +++++- lcl/interfaces/win32/win32winapi.inc | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lcl/include/brush.inc b/lcl/include/brush.inc index d7ee91f9ae..46df7b777f 100644 --- a/lcl/include/brush.inc +++ b/lcl/include/brush.inc @@ -30,7 +30,6 @@ begin inherited Create(SizeOf(TLogBrush)); end; - { TBrush } {------------------------------------------------------------------------------ @@ -142,6 +141,7 @@ begin FreeReference; FReference._lclHandle := TLCLHandle(Value); + FInternalUpdateIndex := GraphicsUpdateCount; Changed; end; diff --git a/lcl/include/canvas.inc b/lcl/include/canvas.inc index 795924225f..d317c2622c 100644 --- a/lcl/include/canvas.inc +++ b/lcl/include/canvas.inc @@ -129,6 +129,8 @@ end; ------------------------------------------------------------------------------} procedure TCanvas.CreateBrush; +const + HatchBrushes = [bsHorizontal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross]; var OldHandle: HBRUSH; begin @@ -139,7 +141,9 @@ begin if (OldHandle <> HBRUSH(Brush.Reference.Handle)) and (FSavedBrushHandle=0) then FSavedBrushHandle := OldHandle; Include(FState, csBrushValid); - SetBkColor(FHandle, Brush.Color); + // dont use color for hatched brushes. windows cannot draw hatches when SetBkColor is called + if ([Brush.Style] * HatchBrushes) = [] then + SetBkColor(FHandle, Brush.Color); if Brush.Style = bsSolid then SetBkMode(FHandle, OPAQUE) else diff --git a/lcl/interfaces/win32/win32winapi.inc b/lcl/interfaces/win32/win32winapi.inc index 20bad526e1..85a6ee15f6 100644 --- a/lcl/interfaces/win32/win32winapi.inc +++ b/lcl/interfaces/win32/win32winapi.inc @@ -846,7 +846,7 @@ end; The CreateBrushIndirect function creates a logical brush that has the specified style, color, and pattern. ------------------------------------------------------------------------------} -function TWin32WidgetSet.CreateBrushIndirect(Const LogBrush: TLogBrush): HBRUSH; +function TWin32WidgetSet.CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; var LB: Windows.LogBrush; begin