mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 13:00:25 +02:00
LCL-GTK3: Improve canvas artifacts, swapped RGB colors etc. Issue #36374, patch from Anton Kavalenka + Alexey Tor.
git-svn-id: trunk@62356 -
This commit is contained in:
parent
4213fd0677
commit
ffa116207f
@ -1329,17 +1329,15 @@ procedure TGtk3DeviceContext.drawRect(x1: Integer; y1: Integer; w: Integer;
|
|||||||
begin
|
begin
|
||||||
cairo_save(Widget);
|
cairo_save(Widget);
|
||||||
try
|
try
|
||||||
applyPen;
|
ApplyPen;
|
||||||
// strange about adding +1 -1 to rectangle, but this works ok.
|
|
||||||
//cairo_rectangle(Widget, x1 + 1, y1 + 1, w - 1, h -1);
|
|
||||||
cairo_rectangle(Widget, x1, y1, w, h);
|
cairo_rectangle(Widget, x1, y1, w, h);
|
||||||
|
cairo_stroke(Widget);
|
||||||
if AFill then
|
if AFill then
|
||||||
begin
|
begin
|
||||||
cairo_stroke_preserve(Widget);
|
cairo_rectangle(Widget, x1, y1, w - 1, h - 1);
|
||||||
applyBrush;
|
ApplyBrush;
|
||||||
cairo_fill_preserve(Widget);
|
cairo_fill(Widget);
|
||||||
end else
|
end;
|
||||||
cairo_stroke(Widget);
|
|
||||||
finally
|
finally
|
||||||
cairo_restore(Widget);
|
cairo_restore(Widget);
|
||||||
end;
|
end;
|
||||||
@ -1422,8 +1420,29 @@ end;
|
|||||||
|
|
||||||
procedure TGtk3DeviceContext.drawEllipse(x: Integer; y: Integer; w: Integer;
|
procedure TGtk3DeviceContext.drawEllipse(x: Integer; y: Integer; w: Integer;
|
||||||
h: Integer);
|
h: Integer);
|
||||||
|
var
|
||||||
|
save_matrix:cairo_matrix_t;
|
||||||
begin
|
begin
|
||||||
|
cairo_save(Widget);
|
||||||
|
cairo_get_matrix(Widget, @save_matrix);
|
||||||
|
cairo_translate (Widget, x + w / 2.0, y + h / 2.0);
|
||||||
|
cairo_scale (Widget, w / 2.0, h / 2.0);
|
||||||
|
cairo_new_path(Widget);
|
||||||
|
cairo_arc
|
||||||
|
(
|
||||||
|
(*cr =*) Widget,
|
||||||
|
(*xc =*) 0,
|
||||||
|
(*yc =*) 0,
|
||||||
|
(*radius =*) 1,
|
||||||
|
(*angle1 =*) 0,
|
||||||
|
(*angle2 =*) 2 * Pi
|
||||||
|
);
|
||||||
|
cairo_close_path(Widget);
|
||||||
|
ApplyBrush;
|
||||||
|
cairo_fill_preserve(Widget);
|
||||||
|
cairo_restore(Widget);
|
||||||
|
ApplyPen;
|
||||||
|
cairo_stroke(Widget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtk3DeviceContext.drawSurface(targetRect: PRect;
|
procedure TGtk3DeviceContext.drawSurface(targetRect: PRect;
|
||||||
|
@ -1053,10 +1053,8 @@ end;
|
|||||||
|
|
||||||
function TGtk3WidgetSet.Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean;
|
function TGtk3WidgetSet.Ellipse(DC: HDC; x1, y1, x2, y2: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF GTK3DEBUGNOTIMPLEMENTED}
|
TGtk3DeviceContext(DC).drawEllipse(x1,y1,x2-x1,y2-y1);
|
||||||
DebugLn('WARNING: TGtk3WidgetSet.Ellipse not implemented ...');
|
Result:=true;
|
||||||
{$ENDIF}
|
|
||||||
Result:=inherited Ellipse(DC, x1, y1, x2, y2);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk3WidgetSet.EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal
|
function TGtk3WidgetSet.EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal
|
||||||
@ -3265,7 +3263,9 @@ begin
|
|||||||
R := NormalizeRect(Rect(X1, Y1, X2, Y2));
|
R := NormalizeRect(Rect(X1, Y1, X2, Y2));
|
||||||
if IsRectEmpty(R) then Exit(True);
|
if IsRectEmpty(R) then Exit(True);
|
||||||
with R do
|
with R do
|
||||||
TGtk3DeviceContext(DC).drawRect(Left, Top, Right - Left, Bottom - Top, false);
|
TGtk3DeviceContext(DC).drawRect(Left, Top, Right - Left, Bottom - Top,
|
||||||
|
TGtk3DeviceContext(DC).CurrentBrush.Style<>BS_NULL{bsClear}
|
||||||
|
);
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user