Qt: Huge boost to designer painting when "Show grid" enabled (on X11 is at least x10)., implemented qtlclintf DrawGrid().

git-svn-id: trunk@17347 -
This commit is contained in:
zeljko 2008-11-11 16:41:48 +00:00
parent dbeb427730
commit e579957f39
2 changed files with 21 additions and 0 deletions

View File

@ -147,6 +147,26 @@ begin
end;
end;
procedure TQtWidgetSet.DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer);
var
QtDC: TQtDeviceContext absolute DC;
X, Y: Integer;
W, H: Integer;
begin
if not IsValidDC(DC) then
exit;
QtDC.save;
try
W := (R.Right - R.Left - 1) div DX;
H := (R.Bottom - R.Top - 1) div DY;
for X := 0 to W do
for Y := 0 to H do
QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1);
finally
QtDC.restore;
end;
end;
{------------------------------------------------------------------------------
Function: FontCanUTF8

View File

@ -40,6 +40,7 @@ function AddProcessEventHandler(AHandle: THandle;
function CreateStandardCursor(ACursor: SmallInt): HCURSOR; override;
procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override;
procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation); override;
procedure DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer); override;
function FontCanUTF8(Font: HFont): boolean; override;
function FontIsMonoSpace(Font: HFont): boolean; override;