[Libreoffice-commits] core.git: vcl/source
Caolán McNamara
caolanm at redhat.com
Wed Mar 15 13:50:55 UTC 2017
vcl/source/filter/jpeg/jpegc.cxx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 1ec8557d86d53c9df5afd5607a953ec72c33702f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Mar 15 13:49:38 2017 +0000
take pre-calculated size from vector::size
Change-Id: I5a7f2c4c67de48f3a34f311f69de3bfdb94423d5
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index a5f1edb..1dbf2f8 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 ??? */
More information about the Libreoffice-commits
mailing list