Skip to content

Commit

Permalink
Fix padding for byte widths greater than 1
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-allan committed May 20, 2020
1 parent 7d29672 commit 1e4dc7d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ private void convertPyramid(PyramidSeries s)
}

int rgbChannels = s.rgb ? s.c : 1;

int bytesPerPixel = FormatTools.getBytesPerPixel(s.pixelType);
try {
for (int resolution=0; resolution<s.numberOfResolutions; resolution++) {
LOG.info("Converting resolution #{}", resolution);
Expand Down Expand Up @@ -718,12 +718,14 @@ private void convertPyramid(PyramidSeries s)
else {
// padded tile, use descriptor X and Y tile size
byte[] realTile =
new byte[descriptor.tileSizeX * descriptor.tileSizeY];
new byte[descriptor.tileSizeX * descriptor.tileSizeY
* bytesPerPixel];
int totalRows = region.height;
int inRowLen = tileBytes.length / totalRows;
int inRowLen = region.width * bytesPerPixel;
int outRowLen = descriptor.tileSizeX * bytesPerPixel;
for (int row=0; row<totalRows; row++) {
System.arraycopy(tileBytes, row * inRowLen,
realTile, row * descriptor.tileSizeX, inRowLen);
realTile, row * outRowLen, inRowLen);
}
writeTile(s, currentPlane, realTile,
currentIndex, currentResolution);
Expand Down

0 comments on commit 1e4dc7d

Please sign in to comment.