Skip to content

Commit

Permalink
Further work on issue JAM-Software#770:
Browse files Browse the repository at this point in the history
* Removed TVirtualTreeHintWindow.FDrawBuffer, we now paint on the canvas driectly
* Removed local variable Shadow, as it was never set to a value different from 0.
* Removed property TextHeight as it was never used.
  • Loading branch information
joachimmarder authored and Sharlikran committed Oct 17, 2018
1 parent f3b1860 commit e361cfc
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions Source/VirtualTrees.pas
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,6 @@ TVTHintData = record
TVirtualTreeHintWindow = class(THintWindow)
strict private
FHintData: TVTHintData;
FDrawBuffer: TBitmap;
FTextHeight: Integer;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
function GetHintWindowDestroyed: Boolean;
Expand All @@ -870,10 +869,8 @@ TVirtualTreeHintWindow = class(THintWindow)
procedure CreateParams(var Params: TCreateParams); override;
procedure Paint; override;

property DrawBuffer: TBitmap read FDrawBuffer;
property HintData: TVTHintData read FHintData;
property HintWindowDestroyed: Boolean read GetHintWindowDestroyed;
property TextHeight: Integer read FTextHeight;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
Expand Down Expand Up @@ -5576,10 +5573,6 @@ constructor TVirtualTreeHintWindow.Create(AOwner: TComponent);

begin
inherited;

FDrawBuffer := TBitmap.Create;
FDrawBuffer.PixelFormat := pf32Bit;
//DoubleBuffered := False; // we do our own buffering
FHintWindowDestroyed := False;
end;

Expand All @@ -5589,7 +5582,6 @@ destructor TVirtualTreeHintWindow.Destroy;

begin
FHintWindowDestroyed := True;
FDrawBuffer.Free;
inherited;
end;

Expand Down Expand Up @@ -5673,7 +5665,6 @@ procedure TVirtualTreeHintWindow.Paint();
Y: Integer;
S: string;
DrawFormat: Cardinal;
Shadow: Integer;
HintKind: TVTHintKind;
LClipRect: TRect;

Expand All @@ -5683,10 +5674,7 @@ procedure TVirtualTreeHintWindow.Paint();
LGradientEnd: TColor;

begin
Shadow := 0; // TODO: This value is never changed
FDrawBuffer.SetSize(Width, Height);

with FHintData, FDrawBuffer do
with FHintData do
begin
// Do actual painting only in the very first run.
// If the given node is nil then we have to display a header hint.
Expand All @@ -5701,10 +5689,10 @@ procedure TVirtualTreeHintWindow.Paint();
if LineBreakStyle = hlbForceMultiLine then
Y := 1
else
Y := (R.Top - R.Bottom - Shadow + Self.Height) div 2;
Y := (R.Top - R.Bottom + Self.Height) div 2;
end;

R := Rect(0, 0, Width - Shadow, Height - Shadow);
R := Rect(0, 0, Width, Height);

HintKind := vhkText;
if Assigned(Node) then
Expand Down Expand Up @@ -5771,8 +5759,6 @@ procedure TVirtualTreeHintWindow.Paint();
Winapi.Windows.DrawTextW(Handle, PWideChar(HintText), Length(HintText), R, DrawFormat);
end;
end;
//TODO: Can we paint on the canvas directly?
BitBlt(Canvas.Handle, 0, 0, Width, Height, FDrawBuffer.Canvas.Handle, 0, 0, SRCCOPY);
end;

//----------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit e361cfc

Please sign in to comment.