Skip to content

Commit

Permalink
fixes a pretty subtle issue that occurs when requesting a cropped pla…
Browse files Browse the repository at this point in the history
…ne that matches exactly a subblock location
  • Loading branch information
NicoKiaru committed Nov 11, 2023
1 parent 0d04d02 commit a0d90f2
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws F
if (image.intersects(blockRegion)) {
RandomAccessInputStream stream = getStream(block.filePart);

if (image.equals(blockRegion)) {
if (image.equals(blockRegion) && blocks.size()==1) { // THE SECOND TEST IS NECESSARY BECAUSE OTHER BLOCKS CAN INTERSECT!
// Best case scenario
return readRawPixelData(
block,
Expand All @@ -840,6 +840,8 @@ public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws F

Region tileInBlock = new Region(regionRead.x-blockRegion.x, regionRead.y-blockRegion.y, regionRead.width, regionRead.height);



byte[] rawData = readRawPixelData(
block,
compression,
Expand Down

0 comments on commit a0d90f2

Please sign in to comment.