Line
Link Here
|
|
-- src/kernel/qasyncimageio.cpp |
|
|
Lines 992-997
Link Here
|
992 |
accum = 0; |
992 |
accum = 0; |
993 |
bitcount = 0; |
993 |
bitcount = 0; |
994 |
sp = stack; |
994 |
sp = stack; |
|
|
995 |
firstcode = oldcode = 0; |
995 |
needfirst = FALSE; |
996 |
needfirst = FALSE; |
996 |
out_of_bounds = FALSE; |
997 |
out_of_bounds = FALSE; |
997 |
} |
998 |
} |
998 |
-- src/kernel/qimage.cpp |
|
|
Lines 730-735
Link Here
|
730 |
that->setAlphaBuffer( TRUE ); |
730 |
that->setAlphaBuffer( TRUE ); |
731 |
} |
731 |
} |
732 |
image.setAlphaBuffer(hasAlphaBuffer()); |
732 |
image.setAlphaBuffer(hasAlphaBuffer()); |
|
|
733 |
image.data->dpmx = dotsPerMeterX(); |
734 |
image.data->dpmy = dotsPerMeterY(); |
735 |
image.data->offset = offset(); |
736 |
#ifndef QT_NO_IMAGE_TEXT |
737 |
if ( data->misc ) { |
738 |
image.data->misc = new QImageDataMisc; |
739 |
*image.data->misc = misc(); |
740 |
} |
741 |
#endif |
733 |
return image; |
742 |
return image; |
734 |
} |
743 |
} |
735 |
|
744 |
|
Lines 4818-4823
Link Here
|
4818 |
if ( comp == BMP_RLE8 ) { // run length compression |
4827 |
if ( comp == BMP_RLE8 ) { // run length compression |
4819 |
int x=0, y=0, b; |
4828 |
int x=0, y=0, b; |
4820 |
register uchar *p = line[h-1]; |
4829 |
register uchar *p = line[h-1]; |
|
|
4830 |
const uchar *endp = line[h-1]+w; |
4821 |
while ( y < h ) { |
4831 |
while ( y < h ) { |
4822 |
if ( (b=d->getch()) == EOF ) |
4832 |
if ( (b=d->getch()) == EOF ) |
4823 |
break; |
4833 |
break; |
Lines 4835-4843
Link Here
|
4835 |
case 2: // delta (jump) |
4845 |
case 2: // delta (jump) |
4836 |
x += d->getch(); |
4846 |
x += d->getch(); |
4837 |
y += d->getch(); |
4847 |
y += d->getch(); |
|
|
4848 |
|
4849 |
// Protection |
4850 |
if ( (uint)x >= (uint)w ) |
4851 |
x = w-1; |
4852 |
if ( (uint)y >= (uint)h ) |
4853 |
y = h-1; |
4854 |
|
4838 |
p = line[h-y-1] + x; |
4855 |
p = line[h-y-1] + x; |
4839 |
break; |
4856 |
break; |
4840 |
default: // absolute mode |
4857 |
default: // absolute mode |
|
|
4858 |
// Protection |
4859 |
if ( p + b > endp ) |
4860 |
b = endp-p; |
4861 |
|
4841 |
if ( d->readBlock( (char *)p, b ) != b ) |
4862 |
if ( d->readBlock( (char *)p, b ) != b ) |
4842 |
return FALSE; |
4863 |
return FALSE; |
4843 |
if ( (b & 1) == 1 ) |
4864 |
if ( (b & 1) == 1 ) |
Lines 4846-4851
Link Here
|
4846 |
p += b; |
4867 |
p += b; |
4847 |
} |
4868 |
} |
4848 |
} else { // encoded mode |
4869 |
} else { // encoded mode |
|
|
4870 |
// Protection |
4871 |
if ( p + b > endp ) |
4872 |
b = endp-p; |
4873 |
|
4849 |
memset( p, d->getch(), b ); // repeat pixel |
4874 |
memset( p, d->getch(), b ); // repeat pixel |
4850 |
x += b; |
4875 |
x += b; |
4851 |
p += b; |
4876 |
p += b; |
Lines 5639-5644
Link Here
|
5639 |
} |
5664 |
} |
5640 |
|
5665 |
|
5641 |
|
5666 |
|
|
|
5667 |
|
5668 |
static int nextColorSpec(const QCString & buf) |
5669 |
{ |
5670 |
int i = buf.find(" c "); |
5671 |
if (i < 0) |
5672 |
i = buf.find(" g "); |
5673 |
if (i < 0) |
5674 |
i = buf.find(" g4 "); |
5675 |
if (i < 0) |
5676 |
i = buf.find(" m "); |
5677 |
if (i < 0) |
5678 |
i = buf.find(" s "); |
5679 |
return i; |
5680 |
} |
5681 |
|
5642 |
// |
5682 |
// |
5643 |
// INTERNAL |
5683 |
// INTERNAL |
5644 |
// |
5684 |
// |
Lines 5695-5717
Link Here
|
5695 |
index = buf.left( cpp ); |
5735 |
index = buf.left( cpp ); |
5696 |
buf = buf.mid( cpp ).simplifyWhiteSpace().lower(); |
5736 |
buf = buf.mid( cpp ).simplifyWhiteSpace().lower(); |
5697 |
buf.prepend( " " ); |
5737 |
buf.prepend( " " ); |
5698 |
i = buf.find( " c " ); |
5738 |
i = nextColorSpec(buf); |
5699 |
if ( i < 0 ) |
|
|
5700 |
i = buf.find( " g " ); |
5701 |
if ( i < 0 ) |
5702 |
i = buf.find( " g4 " ); |
5703 |
if ( i < 0 ) |
5704 |
i = buf.find( " m " ); |
5705 |
if ( i < 0 ) { |
5739 |
if ( i < 0 ) { |
5706 |
#if defined(QT_CHECK_RANGE) |
5740 |
#if defined(QT_CHECK_RANGE) |
5707 |
qWarning( "QImage: XPM color specification is missing: %s", buf.data()); |
5741 |
qWarning( "QImage: XPM color specification is missing: %s", buf.data()); |
5708 |
#endif |
5742 |
#endif |
5709 |
return; // no c/g/g4/m specification at all |
5743 |
return; // no c/g/g4/m/s specification at all |
5710 |
} |
5744 |
} |
5711 |
buf = buf.mid( i+3 ); |
5745 |
buf = buf.mid( i+3 ); |
5712 |
// Strip any other colorspec |
5746 |
// Strip any other colorspec |
5713 |
int end = buf.find(' ', 4); |
5747 |
int end = nextColorSpec(buf); |
5714 |
if ( end >= 0 ) |
5748 |
if (end != -1) |
5715 |
buf.truncate(end); |
5749 |
buf.truncate(end); |
5716 |
buf = buf.stripWhiteSpace(); |
5750 |
buf = buf.stripWhiteSpace(); |
5717 |
if ( buf == "none" ) { |
5751 |
if ( buf == "none" ) { |
5718 |
-- src/kernel/qjpegio.cpp |
|
|
Lines 254-268
Link Here
|
254 |
scaleSize( sWidth, sHeight, cinfo.output_width, cinfo.output_height, sMode ); |
254 |
scaleSize( sWidth, sHeight, cinfo.output_width, cinfo.output_height, sMode ); |
255 |
// qDebug( "Scaling the jpeg to %i x %i", sWidth, sHeight, sModeStr ); |
255 |
// qDebug( "Scaling the jpeg to %i x %i", sWidth, sHeight, sModeStr ); |
256 |
|
256 |
|
|
|
257 |
bool created = FALSE; |
257 |
if ( cinfo.output_components == 3 || cinfo.output_components == 4) { |
258 |
if ( cinfo.output_components == 3 || cinfo.output_components == 4) { |
258 |
image.create( sWidth, sHeight, 32 ); |
259 |
created = image.create( sWidth, sHeight, 32 ); |
259 |
} else if ( cinfo.output_components == 1 ) { |
260 |
} else if ( cinfo.output_components == 1 ) { |
260 |
image.create( sWidth, sHeight, 8, 256 ); |
261 |
created = image.create( sWidth, sHeight, 8, 256 ); |
261 |
for (int i=0; i<256; i++) |
262 |
for (int i=0; i<256; i++) |
262 |
image.setColor(i, qRgb(i,i,i)); |
263 |
image.setColor(i, qRgb(i,i,i)); |
263 |
} else { |
264 |
} else { |
264 |
// Unsupported format |
265 |
// Unsupported format |
265 |
} |
266 |
} |
|
|
267 |
if (!created) |
268 |
image = QImage(); |
266 |
|
269 |
|
267 |
if (!image.isNull()) { |
270 |
if (!image.isNull()) { |
268 |
QImage tmpImage( cinfo.output_width, 1, 32 ); |
271 |
QImage tmpImage( cinfo.output_width, 1, 32 ); |
Lines 296-348
Link Here
|
296 |
} |
299 |
} |
297 |
} |
300 |
} |
298 |
(void) jpeg_finish_decompress(&cinfo); |
301 |
(void) jpeg_finish_decompress(&cinfo); |
299 |
} |
302 |
} |
300 |
|
303 |
|
301 |
} else { |
304 |
} else { |
302 |
|
305 |
|
|
|
306 |
bool created = false; |
303 |
if ( cinfo.output_components == 3 || cinfo.output_components == 4) { |
307 |
if ( cinfo.output_components == 3 || cinfo.output_components == 4) { |
304 |
image.create( cinfo.output_width, cinfo.output_height, 32 ); |
308 |
created = image.create( cinfo.output_width, cinfo.output_height, 32 ); |
305 |
} else if ( cinfo.output_components == 1 ) { |
309 |
} else if ( cinfo.output_components == 1 ) { |
306 |
image.create( cinfo.output_width, cinfo.output_height, 8, 256 ); |
310 |
created = image.create( cinfo.output_width, cinfo.output_height, 8, 256 ); |
307 |
for (int i=0; i<256; i++) |
311 |
for (int i=0; i<256; i++) |
308 |
image.setColor(i, qRgb(i,i,i)); |
312 |
image.setColor(i, qRgb(i,i,i)); |
309 |
} else { |
313 |
} else { |
310 |
// Unsupported format |
314 |
// Unsupported format |
311 |
} |
315 |
} |
|
|
316 |
if (!created) |
317 |
image = QImage(); |
312 |
|
318 |
|
313 |
if (!image.isNull()) { |
319 |
if (!image.isNull()) { |
314 |
uchar** lines = image.jumpTable(); |
320 |
uchar** lines = image.jumpTable(); |
315 |
while (cinfo.output_scanline < cinfo.output_height) |
321 |
while (cinfo.output_scanline < cinfo.output_height) |
316 |
(void) jpeg_read_scanlines(&cinfo, |
322 |
(void) jpeg_read_scanlines(&cinfo, |
317 |
lines + cinfo.output_scanline, |
323 |
lines + cinfo.output_scanline, |
318 |
cinfo.output_height); |
324 |
cinfo.output_height); |
319 |
(void) jpeg_finish_decompress(&cinfo); |
325 |
(void) jpeg_finish_decompress(&cinfo); |
320 |
} |
|
|
321 |
|
326 |
|
322 |
if ( cinfo.output_components == 3 ) { |
327 |
if ( cinfo.output_components == 3 ) { |
323 |
// Expand 24->32 bpp. |
328 |
// Expand 24->32 bpp. |
324 |
for (uint j=0; j<cinfo.output_height; j++) { |
329 |
for (uint j=0; j<cinfo.output_height; j++) { |
325 |
uchar *in = image.scanLine(j) + cinfo.output_width * 3; |
330 |
uchar *in = image.scanLine(j) + cinfo.output_width * 3; |
326 |
QRgb *out = (QRgb*)image.scanLine(j); |
331 |
QRgb *out = (QRgb*)image.scanLine(j); |
327 |
|
332 |
|
328 |
for (uint i=cinfo.output_width; i--; ) { |
333 |
for (uint i=cinfo.output_width; i--; ) { |
329 |
in-=3; |
334 |
in-=3; |
330 |
out[i] = qRgb(in[0], in[1], in[2]); |
335 |
out[i] = qRgb(in[0], in[1], in[2]); |
331 |
} |
336 |
} |
332 |
} |
337 |
} |
333 |
} |
338 |
} |
|
|
339 |
} |
334 |
} |
340 |
} |
335 |
|
341 |
|
336 |
if ( cinfo.density_unit == 1 ) { |
342 |
if (!image.isNull()) { |
337 |
image.setDotsPerMeterX( int(100. * cinfo.X_density / 2.54) ); |
343 |
if ( cinfo.density_unit == 1 ) { |
338 |
image.setDotsPerMeterY( int(100. * cinfo.Y_density / 2.54) ); |
344 |
image.setDotsPerMeterX( int(100. * cinfo.X_density / 2.54) ); |
339 |
} else if ( cinfo.density_unit == 2 ) { |
345 |
image.setDotsPerMeterY( int(100. * cinfo.Y_density / 2.54) ); |
340 |
image.setDotsPerMeterX( int(100. * cinfo.X_density) ); |
346 |
} else if ( cinfo.density_unit == 2 ) { |
341 |
image.setDotsPerMeterY( int(100. * cinfo.Y_density) ); |
347 |
image.setDotsPerMeterX( int(100. * cinfo.X_density) ); |
342 |
} |
348 |
image.setDotsPerMeterY( int(100. * cinfo.Y_density) ); |
|
|
349 |
} |
350 |
} |
343 |
|
351 |
|
344 |
iio->setImage(image); |
352 |
iio->setImage(image); |
345 |
iio->setStatus(0); |
353 |
iio->setStatus(image.isNull()); |
346 |
} |
354 |
} |
347 |
|
355 |
|
348 |
jpeg_destroy_decompress(&cinfo); |
356 |
jpeg_destroy_decompress(&cinfo); |
Lines 476-481
Link Here
|
476 |
} |
484 |
} |
477 |
|
485 |
|
478 |
jpeg_set_defaults(&cinfo); |
486 |
jpeg_set_defaults(&cinfo); |
|
|
487 |
|
488 |
float diffInch = QABS(image.dotsPerMeterX()*2.54/100. - qRound(image.dotsPerMeterX()*2.54/100.)) |
489 |
+ QABS(image.dotsPerMeterY()*2.54/100. - qRound(image.dotsPerMeterY()*2.54/100.)); |
490 |
float diffCm = (QABS(image.dotsPerMeterX()/100. - qRound(image.dotsPerMeterX()/100.)) |
491 |
+ QABS(image.dotsPerMeterY()/100. - qRound(image.dotsPerMeterY()/100.)))*2.54; |
492 |
if (diffInch < diffCm) { |
493 |
cinfo.density_unit = 1; // dots/inch |
494 |
cinfo.X_density = qRound(image.dotsPerMeterX()*2.54/100.); |
495 |
cinfo.Y_density = qRound(image.dotsPerMeterY()*2.54/100.); |
496 |
} else { |
497 |
cinfo.density_unit = 2; // dots/cm |
498 |
cinfo.X_density = (image.dotsPerMeterX()+50) / 100; |
499 |
cinfo.Y_density = (image.dotsPerMeterY()+50) / 100; |
500 |
} |
501 |
|
479 |
int quality = iio->quality() >= 0 ? QMIN(iio->quality(),100) : 75; |
502 |
int quality = iio->quality() >= 0 ? QMIN(iio->quality(),100) : 75; |
480 |
#if defined(Q_OS_UNIXWARE) |
503 |
#if defined(Q_OS_UNIXWARE) |
481 |
jpeg_set_quality(&cinfo, quality, B_TRUE /* limit to baseline-JPEG values */); |
504 |
jpeg_set_quality(&cinfo, quality, B_TRUE /* limit to baseline-JPEG values */); |
482 |
-- src/kernel/qasyncimageio.cpp |
|
|
Lines 1107-1113
Link Here
|
1107 |
oldcode=incode; |
1107 |
oldcode=incode; |
1108 |
while (sp>stack) { |
1108 |
while (sp>stack) { |
1109 |
--sp; |
1109 |
--sp; |
1110 |
if (!out_of_bounds && *sp!=trans_index) |
1110 |
if (!out_of_bounds && line && *sp!=trans_index) |
1111 |
line[y][x] = color(*sp); |
1111 |
line[y][x] = color(*sp); |
1112 |
x++; |
1112 |
x++; |
1113 |
if (x>=swidth) out_of_bounds = TRUE; |
1113 |
if (x>=swidth) out_of_bounds = TRUE; |
1114 |
-- src/kernel/qimage.cpp |
|
|
Lines 5681-5686
Link Here
|
5681 |
image.create( w, h, 8, ncols ); |
5681 |
image.create( w, h, 8, ncols ); |
5682 |
} |
5682 |
} |
5683 |
|
5683 |
|
|
|
5684 |
if (image.isNull()) |
5685 |
return; |
5686 |
|
5684 |
QMap<QString, int> colorMap; |
5687 |
QMap<QString, int> colorMap; |
5685 |
int currentColor; |
5688 |
int currentColor; |
5686 |
|
5689 |
|