mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-12 17:22:28 +03:00
PR feedback: simplified key construct for fillorder=2; indentation fixes
This commit is contained in:
parent
300bdaad9e
commit
69f315a585
|
@ -1256,11 +1256,8 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
# bits, so stripes of the image are reversed. See
|
# bits, so stripes of the image are reversed. See
|
||||||
# https://github.com/python-pillow/Pillow/issues/279
|
# https://github.com/python-pillow/Pillow/issues/279
|
||||||
if fillorder == 2:
|
if fillorder == 2:
|
||||||
key = (
|
# Replace fillorder with fillorder=1
|
||||||
self.tag_v2.prefix, photo, sampleFormat, 1,
|
key = key[:3] + (1,) + key[4:]
|
||||||
self.tag_v2.get(BITSPERSAMPLE, (1,)),
|
|
||||||
self.tag_v2.get(EXTRASAMPLES, ())
|
|
||||||
)
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print("format key:", key)
|
print("format key:", key)
|
||||||
# this should always work, since all the
|
# this should always work, since all the
|
||||||
|
@ -1315,7 +1312,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
self.tile.append(
|
self.tile.append(
|
||||||
(self._compression,
|
(self._compression,
|
||||||
(x, y, min(x+w, xsize), min(y+h, ysize)),
|
(x, y, min(x+w, xsize), min(y+h, ysize)),
|
||||||
offset, a))
|
offset, a))
|
||||||
x = x + w
|
x = x + w
|
||||||
if x >= self.size[0]:
|
if x >= self.size[0]:
|
||||||
x, y = 0, y + h
|
x, y = 0, y + h
|
||||||
|
|
|
@ -236,14 +236,14 @@ int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, int
|
||||||
|
|
||||||
TIFFSetField(tiff, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
|
TIFFSetField(tiff, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
|
||||||
|
|
||||||
if (TIFFIsTiled(tiff)) {
|
if (TIFFIsTiled(tiff)) {
|
||||||
uint32 x, y, tile_y;
|
uint32 x, y, tile_y;
|
||||||
uint32 tileWidth, tileLength;
|
uint32 tileWidth, tileLength;
|
||||||
UINT8 *new_data;
|
UINT8 *new_data;
|
||||||
|
|
||||||
state->bytes = TIFFTileSize(tiff);
|
state->bytes = TIFFTileSize(tiff);
|
||||||
|
|
||||||
/* overflow check for malloc */
|
/* overflow check for malloc */
|
||||||
if (state->bytes > INT_MAX - 1) {
|
if (state->bytes > INT_MAX - 1) {
|
||||||
state->errcode = IMAGING_CODEC_MEMORY;
|
state->errcode = IMAGING_CODEC_MEMORY;
|
||||||
TIFFClose(tiff);
|
TIFFClose(tiff);
|
||||||
|
@ -285,8 +285,8 @@ int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, int
|
||||||
// TRACE(("chars: %x%x%x%x\n", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));
|
// TRACE(("chars: %x%x%x%x\n", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3]));
|
||||||
|
|
||||||
state->shuffle((UINT8*) im->image[tile_y + y] + x * im->pixelsize,
|
state->shuffle((UINT8*) im->image[tile_y + y] + x * im->pixelsize,
|
||||||
state->buffer + tile_y * (state->bytes / tileLength),
|
state->buffer + tile_y * (state->bytes / tileLength),
|
||||||
min(tileWidth, state->xsize - x)
|
min(tileWidth, state->xsize - x)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user