plugin/jpg: Fixed to load large images

This commit is contained in:
Mirek Fidler 2023-03-29 11:31:41 +02:00
parent e23589ece9
commit a0e21df6cc
5 changed files with 33 additions and 16 deletions

View file

@ -0,0 +1,13 @@
#include <Core/Core.h>
#include <plugin/jpg/jpg.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
Image m = StreamRaster::LoadFileAny(GetDataFile("sample.jpg"));
DDUMP(m.GetSize());
ASSERT(m.GetSize() == Size(1920, 1080));
// if this does not work, set #define DEFAULT_MAX_MEM 100000000L
}

View file

@ -0,0 +1,10 @@
uses
Core,
plugin/jpg;
file
LargeJpeg.cpp;
mainconfig
"" = "";

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

View file

@ -16,7 +16,7 @@ const char *GetENUS(const char *id);
// has to be included from file that is not part of package...
#include "t_.h"
/* t_.h:
/* t_.h content:
#ifdef t_
#undef t_
#endif
@ -25,21 +25,13 @@ const char *GetENUS(const char *id);
#undef tt_
#endif
#define t_(x) t_GetLngString(x)
#define tt_(x) x
*/
#ifndef t_h
#define t_h
inline const char *t_(const char *s) { return t_GetLngString(s); }
inline const char *tt_(const char *s) { return s; }
/* lt_.h:
#ifdef t_
#undef t_
#endif
#ifdef tt_
#undef tt_
#endif
#define t_(x) x
#define tt_(x) x
*/
String GetLngString(const char *id); // Only works with string literals because of caching !

View file

@ -73,10 +73,12 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
* a slop factor of 5% or so.
*/
#ifndef DEFAULT_MAX_MEM /* so can override from makefile */
#define DEFAULT_MAX_MEM 1000000L /* default: one megabyte */
#ifdef DEFAULT_MAX_MEM /* so can override from makefile */
#undef DEFAULT_MAX_MEM
#endif
#define DEFAULT_MAX_MEM 100000000L //U++: Let us have this fixed at 100MB...
GLOBAL(long)
jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
long max_bytes_needed, long already_allocated)