Add QPlatformBackingStore::toImage() implementations
On platforms where it makes sense, add the implementation that makes returning a QImage possible. This makes it possible to grab raster windows. Change-Id: I89241728aa6f7811c56bb66cd86a64aa961d71f8 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>bb10
parent
3650cbc323
commit
c7b6e13450
|
|
@ -80,6 +80,12 @@ const QImage QFbBackingStore::image()
|
|||
return mImage;
|
||||
}
|
||||
|
||||
|
||||
QImage QFbBackingStore::toImage() const
|
||||
{
|
||||
return mImage;
|
||||
}
|
||||
|
||||
void QFbBackingStore::lock()
|
||||
{
|
||||
mImageMutex.lock();
|
||||
|
|
@ -101,4 +107,3 @@ void QFbBackingStore::endPaint()
|
|||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ public:
|
|||
void resize(const QSize &size, const QRegion ®ion) Q_DECL_OVERRIDE;
|
||||
|
||||
const QImage image();
|
||||
QImage toImage() const override;
|
||||
|
||||
void lock();
|
||||
void unlock();
|
||||
|
|
|
|||
|
|
@ -57,11 +57,8 @@ public:
|
|||
|
||||
QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
|
||||
void flush(QWindow *widget, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE;
|
||||
#ifndef QT_NO_OPENGL
|
||||
QImage toImage() const Q_DECL_OVERRIDE;
|
||||
#else
|
||||
QImage toImage() const; // No QPlatformBackingStore::toImage() for NO_OPENGL builds.
|
||||
#endif
|
||||
|
||||
void resize (const QSize &size, const QRegion &) Q_DECL_OVERRIDE;
|
||||
bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE;
|
||||
void beginPaint(const QRegion ®ion) Q_DECL_OVERRIDE;
|
||||
|
|
|
|||
|
|
@ -132,4 +132,9 @@ void QWindowsDirect2DBackingStore::resize(const QSize &size, const QRegion ®i
|
|||
}
|
||||
}
|
||||
|
||||
QImage QWindowsDirect2DBackingStore::toImage() const
|
||||
{
|
||||
return nativeWindow(window())->pixmap()->toImage();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ public:
|
|||
QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
|
||||
void flush(QWindow *targetWindow, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE;
|
||||
void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
|
||||
|
||||
QImage toImage() const override;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -112,4 +112,9 @@ bool QDirectFbBackingStore::scroll(const QRegion &area, int dx, int dy)
|
|||
return true;
|
||||
}
|
||||
|
||||
QImage QDirectFbBackingStore::toImage() const
|
||||
{
|
||||
return m_pixmap.data()->toImage();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ public:
|
|||
void resize (const QSize &size, const QRegion &staticContents);
|
||||
bool scroll(const QRegion &area, int dx, int dy);
|
||||
|
||||
QImage toImage() const override;
|
||||
|
||||
private:
|
||||
void lockSurfaceToImage();
|
||||
|
||||
|
|
|
|||
|
|
@ -210,8 +210,6 @@ HDC QWindowsBackingStore::getDC() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
QImage QWindowsBackingStore::toImage() const
|
||||
{
|
||||
if (m_image.isNull()) {
|
||||
|
|
@ -221,6 +219,4 @@ QImage QWindowsBackingStore::toImage() const
|
|||
return m_image.data()->image();
|
||||
}
|
||||
|
||||
#endif // !QT_NO_OPENGL
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -65,9 +65,7 @@ public:
|
|||
|
||||
HDC getDC() const;
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
QImage toImage() const Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
|
||||
private:
|
||||
QScopedPointer<QWindowsNativeImage> m_image;
|
||||
|
|
|
|||
|
|
@ -549,12 +549,10 @@ void QXcbBackingStore::endPaint()
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
QImage QXcbBackingStore::toImage() const
|
||||
{
|
||||
return m_image && m_image->image() ? *m_image->image() : QImage();
|
||||
}
|
||||
#endif
|
||||
|
||||
QPlatformGraphicsBuffer *QXcbBackingStore::graphicsBuffer() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ public:
|
|||
void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset,
|
||||
QPlatformTextureList *textures, QOpenGLContext *context,
|
||||
bool translucentBackground) Q_DECL_OVERRIDE;
|
||||
QImage toImage() const Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
QImage toImage() const Q_DECL_OVERRIDE;
|
||||
|
||||
QPlatformGraphicsBuffer *graphicsBuffer() const Q_DECL_OVERRIDE;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue