Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, March 2008
Strange behavior of some TIFF image after scaling through QGraphicsView & QGraphicsScene & QGraphicsPixmapItem & QPixmap


Message 1 in thread

Hello,

I am trying to write simple widget, that will render image allowing to zoom and scroll it.
I inherited from QGraphicsView, created QGraphicsScene and added to scene QGraphicsPixmapItem with pixmap. Scrolling realized through QGraphicsView::scale().

But I have problem with scaling one image, I tried to draw it with "Ported Canvas Example" from Qt demos, and there this problem emerges too!
First drawing image at 100% scale succeeds (as drawing at any random scales), but later if I scale pixmap back to 100% application draws random screen area instead of image -- like pointer to pixmap memory was corrupted.

I observed this behavior only on one TIFF image:
http://vr1.jino-net.ru/qt/off_luv32.tif

This bug can be repeated this way:
Running  "Ported Canvas Example" demo with problem image as first argument in command line:
http://vr1.jino-net.ru/qt/gkrellShoot_03-02-08_064216.jpg

Pressing Ctrl+- -- scene zooming out:
http://vr1.jino-net.ru/qt/gkrellShoot_03-02-08_064304.jpg

Pressing Ctrl++ -- scene zooming in:
http://vr1.jino-net.ru/qt/gkrellShoot_03-02-08_064326.jpg
-- there is seen some random areas from screen instead of 100% scaled images.

Next random pressing Ctrl++ Ctrl+- shows, that only image at scale 100% draws incorrectly.

I'm new to Qt, but seems that problem not in how demo is written (or my simple program), but in internal loading of some TIFF format images (or my hardware/configuration).

Is this bug only problem of my configuration? And if not, what to do with it?

Thanks!

--
 [ signature omitted ] 

Message 2 in thread

I forgot to write my configuration:
* 64 bit Debian testing (2.6.22 kernel)
* Qt 4.3.3 from Debian package, demos from documentation package of the same version
* Xorg 7.1, using fglrx drivers (ATI) 8.45.4
* KDE 3.5.8

My program compiled on windows (32 bit) works fine, this bug is not seen.

--
 [ signature omitted ] 

Message 3 in thread

Hi,

> [...]
> * Xorg 7.1, using fglrx drivers (ATI) 8.45.4
> [...]

That could be the problem. Have you tried with a different driver?

--
 [ signature omitted ] 

Message 4 in thread

Hello,

> > [...]
> > * Xorg 7.1, using fglrx drivers (ATI) 8.45.4
> > [...]
> 
> That could be the problem. Have you tried with a different driver?
I tried a little more new ATI driver fglrx 8.45.5 -- not helped.
This effect show only on this one TIFF image, other TIFF or other format images works perfect, so I thought may be this is a problem of format (I thought that may be Qt stores some more optimal structures for diffirent image formats or something else more clever...).
I tried to run demo on same as my configuration (Debian GNU/Linux, AMD 64 bit) but with NVidia graphics adapter -- bug is not reproduced.
Seems that this is video driver + Xorg +configuration bug...

Thanks for your respond, Dimitri!

--
 [ signature omitted ] 

Message 5 in thread

Hi,

> This effect show only on this one TIFF image, other TIFF or other format images works perfect, so I thought may be this is a problem of format (I thought that may be Qt stores some more optimal structures for diffirent image formats or something else more clever...).

No, the same image converted to PNG should exhibit the same problem, unless 
some information such as transparency is lost during the conversion.

You could double-check the properties of the QPixmap the TIFF image is loaded 
into:
	http://doc.trolltech.com/4.3/qpixmap.html#pixmap-information
		height()
		width()
		depth()
		hasAlpha()
		hasAlphaChannel()

You might find the bug happens only with QPixmaps with specific properties. If 
so, working around the problem could be just a matter of modifying the QPixmap 
after loading or while loading it.

> Seems that this is video driver + Xorg +configuration bug...

Yes, it's most probably a driver bug.

--
 [ signature omitted ] 

Message 6 in thread

Hi,

> I observed this behavior only on one TIFF image:
> http://vr1.jino-net.ru/qt/off_luv32.tif
> 
> This bug can be repeated this way:
> Running  "Ported Canvas Example" demo with problem image as first argument in command line:
> http://vr1.jino-net.ru/qt/gkrellShoot_03-02-08_064216.jpg

I cannot reproduce the problem.

Also the format of the image on disk should not be relevant. Whether the image 
file format is TIFF, PNG or whatever else, the final image in memory should be 
identical.


> Pressing Ctrl+- -- scene zooming out:
> http://vr1.jino-net.ru/qt/gkrellShoot_03-02-08_064304.jpg
> 
> Pressing Ctrl++ -- scene zooming in:
> http://vr1.jino-net.ru/qt/gkrellShoot_03-02-08_064326.jpg
> -- there is seen some random areas from screen instead of 100% scaled images.

Such problems are usually caused by the graphics driver. Try a more recent 
version of the graphics driver or contact the graphics driver vendor if you 
already have the most recent driver.

--
 [ signature omitted ]