1. create a new method prototype
after line 52 at image.h
- Code: Select all
1
2
3
4
5
6// Load an image from a file
Surface* LoadImage( const TCHAR* filename );
// new code!
// Load an image from a file
Surface* LoadImageSH( const TCHAR* filename );[/b]6 lines; 2 keywds; 0 nums; 13 ops; 0 strs; 3 coms Syntactic Coloring v0.4 - Dan East
LoadImageSH calls SHLoadImageFile and don't needs separate memory mapping or decompress.
2. implement the new method at image.cpp
after line 240:
- Code: Select all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24Surface* LoadImage( const TCHAR* filename )
{
Internal::MemoryFile file( filename );
if (!file.IsOpen())
return 0;
return DecompressImage( file.begin(), file.end() );
}
// new code!
Surface* LoadImageSH( const TCHAR* filename )
{
Surface* pSurface = NULL;
HBITMAP hBitmap = SHLoadImageFile( filename );
if( NULL != hBitmap )
{
pSurface = CreateSurface( hBitmap );
DeleteObject( hBitmap );
}
return pSurface;
}24 lines; 7 keywds; 1 nums; 55 ops; 0 strs; 1 coms Syntactic Coloring v0.4 - Dan East
3. add pragma comment to image.cpp for new bindings
after line 24:
- Code: Select all
1
2
3
4
5
6#ifdef _WIN32_WCE
#include "foreign/imgdecmp/imgdecmp.h"
#pragma comment( lib, "imgdecmp.lib" )
// new code
#pragma comment( lib, "Aygshell.lib" ) //new lib!
#else6 lines; 5 keywds; 0 nums; 6 ops; 3 strs; 2 coms Syntactic Coloring v0.4 - Dan East
4. don't call
- Code: Select all
1
2
3Surface* pSurface = LoadImage( pDisplay, _T( "\\Program Files\\...\\gfx.png" ) );
// or
Surface* pSurface = LoadImage( _T( "\\Program Files\\...\\gfx.png" ) );3 lines; 0 keywds; 0 nums; 15 ops; 2 strs; 1 coms Syntactic Coloring v0.4 - Dan East
better call
- Code: Select all
1Surface* pSurface = LoadImageSH( _T( "\\Program Files\\...\\gfx.png" ) );1 lines; 0 keywds; 0 nums; 7 ops; 1 strs; 0 coms Syntactic Coloring v0.4 - Dan East
5. recompile PocketFrog AND replace the lib's...
this works fine for me...[/code]
