mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 05:19:27 +02:00
LCL; TCustomImage: comment
git-svn-id: trunk@24892 -
This commit is contained in:
parent
785ebd8f90
commit
84d4e6bf32
@ -601,7 +601,7 @@ type
|
|||||||
FProportional: Boolean;
|
FProportional: Boolean;
|
||||||
FTransparent: Boolean;
|
FTransparent: Boolean;
|
||||||
FStretch: Boolean;
|
FStretch: Boolean;
|
||||||
FUseParentCanvas: boolean;
|
FUseAncestorCanvas: boolean;
|
||||||
function GetCanvas: TCanvas;
|
function GetCanvas: TCanvas;
|
||||||
procedure SetPicture(const AValue: TPicture);
|
procedure SetPicture(const AValue: TPicture);
|
||||||
procedure SetCenter(const AValue : Boolean);
|
procedure SetCenter(const AValue : Boolean);
|
||||||
|
@ -27,7 +27,7 @@ begin
|
|||||||
FTransparent := False;
|
FTransparent := False;
|
||||||
FPicture := TPicture.Create;
|
FPicture := TPicture.Create;
|
||||||
FPicture.OnChange := @PictureChanged;
|
FPicture.OnChange := @PictureChanged;
|
||||||
FUseParentCanvas := False;
|
FUseAncestorCanvas := False;
|
||||||
SetInitialBounds(0, 0, GetControlClassDefaultSize.X, GetControlClassDefaultSize.Y);
|
SetInitialBounds(0, 0, GetControlClassDefaultSize.X, GetControlClassDefaultSize.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ var
|
|||||||
TempBitmap: TBitmap;
|
TempBitmap: TBitmap;
|
||||||
begin
|
begin
|
||||||
//debugln('TCustomImage.GetCanvas A ',DbgSName(Self),' ',DbgSName(FPicture.Graphic));
|
//debugln('TCustomImage.GetCanvas A ',DbgSName(Self),' ',DbgSName(FPicture.Graphic));
|
||||||
if not FUseParentCanvas and (FPicture.Graphic = nil) then
|
if not FUseAncestorCanvas and (FPicture.Graphic = nil) then
|
||||||
begin
|
begin
|
||||||
// make a new bitmap to draw on
|
// make a new bitmap to draw on
|
||||||
TempBitmap := TBitmap.Create;
|
TempBitmap := TBitmap.Create;
|
||||||
@ -56,9 +56,9 @@ begin
|
|||||||
TempBitmap.Free;
|
TempBitmap.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
//debugln('TCustomImage.GetCanvas B ',DbgSName(Self),' ',DbgSName(FPicture.Graphic));
|
//debugln(['TCustomImage.GetCanvas B ',DbgSName(Self),' ',DbgSName(FPicture.Graphic),' FUseParentCanvas=',FUseAncestorCanvas]);
|
||||||
// try draw on the bitmap, not on the form's canvas
|
// try draw on the bitmap, not on the form's canvas
|
||||||
if not FUseParentCanvas and (FPicture.Graphic is TBitmap) then
|
if not FUseAncestorCanvas and (FPicture.Graphic is TBitmap) then
|
||||||
Result := TBitmap(FPicture.Graphic).Canvas
|
Result := TBitmap(FPicture.Graphic).Canvas
|
||||||
else
|
else
|
||||||
Result := inherited Canvas;
|
Result := inherited Canvas;
|
||||||
@ -195,7 +195,7 @@ var
|
|||||||
C: TCanvas;
|
C: TCanvas;
|
||||||
begin
|
begin
|
||||||
// detect loop
|
// detect loop
|
||||||
if FUseParentCanvas then exit;
|
if FUseAncestorCanvas then exit;
|
||||||
|
|
||||||
if csDesigning in ComponentState
|
if csDesigning in ComponentState
|
||||||
then DrawFrame;
|
then DrawFrame;
|
||||||
@ -207,11 +207,11 @@ begin
|
|||||||
R := DestRect;
|
R := DestRect;
|
||||||
C.StretchDraw(R, Picture.Graphic);
|
C.StretchDraw(R, Picture.Graphic);
|
||||||
|
|
||||||
|
FUseAncestorCanvas := True;
|
||||||
try
|
try
|
||||||
FUseParentCanvas := True;
|
|
||||||
inherited Paint;
|
inherited Paint;
|
||||||
finally
|
finally
|
||||||
FUseParentCanvas := False;
|
FUseAncestorCanvas := False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user