forked from qdtroy/DuiLib_Ultimate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
703 changed files
with
97,284 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
*.ilk | ||
*.pdb | ||
*.map | ||
*.bsc | ||
*.sdf | ||
*.ipch | ||
*.obj | ||
*.sbr | ||
*.manifest | ||
*.pch | ||
*.tlog | ||
*.log | ||
*.idb | ||
*.opensdf | ||
*.lastbuildstate | ||
*.exe | ||
*.dll | ||
*.cache | ||
*.exp | ||
*.aps | ||
*.iobj | ||
Temp/duidemo/Debug/duidemo.res | ||
Temp/duidemo/Debug/duidemo_d.exe.embed.manifest.res | ||
Temp/duidemo/Debug/duidemo_d_manifest.rc | ||
Lib/DuiLib_d.lib | ||
*.suo | ||
DuiLib.suo | ||
*.user | ||
*.suo | ||
*.suo | ||
*.res | ||
Temp/duidemo/Debug/MFCApp_manifest.rc | ||
*.unsuccessfulbuild | ||
Temp | ||
*.ilk | ||
Demos/ADMonSetup/SDebug/ | ||
3rd/libcef_dll_wrapper/Lib/ | ||
DuiLib.VC.db | ||
DuiLib2015.VC.db | ||
DuiLib2015.sln | ||
Demos/ADMonSetup/Debug/ | ||
.vs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
/* | ||
* TIFF file IO, using CxFile. | ||
*/ | ||
|
||
#ifdef WIN32 | ||
#include <windows.h> | ||
#endif | ||
#include <stdio.h> | ||
|
||
#include "ximage.h" | ||
|
||
#if CXIMAGE_SUPPORT_TIF | ||
|
||
#include "../tiff/tiffiop.h" | ||
#include "../tiff/tiffvers.h" | ||
|
||
#include "xfile.h" | ||
|
||
static tsize_t | ||
_tiffReadProcEx(thandle_t fd, tdata_t buf, tsize_t size) | ||
{ | ||
return (tsize_t)((CxFile*)fd)->Read(buf, 1, size); | ||
} | ||
|
||
static tsize_t | ||
_tiffWriteProcEx(thandle_t fd, tdata_t buf, tsize_t size) | ||
{ | ||
return (tsize_t)((CxFile*)fd)->Write(buf, 1, size); | ||
} | ||
|
||
static toff_t | ||
_tiffSeekProcEx(thandle_t fd, toff_t off, int whence) | ||
{ | ||
if ( off == 0xFFFFFFFF ) | ||
return 0xFFFFFFFF; | ||
if (!((CxFile*)fd)->Seek(off, whence)) | ||
return 0xFFFFFFFF; | ||
if (whence == SEEK_SET) | ||
return off; | ||
|
||
return (toff_t)((CxFile*)fd)->Tell(); | ||
} | ||
|
||
// Return nonzero if error | ||
static int | ||
_tiffCloseProcEx(thandle_t /*fd*/) | ||
{ | ||
// return !((CxFile*)fd)->Close(); // "//" needed for memory files <DP> | ||
return 0; | ||
} | ||
|
||
#include <sys/stat.h> | ||
|
||
static toff_t | ||
_tiffSizeProcEx(thandle_t fd) | ||
{ | ||
return ((CxFile*)fd)->Size(); | ||
} | ||
|
||
static int | ||
_tiffMapProcEx(thandle_t /*fd*/, tdata_t* /*pbase*/, toff_t* /*psize*/) | ||
{ | ||
return (0); | ||
} | ||
|
||
static void | ||
_tiffUnmapProcEx(thandle_t /*fd*/, tdata_t /*base*/, toff_t /*size*/) | ||
{ | ||
} | ||
|
||
// Open a TIFF file descriptor for read/writing. | ||
/* | ||
TIFF* | ||
TIFFOpen(const char* name, const char* mode) | ||
{ | ||
static const char module[] = "TIFFOpen"; | ||
FILE* stream = fopen(name, mode); | ||
if (stream == NULL) | ||
{ | ||
TIFFError(module, "%s: Cannot open", name); | ||
return NULL; | ||
} | ||
return (TIFFFdOpen((int)stream, name, mode)); | ||
} | ||
*/ | ||
|
||
TIFF* | ||
_TIFFFdOpen(void* fd, const char* name, const char* mode) | ||
{ | ||
TIFF* tif; | ||
|
||
tif = TIFFClientOpen(name, mode, | ||
(thandle_t) fd, | ||
_tiffReadProcEx, _tiffWriteProcEx, _tiffSeekProcEx, _tiffCloseProcEx, | ||
_tiffSizeProcEx, _tiffMapProcEx, _tiffUnmapProcEx); | ||
if (tif) | ||
{ | ||
tif->tif_fd = (int)fd; | ||
} | ||
return (tif); | ||
} | ||
|
||
extern "C" TIFF* _TIFFOpenEx(CxFile* stream, const char* mode) | ||
{ | ||
return (_TIFFFdOpen(stream, "TIFF IMAGE", mode)); | ||
} | ||
|
||
#ifdef __GNUC__ | ||
extern char* malloc(); | ||
extern char* realloc(); | ||
#else | ||
#include <malloc.h> | ||
#endif | ||
|
||
tdata_t | ||
_TIFFmalloc(tsize_t s) | ||
{ | ||
return (malloc((size_t) s)); | ||
} | ||
|
||
void | ||
_TIFFfree(tdata_t p) | ||
{ | ||
free(p); | ||
} | ||
|
||
tdata_t | ||
_TIFFrealloc(tdata_t p, tsize_t s) | ||
{ | ||
return (realloc(p, (size_t) s)); | ||
} | ||
|
||
void | ||
_TIFFmemset(tdata_t p, int v, tsize_t c) | ||
{ | ||
memset(p, v, (size_t) c); | ||
} | ||
|
||
void | ||
_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c) | ||
{ | ||
memcpy(d, s, (size_t) c); | ||
} | ||
|
||
int | ||
_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c) | ||
{ | ||
return (memcmp(p1, p2, (size_t) c)); | ||
} | ||
|
||
#ifndef UNICODE | ||
#define DbgPrint wvsprintf | ||
#define DbgPrint2 wsprintf | ||
#define DbgMsgBox MessageBox | ||
#else | ||
#define DbgPrint wvsprintfA | ||
#define DbgPrint2 wsprintfA | ||
#define DbgMsgBox MessageBoxA | ||
#endif | ||
|
||
static void | ||
Win32WarningHandler(const char* module, const char* fmt, va_list ap) | ||
{ | ||
#ifdef _DEBUG | ||
#if (!defined(_CONSOLE) && !defined(_WIN32_WCE) && defined(WIN32)) | ||
LPSTR szTitle; | ||
LPSTR szTmp; | ||
LPCSTR szTitleText = "%s Warning"; | ||
LPCSTR szDefaultModule = "TIFFLIB"; | ||
szTmp = (module == NULL) ? (LPSTR)szDefaultModule : (LPSTR)module; | ||
if ((szTitle = (LPSTR)LocalAlloc(LMEM_FIXED, (strlen(szTmp) + | ||
strlen(szTitleText) + strlen(fmt) + 128))) == NULL) | ||
return; | ||
DbgPrint2(szTitle, szTitleText, szTmp); | ||
szTmp = szTitle + (strlen(szTitle)+2); | ||
DbgPrint(szTmp, fmt, ap); | ||
DbgMsgBox(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONINFORMATION); | ||
LocalFree(szTitle); | ||
return; | ||
#else | ||
if (module != NULL) | ||
fprintf(stderr, "%s: ", module); | ||
fprintf(stderr, "Warning, "); | ||
vfprintf(stderr, fmt, ap); | ||
fprintf(stderr, ".\n"); | ||
#endif | ||
#endif | ||
} | ||
TIFFErrorHandler _TIFFwarningHandler = Win32WarningHandler; | ||
|
||
static void | ||
Win32ErrorHandler(const char* module, const char* fmt, va_list ap) | ||
{ | ||
#ifdef _DEBUG | ||
#if (!defined(_CONSOLE) && !defined(_WIN32_WCE) && defined(WIN32)) | ||
LPSTR szTitle; | ||
LPSTR szTmp; | ||
LPCSTR szTitleText = "%s Error"; | ||
LPCSTR szDefaultModule = "TIFFLIB"; | ||
szTmp = (module == NULL) ? (LPSTR)szDefaultModule : (LPSTR)module; | ||
if ((szTitle = (LPSTR)LocalAlloc(LMEM_FIXED, (strlen(szTmp) + | ||
strlen(szTitleText) + strlen(fmt) + 128))) == NULL) | ||
return; | ||
DbgPrint2(szTitle, szTitleText, szTmp); | ||
szTmp = szTitle + (strlen(szTitle)+2); | ||
DbgPrint(szTmp, fmt, ap); | ||
DbgMsgBox(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONEXCLAMATION); | ||
LocalFree(szTitle); | ||
return; | ||
#else | ||
if (module != NULL) | ||
fprintf(stderr, "%s: ", module); | ||
vfprintf(stderr, fmt, ap); | ||
fprintf(stderr, ".\n"); | ||
#endif | ||
#endif | ||
} | ||
TIFFErrorHandler _TIFFerrorHandler = Win32ErrorHandler; | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* File: xfile.h | ||
* Purpose: General Purpose File Class | ||
*/ | ||
/* | ||
-------------------------------------------------------------------------------- | ||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: | ||
CxFile (c) 11/May/2002 Davide Pizzolato - www.xdp.it | ||
CxFile version 2.00 23/Aug/2002 | ||
CxFile version 2.10 16/Dec/2007 | ||
Special thanks to Chris Shearer Cooper for new features, enhancements and bugfixes | ||
Covered code is provided under this license on an "as is" basis, without warranty | ||
of any kind, either expressed or implied, including, without limitation, warranties | ||
that the covered code is free of defects, merchantable, fit for a particular purpose | ||
or non-infringing. The entire risk as to the quality and performance of the covered | ||
code is with you. Should any covered code prove defective in any respect, you (not | ||
the initial developer or any other contributor) assume the cost of any necessary | ||
servicing, repair or correction. This disclaimer of warranty constitutes an essential | ||
part of this license. No use of any covered code is authorized hereunder except under | ||
this disclaimer. | ||
Permission is hereby granted to use, copy, modify, and distribute this | ||
source code, or portions hereof, for any purpose, including commercial applications, | ||
freely and without fee, subject to the following restrictions: | ||
1. The origin of this software must not be misrepresented; you must not | ||
claim that you wrote the original software. If you use this software | ||
in a product, an acknowledgment in the product documentation would be | ||
appreciated but is not required. | ||
2. Altered source versions must be plainly marked as such, and must not be | ||
misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source distribution. | ||
-------------------------------------------------------------------------------- | ||
*/ | ||
#if !defined(__xfile_h) | ||
#define __xfile_h | ||
|
||
#if defined (WIN32) || defined (_WIN32_WCE) | ||
#include <windows.h> | ||
#endif | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include "ximadef.h" | ||
|
||
class DLL_EXP CxFile | ||
{ | ||
public: | ||
CxFile(void) { }; | ||
virtual ~CxFile() { }; | ||
|
||
virtual bool Close() = 0; | ||
virtual size_t Read(void *buffer, size_t size, size_t count) = 0; | ||
virtual size_t Write(const void *buffer, size_t size, size_t count) = 0; | ||
virtual bool Seek(int32_t offset, int32_t origin) = 0; | ||
virtual int32_t Tell() = 0; | ||
virtual int32_t Size() = 0; | ||
virtual bool Flush() = 0; | ||
virtual bool Eof() = 0; | ||
virtual int32_t Error() = 0; | ||
virtual bool PutC(uint8_t c) | ||
{ | ||
// Default implementation | ||
size_t nWrote = Write(&c, 1, 1); | ||
return (bool)(nWrote == 1); | ||
} | ||
virtual int32_t GetC() = 0; | ||
virtual char * GetS(char *string, int32_t n) = 0; | ||
virtual int32_t Scanf(const char *format, void* output) = 0; | ||
}; | ||
|
||
#endif //__xfile_h |
Oops, something went wrong.