mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +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
|
||||
# https://github.com/python-pillow/Pillow/issues/279
|
||||
if fillorder == 2:
|
||||
key = (
|
||||
self.tag_v2.prefix, photo, sampleFormat, 1,
|
||||
self.tag_v2.get(BITSPERSAMPLE, (1,)),
|
||||
self.tag_v2.get(EXTRASAMPLES, ())
|
||||
)
|
||||
# Replace fillorder with fillorder=1
|
||||
key = key[:3] + (1,) + key[4:]
|
||||
if DEBUG:
|
||||
print("format key:", key)
|
||||
# this should always work, since all the
|
||||
|
@ -1315,7 +1312,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
self.tile.append(
|
||||
(self._compression,
|
||||
(x, y, min(x+w, xsize), min(y+h, ysize)),
|
||||
offset, a))
|
||||
offset, a))
|
||||
x = x + w
|
||||
if x >= self.size[0]:
|
||||
x, y = 0, y + h
|
||||
|
|
|
@ -236,14 +236,14 @@ int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, int
|
|||
|
||||
TIFFSetField(tiff, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
|
||||
|
||||
if (TIFFIsTiled(tiff)) {
|
||||
uint32 x, y, tile_y;
|
||||
if (TIFFIsTiled(tiff)) {
|
||||
uint32 x, y, tile_y;
|
||||
uint32 tileWidth, tileLength;
|
||||
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) {
|
||||
state->errcode = IMAGING_CODEC_MEMORY;
|
||||
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]));
|
||||
|
||||
state->shuffle((UINT8*) im->image[tile_y + y] + x * im->pixelsize,
|
||||
state->buffer + tile_y * (state->bytes / tileLength),
|
||||
min(tileWidth, state->xsize - x)
|
||||
state->buffer + tile_y * (state->bytes / tileLength),
|
||||
min(tileWidth, state->xsize - x)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user