Skip to content

Commit

Permalink
support JXLs over 2^30 pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
qbnu committed Sep 5, 2024
1 parent efd55a1 commit 5b5b27c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/JPEGView/JXLWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void* JxlReader::ReadImage(int& width,
has_animation, frame_count, frame_time, &icc_profile, outOfMemory)) {
return NULL;
}
int size = width * height * nchannels;
size_t size = (size_t)width * height * nchannels;
pPixelData = new(std::nothrow) unsigned char[size];
if (pPixelData == NULL) {
outOfMemory = true;
Expand All @@ -209,7 +209,7 @@ void* JxlReader::ReadImage(int& width,
if (!ICCProfileTransform::DoTransform(cache.transform, pixels.data(), pPixelData, width, height)) {
// RGBA -> BGRA conversion (with little-endian integers)
uint32_t* data = (uint32_t*)pixels.data();
for (int i = 0; i * sizeof(uint32_t) < size; i++) {
for (size_t i = 0; i * sizeof(uint32_t) < size; i++) {
((uint32_t*)pPixelData)[i] = _rotr(_byteswap_ulong(data[i]), 8);
}
}
Expand Down

0 comments on commit 5b5b27c

Please sign in to comment.