lcl: TCustomImage.Paint: do not invalidate when initializing the image during paint

git-svn-id: trunk@46758 -
This commit is contained in:
mattias 2014-11-05 12:20:06 +00:00
parent 5e6a4176d3
commit 4b679593c8
2 changed files with 14 additions and 1 deletions

View File

@ -480,6 +480,7 @@ type
FTransparent: Boolean;
FStretch: Boolean;
FUseAncestorCanvas: boolean;
FPainting: boolean;
function GetCanvas: TCanvas;
procedure SetAntialiasingMode(AValue: TAntialiasingMode);
procedure SetPicture(const AValue: TPicture);
@ -500,6 +501,7 @@ type
destructor Destroy; override;
property Canvas: TCanvas read GetCanvas;
function DestRect: TRect; virtual;
procedure Invalidate; override;
public
property AntialiasingMode: TAntialiasingMode read FAntialiasingMode write SetAntialiasingMode default amDontCare;
property Align;

View File

@ -163,6 +163,12 @@ begin
OffsetRect(Result,(ImgWidth-PicWidth) div 2,(ImgHeight-PicHeight) div 2);
end;
procedure TCustomImage.Invalidate;
begin
if FPainting then exit;
inherited Invalidate;
end;
procedure TCustomImage.CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer; WithThemeSpace: Boolean);
begin
@ -208,7 +214,12 @@ begin
C := inherited Canvas;
R := DestRect;
C.AntialiasingMode := FAntialiasingMode;
C.StretchDraw(R, Picture.Graphic);
FPainting:=true;
try
C.StretchDraw(R, Picture.Graphic);
finally
FPainting:=false;
end;
FUseAncestorCanvas := True;
try