Skip to content

Commit

Permalink
JPEG: fix further calls to RasterIO after reading full image at full …
Browse files Browse the repository at this point in the history
…resolution (fixes #1947)
  • Loading branch information
rouault committed Oct 23, 2019
1 parent 3ed8f02 commit 1686846
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions autotest/gdrivers/jpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,15 @@ def test_jpeg_23():
assert cs == got_cs

# Pixel interleaved
ds = gdal.Open('data/albania.jpg')
data = ds.ReadRaster(0, 0, ds.RasterXSize, ds.RasterYSize,
buf_pixel_space=3, buf_band_space=1)
y = int(ds.RasterYSize/2)
data_bottom = ds.ReadRaster(0, y, ds.RasterXSize, ds.RasterYSize - y,
buf_pixel_space=3, buf_band_space=1)
data_top = ds.ReadRaster(0, 0, ds.RasterXSize, y,
buf_pixel_space=3, buf_band_space=1)
assert data == data_top + data_bottom
tmp_ds = gdal.GetDriverByName('Mem').Create(
'', ds.RasterXSize, ds.RasterYSize, 3)
tmp_ds.WriteRaster(0, 0, ds.RasterXSize, ds.RasterYSize, data,
Expand All @@ -806,6 +813,7 @@ def test_jpeg_23():
assert cs == got_cs

# Pixel interleaved with padding
ds = gdal.Open('data/albania.jpg')
data = ds.ReadRaster(0, 0, ds.RasterXSize, ds.RasterYSize,
buf_pixel_space=4, buf_band_space=1)
tmp_ds = gdal.GetDriverByName('Mem').Create(
Expand Down
2 changes: 1 addition & 1 deletion gdal/frmts/jpeg/jpgdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ CPLErr JPGDatasetCommon::IRasterIO( GDALRWFlag eRWFlag,
}
}
}
nLoadedScanline = -1;
nLoadedScanline = nRasterYSize;
}
else
{
Expand Down

0 comments on commit 1686846

Please sign in to comment.