[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] TortoiseIDiff optionally using FreeImage.dll for image loading

From: Will Wilson <willw_at_fireflyworlds.com>
Date: 2006-09-26 19:44:53 CEST

Okay,
        This time with a bit more polish (TM)... :)

> > It's taken a bit of work to do the dynamic linking (function pointer
> > syntax is always ugly), but hopefully it's a nice compromise between
> > binary bloat & supporting loads of image formats - including DDS.
>
> That's a good idea. We could just point users to the download page of
> the dll and keep our installer small.

That's the idea, hopefully not too much of a pain for those that need
the extra formats.

> > To try it out simply compile a patched TortoiseIDiff.exe, drop the
> > FreeImage.dll (see http://freeimage.sourceforge.net/download.html)
> next
> > to it & run the app.
>
> Did that, but crashed immediately :)

Hey, what were you expecting? That I tested it? ;) It worked standalone,
without command-line parameters - although purely by chance!

> +#ifdef UNICODE
> +
> +typedef int (__stdcall
> *FreeImage_GetFileType_t)(const wchar_t
> *filename, int size);
> +typedef int (__stdcall
> *FreeImage_GetFIFFromFilename_t)(const wchar_t
> *filename);
> +typedef void* (__stdcall *FreeImage_Load_t)(int
format, const
> wchar_t
> *filename, int flags);
> +
> +#else // !UNICODE
> +
> +typedef int (__stdcall
> *FreeImage_GetFileType_t)(const char
> *filename, int size);
> +typedef int (__stdcall
> *FreeImage_GetFIFFromFilename_t)(const char
> *filename);
> +typedef void* (__stdcall *FreeImage_Load_t)(int
format, const
> char
> *filename, int flags);
> +
> +#endif
>
> Here, you could just use TCHAR instead of the #ifdef and using
wchar_t*
> and char*.

Agreed & updated. I've made use of the MSLU for the past four years & so
don't touch many _T macros these days...

> - HMODULE hLib = LoadLibrary(_T("gdiplus.dll"));
> - if (hLib)
> {
> - // we have gdiplus, so try loading the picture with that
> one
> - if (GdiplusStartup( &gdiplusToken, &gdiplusStartupInput,
> NULL )==Ok)
> - {
> + HMODULE hFreeImageLib =
LoadLibrary(_T("FreeImage.dll"));
> + FreeImage_GetVersion_t FreeImage_GetVersion = NULL;
>
> You must not remove those lines. The FreeImage lib also uses GDI+ and
> therefore needs the GdiplusStartup() call to work. That's also why it
> crashed on me when I first tried it.

Yep, also now fixed. However it still seems odd that the GDI+ DLL is
released before GdiplusShutdown is called.

> You've also removed our custom handling of icons. Since GDI+ only
loads
> the first icon in an icon file, we have to handle icons ourselves to
> get
> all the sizes and formats.

What, you want icon support as well? ;) Fixed.

Cheers,
        Will.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org

Received on Tue Sep 26 19:45:04 2006

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.