diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-03-15 13:49:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-03-15 13:49:38 +0000 |
commit | 1ec8557d86d53c9df5afd5607a953ec72c33702f (patch) | |
tree | c7ef4af670f19e25fec6ebeff6834beb80e1c3c3 /vcl | |
parent | 924fc2702e27ffc59012ddaccd210e9eef6912e6 (diff) |
take pre-calculated size from vector::size
Change-Id: I5a7f2c4c67de48f3a34f311f69de3bfdb94423d5
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/jpeg/jpegc.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index a5f1edbc8537..1dbf2f8fb92b 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -92,6 +92,8 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines, cinfo.output_gamma = 1.0; cinfo.raw_data_out = FALSE; cinfo.quantize_colors = FALSE; + ScanlineFormat eScanlineFormat = ScanlineFormat::N24BitTcRgb; + int nPixelSize = 3; if ( cinfo.jpeg_color_space == JCS_YCbCr ) cinfo.out_color_space = JCS_RGB; else if ( cinfo.jpeg_color_space == JCS_YCCK ) @@ -170,7 +172,7 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines, { JSAMPLE* aRangeLimit = cinfo.sample_range_limit; - std::vector<sal_uInt8> pScanLineBuffer(nWidth * (bGray ? 1 : 3)); + std::vector<sal_uInt8> pScanLineBuffer(nWidth * (bGray ? 1 : nPixelSize)); std::vector<sal_uInt8> pCYMKBuffer; if (cinfo.out_color_space == JCS_CMYK) @@ -229,7 +231,7 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines, } else { - pAccess->CopyScanline(yIndex, pScanLineBuffer.data(), ScanlineFormat::N24BitTcRgb, nWidth * 3); + pAccess->CopyScanline(yIndex, pScanLineBuffer.data(), eScanlineFormat, pScanLineBuffer.size()); } /* PENDING ??? */ |