I have tried the some of your method but no luck. When I used
Qt::NoFormatConversion flag. If I do not enable the openGL for my graphic
view, It does not draw a image and it just crash. but whenever I enable the
image is black.
painter.drawimage(0,0, image); it crash. I could not figure out why It
crash. With same code, if I change drawimage to drawline, it works fine.
fly and load to Qpixmap ? If yes , do you have any suggestion to do that.
thank you in advance.
Post by Celal SAVURPost by Gunnar SlettaPost by Celal SAVURHello everyone,
I have some performance issue when I am using QPixmap.
I am getting image from buffer and I create QImage. After that using
QPixmap::fromImage(), creating pixmap and set it to QGraphicPixmapItem to
be drawn in scene.
Post by Gunnar SlettaPost by Celal SAVURWhen I put the timer to see how much time Qt spending to create
QPixmap, I realize that I converting from Qimage to QPixmap taking ~20
times more time than crating Qimage from buffer.
Post by Gunnar SlettaIf you are using the QImage(uchar *data, int width, int height, ..)
overload, this is surprising as creating the image from raw pixel data only
has to allocate the QImage d-pointer and otherwise use the data as is.
Post by Gunnar SlettaConverting that to a QPixmap will entail a QImage::convertToFormat() to
map the image into a system specific pixel format, usually QImage::RGB32 or
QImage::ARGB32_Premultiplied, but any given QPA backend may override that
with an other format if that is more compatible with its raster
backingstore.
Post by Gunnar SlettaPost by Celal SAVURBy the way, I am getting image approximately every 200 ms some times
faster than that.
Post by Gunnar SlettaPost by Celal SAVURDo you have any suggestion to increase the performance?
Can I draw QImage into scene without Qpixmap convertion? How ?
There are a couple of options.
If you can provide the pixel data in a format compatible with the
backingstore, the conversion can be simpler or just a no-op.
Post by Gunnar SlettaYou can also draw the image directly using QPainter::drawImage(). If you
didn't set the QGraphicsView viewport to be an OpenGL enabled viewport,
then the image will be converted to the right format on the fly. The actual
drawing will then be a bit slower, but as you avoid the conversion, it
should be a net win.
Post by Gunnar SlettaYou can do that by implementing your own QGraphicsItem and draw the
image in the virtual paint() function.
Bah.. Completely forgot about the Qt::NoImageConversion flag that Allan
mentioned. That saves you going through QPainter::drawImage() and a bit of
implementation work :)
Post by Gunnar SlettaIf you have a GL viewport, then the image needs to be uploaded to a GL
texture. QPainter will do this and put the image into some GL_RGB or
GL_RGBA data and might perform additional conversion before that, but
drawing the image using QPainter::drawImage might still result in less
conversion.
Post by Gunnar SlettaOf course, if you have a GL viewport and some non-standard format, you
can potentially speed it up further by implementing a QGraphicsItem which
does raw GL, encapsulated by
QPainter::beginNativePainting()/endNativePainting() and then upload to a
texture of your choosing and then draw the texture with GL commands.
Post by Gunnar Slettacheers,
Gunnar
Post by Celal SAVURThank you.
Celal
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest