Skip to content

Commit a960d92

Browse files
author
LocalIdentity
committed
Merge remote-tracking branch 'dclamage/remove-tiff'
2 parents 1d4937f + 401d590 commit a960d92

7 files changed

Lines changed: 4 additions & 189 deletions

File tree

SimpleGraphic.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
<GenerateDebugInformation>true</GenerateDebugInformation>
145145
<EnableUAC>false</EnableUAC>
146146
<AdditionalLibraryDirectories>$(SolutionDir)vcpkg\installed\x86-windows-static\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
147-
<AdditionalDependencies>gif.lib;jpeg.lib;lzma.lib;libpng16.lib;lua51.lib;tiff.lib;zlib.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
147+
<AdditionalDependencies>gif.lib;jpeg.lib;lzma.lib;libpng16.lib;lua51.lib;zlib.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
148148
</Link>
149149
</ItemDefinitionGroup>
150150
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

SimpleGraphic.vcxproj.filters

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ItemGroup>
44
<Filter Include="Resource Files">
55
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
6-
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
6+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;png;wav;mfcribbon-ms</Extensions>
77
</Filter>
88
<Filter Include="UI">
99
<UniqueIdentifier>{a5dff788-b233-499b-9e81-9fd39c493de0}</UniqueIdentifier>

engine/core/core_image.cpp

Lines changed: 1 addition & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "core_image.h"
1010

1111
#include <jpeglib.h>
12-
#include <tiffio.h>
1312
#include <png.h>
1413
#include <gif_lib.h>
1514

@@ -19,7 +18,7 @@
1918

2019
#define BLP2_MAGIC 0x32504C42 // "BLP2"
2120

