gtk2: when FillRect is called with a hatched/bitmap brush first fill the rect with a BkColor if BkMode = OPAQUE

git-svn-id: trunk@31472 -
This commit is contained in:
paul 2011-06-30 10:09:56 +00:00
parent e8085ad171
commit cb7061fa17
4 changed files with 18 additions and 6 deletions

View File

@ -339,6 +339,7 @@ type
StackAddrs: TCallBacksArray;
{$endif}
PenPos: TPoint;
BkMode: Integer;
CurrentTextColor: TGDIColor;
CurrentBackColor: TGDIColor;
DCTextMetric: TDevContextTextMetric; // only valid if dcfTextMetricsValid set

View File

@ -1060,7 +1060,7 @@ end;
constructor TGtkDeviceContext.Create;
begin
// nothing
BkMode := OPAQUE;
end;
{------------------------------------------------------------------------------

View File

@ -3507,10 +3507,19 @@ end;
bottom borders of the rectangle.
------------------------------------------------------------------------------}
function TGtk2WidgetSet.FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean;
var
TempBr: HBrush;
begin
Result := IsValidDC(DC) and IsValidGDIObject(Brush);
if not Result or IsRectEmpty(Rect) then
exit;
Exit;
if (PGdiObject(Brush)^.GDIBrushFill <> GDK_SOLID) and (TGtkDeviceContext(DC).BkMode = OPAQUE) then
begin
// fill a rectangle with a solid back color first
TempBr := CreateSolidBrush(TGtkDeviceContext(DC).CurrentBackColor.ColorRef);
TGtkDeviceContext(DC).FillRect(Rect, TempBr, True);
DeleteObject(TempBr);
end;
Result := TGtkDeviceContext(DC).FillRect(Rect, Brush, True);
//DebugLn(Format('trace:< [TGtk2WidgetSet.FillRect] DC:0x%x; Rect: ((%d,%d)(%d,%d)); brush: %x', [Integer(DC), Rect.left, rect.top, rect.right, rect.bottom, brush]));
end;
@ -6231,7 +6240,7 @@ end;
------------------------------------------------------------------------------}
function TGtk2WidgetSet.IsWindowVisible(handle: HWND): boolean;
begin
Result:=(handle<>0) and GTK_WIDGET_VISIBLE(PGtkWidget(handle));
Result := (handle <> 0) and GTK_WIDGET_VISIBLE(PGtkWidget(handle));
end;
function TGtk2WidgetSet.IsZoomed(handle: HWND): boolean;
@ -7707,12 +7716,13 @@ end;
Returns:
------------------------------------------------------------------------------}
function TGtk2WidgetSet.SetBkMode(DC: HDC; bkMode : Integer) : Integer;
function TGtk2WidgetSet.SetBkMode(DC: HDC; bkMode: Integer) : Integer;
var
DevCtx: TGtkDeviceContext absolute DC;
begin
// Your code here
Result:=0;
Result := DevCtx.BkMode;
DevCtx.BkMode := bkMode;
end;
{------------------------------------------------------------------------------

View File

@ -617,7 +617,8 @@ begin
gtk_window_set_default_size(GtkWindow, Max(1,AForm.Width), Max(1,AForm.Height));
gtk_widget_set_uposition(PGtkWidget(GtkWindow), AForm.Left, AForm.Top);
GtkWindowShowModal(AForm, GtkWindow);
end else
end
else
Gtk2WidgetSet.SetVisible(AWinControl, AForm.HandleObjectShouldBeVisible);
InvalidateLastWFPResult(AWinControl, AWinControl.BoundsRect);
end;