aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UTexture.pas
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-20 11:45:24 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-20 11:45:24 +0000
commit707441e6eac0f628f9c61f0130df07c6768ba291 (patch)
tree46face105bdde202f0ca051903f710bc76d5fe97 /Game/Code/Classes/UTexture.pas
parent333ec29a5275fb851f38f7be695930ea1dfe8340 (diff)
downloadusdx-707441e6eac0f628f9c61f0130df07c6768ba291.tar.gz
usdx-707441e6eac0f628f9c61f0130df07c6768ba291.tar.xz
usdx-707441e6eac0f628f9c61f0130df07c6768ba291.zip
tidy texture loading.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@421 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UTexture.pas')
-rw-r--r--Game/Code/Classes/UTexture.pas17
1 files changed, 10 insertions, 7 deletions
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas
index 389dd0b0..f01cfd23 100644
--- a/Game/Code/Classes/UTexture.pas
+++ b/Game/Code/Classes/UTexture.pas
@@ -90,8 +90,8 @@ type
TTextureUnit = class
private
- function LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boolean;
- function LoadJpeg( aSourceStream : TStream; aIMG : TBitMap ): boolean;
+ function LoadBitmap( const aSourceStream : TStream; const aIMG : TBitMap ): boolean;
+ function LoadJpeg( const aSourceStream : TStream; const aIMG : TBitMap ): boolean;
public
Limit: integer;
CreateCacheMipmap: boolean;
@@ -312,7 +312,7 @@ begin
end;
-function TTextureUnit.LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boolean;
+function TTextureUnit.LoadBitmap( const aSourceStream : TStream; const aIMG : TBitMap ): boolean;
begin
result := false;
try
@@ -325,7 +325,7 @@ begin
end;
end;
-function TTextureUnit.LoadJpeg( aSourceStream : TStream; aIMG : TBitMap ): boolean;
+function TTextureUnit.LoadJpeg( const aSourceStream : TStream; const aIMG : TBitMap ): boolean;
var
TextureJ: TJPEGImage;
begin
@@ -396,7 +396,6 @@ begin
if FromRegistry then
begin
try
- // Res := TResourceStream.Create(HInstance, Identifier, Format);
lTextureStream := TResourceStream.Create(HInstance, Identifier, Format);
// TEmp, untill all code is moved to refactord way..
@@ -413,7 +412,9 @@ begin
begin
// Get the File Extension...
Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3)));
- lTextureStream := TFileStream.create( Identifier , fmOpenRead or fmShareDenyNone );
+
+ lTextureStream := TMemoryStream.create();
+ TMemoryStream(lTextureStream).loadfromfile( Identifier );
end;
end;
@@ -990,7 +991,9 @@ begin
if Log.BenchmarkTimeLength[4] >= 1 then
Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4);
- end; // logerror
+ end; // logerror
+
+// freeandnil( lTextureStream ); // TODO - jb - free this.. but we cant at the moment :(
// {$ENDIF}
end;