Qt,Qt5: fixed radialPie paint with antialiasing. issue #39416

This commit is contained in:
Željan Rikalo 2021-10-11 11:38:04 +02:00
parent 1f1239bb7a
commit c822e57876
4 changed files with 25 additions and 8 deletions

View File

@ -430,12 +430,20 @@ end; {TQtWidgetSet.PromptUser}
function TQtWidgetSet.RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer): Boolean;
var
theWidth,theHeight: Integer;
ARect: QRectFH;
begin
Result := IsValidDC(DC) and (x2 > x1) and (y2 > y1);
if Result then begin
if Result then
begin
theWidth := x2 - x1;
theHeight := y2 - y1;
QPainter_drawPie(TQtDeviceContext(DC).Widget, x1, y1, theWidth, theHeight, Angle1, Angle2);
if QPainter_testRenderHint(TQtDeviceContext(DC).Widget, QPainterAntialiasing) then
begin
ARect := QRectF_Create(x1 + 0.5, y1 + 0.5, theWidth - 0.5, theHeight - 0.5);
QPainter_drawPie(TQtDeviceContext(DC).Widget, ARect, Angle1, Angle2);
QRectF_destroy(ARect);
end else
QPainter_drawPie(TQtDeviceContext(DC).Widget, x1, y1, theWidth, theHeight, Angle1, Angle2);
end;
end;

View File

@ -759,7 +759,7 @@ begin
Result := HRGN(QtRegion);
{$ifdef VerboseQtWinAPI}
WriteLn('Trace: [WinAPI CreateRectRgn] Result: ', dbghex(Result),
' QRegionH: ', dbghex(PtrInt(QtRegion.Widget)));
' QRegionH: ', dbghex(PtrInt(QtRegion.FHandle)));
{$endif}
end;
@ -2760,7 +2760,7 @@ begin
' DC: ', dbghex(DC),
' RGN: ', dbghex(Rgn));
if RGN<>0 then
WriteLn(' QRegionH=', PtrInt(TQtRegion(Rgn).Widget))
WriteLn(' QRegionH=', PtrInt(TQtRegion(Rgn).FHandle))
else
WriteLn(' Rgn=0');
{$endif}
@ -5439,6 +5439,7 @@ function TQtWidgetSet.Polygon(DC: HDC; Points: PPoint; NumPts: Integer;
Winding: boolean): boolean;
var
QtPoints: PQtPoint;
QtPointsF: PQtPointF;
i: integer;
begin
{$ifdef VerboseQtWinAPI}

View File

@ -428,12 +428,20 @@ end; {TQtWidgetSet.PromptUser}
function TQtWidgetSet.RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer): Boolean;
var
theWidth,theHeight: Integer;
ARect: QRectFH;
begin
Result := IsValidDC(DC) and (x2 > x1) and (y2 > y1);
if Result then begin
if Result then
begin
theWidth := x2 - x1;
theHeight := y2 - y1;
QPainter_drawPie(TQtDeviceContext(DC).Widget, x1, y1, theWidth, theHeight, Angle1, Angle2);
if QPainter_testRenderHint(TQtDeviceContext(DC).Widget, QPainterAntialiasing) then
begin
ARect := QRectF_Create(x1 + 0.5, y1 + 0.5, theWidth - 0.5, theHeight - 0.5);
QPainter_drawPie(TQtDeviceContext(DC).Widget, ARect, Angle1, Angle2);
QRectF_destroy(ARect);
end else
QPainter_drawPie(TQtDeviceContext(DC).Widget, x1, y1, theWidth, theHeight, Angle1, Angle2);
end;
end;

View File

@ -751,7 +751,7 @@ begin
Result := HRGN(TQtRegion.Create(True, X1, Y1, X2, Y2));
{$ifdef VerboseQtWinAPI}
WriteLn('Trace: [WinAPI CreateRectRgn] Result: ', dbghex(Result),
' QRegionH: ', dbghex(PtrUInt(TQtRegion(Result).Widget)));
' QRegionH: ', dbghex(PtrUInt(TQtRegion(Result).FHandle)));
{$endif}
end;
@ -2703,7 +2703,7 @@ begin
' DC: ', dbghex(DC),
' RGN: ', dbghex(Rgn));
if RGN<>0 then
WriteLn(' QRegionH=', PtrInt(TQtRegion(Rgn).Widget))
WriteLn(' QRegionH=', PtrInt(TQtRegion(Rgn).FHandle))
else
WriteLn(' Rgn=0');
{$endif}