lcl: TSharedCustomBitmap IsEmpty should differ from TRasterImage. TRasterImage only checks stream and handle, but TSharedCustomBitmap also has an image which can contain data and thus must be checked too. fixes #0011222

git-svn-id: trunk@15578 -
This commit is contained in:
paul 2008-06-26 15:00:20 +00:00
parent beff60f884
commit 5e85db3260
2 changed files with 13 additions and 1 deletions

View File

@ -1081,7 +1081,7 @@ type
protected
procedure FreeHandle; override;
function ReleaseHandle: THandle; virtual;
function IsEmpty: boolean;
function IsEmpty: boolean; virtual;
public
constructor Create; virtual;
procedure CreateDefaultHandle(AWidth, AHeight: Integer; ABPP: Byte); virtual; abstract;
@ -1218,6 +1218,7 @@ type
procedure FreeImage;
function ReleasePalette: HPALETTE;
function GetPixelFormat: TPixelFormat;
function IsEmpty: boolean; override;
public
constructor Create; override;
destructor Destroy; override;

View File

@ -19,6 +19,7 @@
constructor TSharedCustomBitmap.Create;
begin
inherited Create;
FImage.Init;
end;
destructor TSharedCustomBitmap.Destroy;
@ -86,6 +87,16 @@ begin
Result := pfCustom;
end;
function TSharedCustomBitmap.IsEmpty: boolean;
begin
Result := inherited IsEmpty and not
(
(FImage.Description.Format <> ricfNone) and
(FImage.Data <> nil) and
(FImage.DataSize <> 0)
);
end;
function TSharedCustomBitmap.GetWidth: Integer;
begin
if FImage.Description.Format = ricfNone