Skip to content

Commit

Permalink
fix XP build?
Browse files Browse the repository at this point in the history
  • Loading branch information
qbnu committed Nov 25, 2023
1 parent 90106df commit 04e62ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/JPEGView/ImageLoadThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "BasicProcessing.h"
#include "dcraw_mod.h"
#include "TJPEGWrapper.h"
#ifndef WINXP
#include "PNGWrapper.h"
#ifndef WINXP
#include "JXLWrapper.h"
#include "HEIFWrapper.h"
#include "AVIFWrapper.h"
Expand Down
6 changes: 5 additions & 1 deletion src/JPEGView/PNGWrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include "stdafx.h"

#include "PNGWrapper.h"

#ifndef WINXP
#include "png.h"
#include "MaxImageDef.h"
#include <stdexcept>
#include <stdlib.h>

// Uncomment to build without APNG support
//#undef PNG_APNG_SUPPORTED
Expand Down Expand Up @@ -400,6 +401,9 @@ bool PngReader::IsAnimated(void* buffer, size_t sizebytes) {
}
return false;
}
#else
#define PNG_UINT_31_MAX (0x7fffffff)
#endif

void* PngReader::GetEXIFBlock(void* buffer, size_t sizebytes) {
size_t offset = 8; // skip PNG signature
Expand Down
5 changes: 4 additions & 1 deletion src/JPEGView/PNGWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class PngReader
{
public:
#ifndef WINXP
// Returns data in 4 byte BGRA
static void* ReadImage(int& width, // width of the image loaded.
int& height, // height of the image loaded.
Expand All @@ -20,14 +21,16 @@ class PngReader

// Returns true if PNG is animated, false otherwise
static bool IsAnimated(void* buffer, size_t sizebytes);

#endif
// Get EXIF Block
static void* GetEXIFBlock(void* buffer, size_t sizebytes);

#ifndef WINXP
private:
struct png_cache;
static png_cache cache;
static bool BeginReading(void* buffer, size_t sizebytes, bool& outOfMemory);
static void* ReadNextFrame(void** exif_chunk, unsigned int* exif_size);
static void DeleteCacheInternal(bool free_buffer);
#endif
};

0 comments on commit 04e62ea

Please sign in to comment.