From 599e61bb92204d9e877f14c77a162a2fdcf885ed Mon Sep 17 00:00:00 2001 From: Lucas Dower Date: Fri, 16 Sep 2022 18:59:32 +0100 Subject: [PATCH] Plugged in MAXIMUM_IMAGE_MEM_ALLOC --- src/texture.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/texture.ts b/src/texture.ts index 3b34a99..a0abbda 100644 --- a/src/texture.ts +++ b/src/texture.ts @@ -4,6 +4,7 @@ import path from 'path'; import { PNG } from 'pngjs'; import { RGBA, RGBAColours, RGBAUtil } from './colour'; +import { AppConfig } from './config'; import { clamp, wayThrough } from './math'; import { UV } from './util'; import { AppError, ASSERT } from './util/error_util'; @@ -52,7 +53,9 @@ export class Texture { return PNG.sync.read(data); } else if (['.jpg', '.jpeg'].includes(filePath.ext.toLowerCase())) { this._useAlphaChannelValue = false; - return jpeg.decode(data); + return jpeg.decode(data, { + maxMemoryUsageInMB: AppConfig.MAXIMUM_IMAGE_MEM_ALLOC, + }); } ASSERT(false); } catch (err) {