mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-08 21:09:30 +02:00
* Patch from Ondrej Pokorny to change ImageSize to class function (Bug ID 30094)
git-svn-id: trunk@33638 -
This commit is contained in:
parent
ce66597df8
commit
f65fa34df0
@ -252,29 +252,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFPCustomImageReader.InternalSize(Str: TStream): TPoint;
|
||||
class function TFPCustomImageReader.InternalSize(Str: TStream): TPoint;
|
||||
|
||||
begin
|
||||
Result.X:=-1;
|
||||
Result.Y:=-1;
|
||||
end;
|
||||
|
||||
function TFPCustomImageReader.ImageSize(Str: TStream): TPoint;
|
||||
var InRead : boolean;
|
||||
P : Int64;
|
||||
class function TFPCustomImageReader.ImageSize(Str: TStream): TPoint;
|
||||
var
|
||||
P: Int64;
|
||||
begin
|
||||
InRead := assigned(FStream);
|
||||
if not assigned(Str) then
|
||||
raise FPImageException.Create(ErrorText[StrNoStream]);
|
||||
try
|
||||
FStream := Str;
|
||||
P:=Str.Position;
|
||||
result := InternalSize (Str);
|
||||
Str.Position:=P;
|
||||
finally
|
||||
if not InRead then
|
||||
FStream := nil;
|
||||
end;
|
||||
P:=Str.Position;
|
||||
result := InternalSize (Str);
|
||||
Str.Position:=P;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -208,14 +208,14 @@ type
|
||||
protected
|
||||
procedure InternalRead (Str:TStream; Img:TFPCustomImage); virtual; abstract;
|
||||
function InternalCheck (Str:TStream) : boolean; virtual; abstract;
|
||||
function InternalSize (Str:TStream): TPoint; virtual;
|
||||
class function InternalSize (Str:TStream): TPoint; virtual;
|
||||
public
|
||||
constructor Create; override;
|
||||
function ImageRead (Str:TStream; Img:TFPCustomImage) : TFPCustomImage;
|
||||
// reads image
|
||||
function CheckContents (Str:TStream) : boolean;
|
||||
// Returns true if the content is readable
|
||||
function ImageSize(Str:TStream): TPoint;
|
||||
class function ImageSize(Str:TStream): TPoint;
|
||||
// returns the size of image in stream without loading it completely. -1,-1 means this is not implemented.
|
||||
property DefaultImageClass : TFPCustomImageClass read FDefImageClass write FDefImageClass;
|
||||
// Image Class to create when no img is given for reading
|
||||
|
@ -64,7 +64,7 @@ type
|
||||
protected
|
||||
procedure InternalRead(Str: TStream; Img: TFPCustomImage); override;
|
||||
function InternalCheck(Str: TStream): boolean; override;
|
||||
function InternalSize(Str:TStream): TPoint; override;
|
||||
class function InternalSize(Str:TStream): TPoint; override;
|
||||
public
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
@ -451,7 +451,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFPReaderJPEG.InternalSize(Str: TStream): TPoint;
|
||||
class function TFPReaderJPEG.InternalSize(Str: TStream): TPoint;
|
||||
var
|
||||
JInfo: jpeg_decompress_struct;
|
||||
JError: jpeg_error_mgr;
|
||||
|
Loading…
Reference in New Issue
Block a user