22-
// Generic client data structure, used by JPEG, TIFF and PNG
21+
// Generic client data structure, used by JPEG and PNG
2322
struct clientData_s {
2423
IConsole* con;
2524
const char* fileName;
@@ -89,9 +88,6 @@ image_c* image_c::LoaderForFile(IConsole* conHnd, const char* fileName)
8988
if (dat[0] == 0xFF && dat[1] == 0xD8) {
9089
// JPEG Start Of Image marker
9190
return new jpeg_c(conHnd);
92-
} else if (*(dword*)dat == 0x002A4949 || *(dword*)dat == 0x2A004D4D) {
93-
// Little-endian / Big-endian marker + version
94-
return new tiff_c(conHnd);
9591
} else if (*(dword*)dat == 0x474E5089) {
9692
// 0x89 P N G
9793
return new png_c(conHnd);
@@ -624,163 +620,6 @@ bool jpeg_c::ImageInfo(const char* fileName, imageInfo_s* info)
624620
return (comp != 1 && comp != 3);
625621
}
626622

627-
// ==========
628-
// TIFF Image
629-
// ==========
630-
631-
static void ITIFF_ErrorProc(thandle_t clientData, const char* module, const char* fmt, va_list va)
632-
{
633-
clientData_s* cd = (clientData_s*)clientData;
634-
char text[1024];
635-
vsprintf(text, fmt, va);
636-
cd->con->Warning("TIFF '%s': Error in '%.20s%s': %s", cd->fileName, module, strlen(module)>20?"...":"", text);
637-
}
638-
639-
static void ITIFF_WarningProc(thandle_t clientData, const char* module, const char* fmt, va_list va)
640-
{
641-
clientData_s* cd = (clientData_s*)clientData;
642-
char text[1024];
643-
vsprintf(text, fmt, va);
644-
cd->con->Warning("TIFF '%s': Warning in '%.20s%s': %s", cd->fileName, module, strlen(module)>20?"...":"", text);
645-
}
646-
647-
static tsize_t ITIFF_ReadProc(thandle_t clientData, tdata_t data, tsize_t len)
648-
{
649-
clientData_s* cd = (clientData_s*)clientData;
650-
return cd->io->Read(data, len)? 0 : len;
651-
}
652-
653-
static tsize_t ITIFF_WriteProc(thandle_t clientData, tdata_t data, tsize_t len)
654-
{
655-
clientData_s* cd = (clientData_s*)clientData;
656-
return cd->io->Write(data, len)? 0 : len;
657-
}
658-
659-
static toff_t ITIFF_SeekProc(thandle_t clientData, toff_t pos, int mode)
660-
{
661-
clientData_s* cd = (clientData_s*)clientData;
662-
cd->io->Seek((size_t)pos, mode);
663-
return cd->io->GetPos();
664-
}
665-
666-
static int ITIFF_CloseProc(thandle_t clientData)
667-
{
668-
return 0;
669-
}
670-
671-
static toff_t ITIFF_SizeProc(thandle_t clientData)
672-
{
673-
clientData_s* cd = (clientData_s*)clientData;
674-
return cd->io->GetLen();
675-
}
676-
677-
bool tiff_c::Load(const char* fileName)
678-
{
679-
Free();
680-
681-
// Open the file
682-
fileInputStream_c in;
683-
if (in.FileOpen(fileName, true)) {
684-
return true;
685-
}
686-
687-
// Initialise TIFF
688-
TIFFSetErrorHandler(NULL);
689-
TIFFSetErrorHandlerExt(ITIFF_ErrorProc);
690-
TIFFSetWarningHandler(NULL);
691-
TIFFSetWarningHandlerExt(ITIFF_WarningProc);
692-
clientData_s cd;
693-
cd.con = con;
694-
cd.fileName = fileName;
695-
cd.io = &in;
696-
TIFF* t = TIFFClientOpen(fileName, "r", &cd, ITIFF_ReadProc, ITIFF_WriteProc, ITIFF_SeekProc, ITIFF_CloseProc, ITIFF_SizeProc, NULL, NULL);
697-
if ( !t ) {
698-
return true;
699-
}
700-
701-
// Get image info and read image
702-
TIFFGetField(t, TIFFTAG_IMAGEWIDTH, &width);
703-
TIFFGetField(t, TIFFTAG_IMAGELENGTH, &height);
704-
dat = new byte[width * height * 4];
705-
comp = 4;
706-
type = IMGTYPE_RGBA;
707-
bool ret = !TIFFReadRGBAImageOriented(t, width, height, (dword*)dat, ORIENTATION_TOPLEFT, 0);
708-
TIFFClose(t);
709-
return ret;
710-
}
711-
712-
bool tiff_c::Save(const char* fileName)
713-
{
714-
// Only save RGB or RGBA
715-
if (type != IMGTYPE_RGB && type != IMGTYPE_RGBA) {
716-
return true;
717-
}
718-
719-
// Open the file
720-
fileOutputStream_c out;
721-
if (out.FileOpen(fileName, true)) {
722-
return true;
723-
}
724-
725-
// Initialise TIFF
726-
TIFFSetErrorHandler(NULL);
727-
TIFFSetErrorHandlerExt(ITIFF_ErrorProc);
728-
TIFFSetWarningHandler(NULL);
729-
TIFFSetWarningHandlerExt(ITIFF_WarningProc);
730-
clientData_s cd;
731-
cd.con = con;
732-
cd.fileName = fileName;
733-
cd.io = &out;
734-
TIFF* t = TIFFClientOpen(fileName, "w", &cd, ITIFF_ReadProc, ITIFF_WriteProc, ITIFF_SeekProc, ITIFF_CloseProc, ITIFF_SizeProc, NULL, NULL);
735-
if ( !t ) {
736-
return true;
737-
}
738-
739-
// Save image
740-
TIFFSetField(t, TIFFTAG_IMAGEWIDTH, width);
741-
TIFFSetField(t, TIFFTAG_BITSPERSAMPLE, 8);
742-
TIFFSetField(t, TIFFTAG_SAMPLESPERPIXEL, comp);
743-
TIFFSetField(t, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
744-
TIFFSetField(t, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
745-
TIFFSetField(t, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
746-
for (dword r = 0; r < height; r++) {
747-
TIFFWriteScanline(t, dat + r*width*comp, r);
748-
}
749-
TIFFClose(t);
750-
return false;
751-
}
752-
753-
bool tiff_c::ImageInfo(const char* fileName, imageInfo_s* info)
754-
{
755-
// Open the file
756-
fileInputStream_c in;
757-
if (in.FileOpen(fileName, true)) {
758-
return true;
759-
}
760-
761-
// Initialise TIFF
762-
TIFFSetErrorHandler(NULL);
763-
TIFFSetErrorHandlerExt(ITIFF_ErrorProc);
764-
TIFFSetWarningHandler(NULL);
765-
TIFFSetWarningHandlerExt(ITIFF_WarningProc);
766-
clientData_s cd;
767-
cd.con = con;
768-
cd.fileName = fileName;
769-
cd.io = &in;
770-
TIFF* t = TIFFClientOpen(fileName, "r", &cd, ITIFF_ReadProc, ITIFF_WriteProc, ITIFF_SeekProc, ITIFF_CloseProc, ITIFF_SizeProc, NULL, NULL);
771-
if ( !t ) {
772-
return true;
773-
}
774-
775-
// Get image info
776-
TIFFGetField(t, TIFFTAG_IMAGEWIDTH, &info->width);
777-
TIFFGetField(t, TIFFTAG_IMAGELENGTH, &info->height);
778-
TIFFGetField(t, TIFFTAG_SAMPLESPERPIXEL, &info->comp);
779-
info->alpha = info->comp == 4;
780-
TIFFClose(t);
781-
return false;
782-
}
783-
784623
// =========
785624
// PNG Image
786625
// =========

engine/core/core_image.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ class jpeg_c: public image_c {
7474
bool ImageInfo(const char* fileName, imageInfo_s* info) override;
7575
};
7676

77-
// TIFF Image
78-
class tiff_c: public image_c {
79-
public:
80-
tiff_c(IConsole* conHnd): image_c(conHnd) { }
81-
bool Load(const char* fileName) override;
82-
bool Save(const char* fileName) override;
83-
bool ImageInfo(const char* fileName, imageInfo_s* info) override;
84-
};
85-
8677
// PNG Image
8778
class png_c: public image_c {
8879
public:

engine/render/r_main.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ enum r_takeScreenshot_e {
1414
R_SSNONE,
1515
R_SSTGA,
1616
R_SSJPEG,
17-
R_SSTIFF,
1817
R_SSPNG
1918
};
2019

@@ -447,13 +446,6 @@ void r_renderer_c::EndFrame()
447446
DoScreenshot(&i, "jpg");
448447
}
449448
break;
450-
case R_SSTIFF:
451-
{
452-
tiff_c i(sys->con);
453-
i.type = IMGTYPE_RGB;
454-
DoScreenshot(&i, "tiff");
455-
}
456-
break;
457449
case R_SSPNG:
458450
{
459451
png_c i(sys->con);
@@ -721,10 +713,8 @@ void r_renderer_c::C_Screenshot(IConsole* conHnd, args_c &args)
721713
takeScreenshot = R_SSJPEG;
722714
} else if ( !_stricmp(fmtName, "png") ) {
723715
takeScreenshot = R_SSPNG;
724-
} else if ( !_stricmp(fmtName, "tiff") ) {
725-
takeScreenshot = R_SSTIFF;
726716
} else {
727-
conHnd->Warning("Unknown screenshot format '%s', valid formats: jpg, tga, png, tiff", fmtName);
717+
conHnd->Warning("Unknown screenshot format '%s', valid formats: jpg, tga, png", fmtName);
728718
}
729719
}
730720

vcpkg.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ libjpeg-turbo:x86-windows-static
33
liblzma:x86-windows-static
44
libpng:x86-windows-static
55
luajit:x86-windows-static
6-
tiff:x86-windows-static
76
zlib:x86-windows-static

win/entry.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,21 @@
1717
#if defined(_WIN64) && defined(_DEBUG)
1818
#pragma comment(lib, "_lib\\zlib64MT_D")
1919
#pragma comment(lib, "_lib\\jpeg64MT_D")
20-
#pragma comment(lib, "_lib\\tiff64MT_D")
2120
#pragma comment(lib, "_lib\\png64MT_D")
2221
#pragma comment(lib, "_lib\\gif64MT_D")
2322
#elif defined(_WIN64)
2423
#pragma comment(lib, "_lib\\zlib64MT")
2524
#pragma comment(lib, "_lib\\jpeg64MT")
26-
#pragma comment(lib, "_lib\\tiff64MT")
2725
#pragma comment(lib, "_lib\\png64MT")
2826
#pragma comment(lib, "_lib\\gif64MT")
2927
#elif defined(_DEBUG)
3028
#pragma comment(lib, "_lib\\zlib32MT_D")
3129
#pragma comment(lib, "_lib\\jpeg32MT_D")
32-
#pragma comment(lib, "_lib\\tiff32MT_D")
3330
#pragma comment(lib, "_lib\\png32MT_D")
3431
#pragma comment(lib, "_lib\\gif32MT_D")
3532
#else
3633
#pragma comment(lib, "_lib\\zlib32MT")
3734
#pragma comment(lib, "_lib\\jpeg32MT")
38-
#pragma comment(lib, "_lib\\tiff32MT")
3935
#pragma comment(lib, "_lib\\png32MT")
4036
#pragma comment(lib, "_lib\\gif32MT")
4137
#endif

0 commit comments

Comments
 (0)