diff options
author | Anders Bakken <anders.bakken@nokia.com> | 2009-03-26 06:09:15 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-03-27 15:43:51 (GMT) |
commit | 43c5656d834739e86f2895cfbf3d539bb8c7c498 (patch) | |
tree | b52da52c77fd0b87913012bc6b5a0c3378dabe63 /src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | |
parent | 062c476d378022a49307aca136cb9aab381e0814 (diff) | |
download | Qt-43c5656d834739e86f2895cfbf3d539bb8c7c498.zip Qt-43c5656d834739e86f2895cfbf3d539bb8c7c498.tar.gz Qt-43c5656d834739e86f2895cfbf3d539bb8c7c498.tar.bz2 |
Major surface related fix
Make sure all QDirectFBPaintDevice surfaces always are created with a
format that is either QScreen::pixelFormat() or
QDirectFBScreen::alphaPixmapFormat().
Also, clean up surface creation by providing more high level functions.
Fix a bug where we would assume that ARGB means
Format_ARGB32_Premultiplied and not Format_ARGB32.
Reviewed-by: Tom Cooksey
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbscreen.h')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 35dea0d..a1e93c6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -88,18 +88,38 @@ public: #endif // Track surface creation/release so we can release all on exit - IDirectFBSurface* createDFBSurface(const DFBSurfaceDescription* desc, bool track = true); + enum SurfaceCreationOption { + DontTrackSurface = 0, + TrackSurface = 1 + }; + Q_DECLARE_FLAGS(SurfaceCreationOptions, SurfaceCreationOption); + IDirectFBSurface *createDFBSurface(const DFBSurfaceDescription *desc, + SurfaceCreationOptions options); + IDirectFBSurface *createDFBSurface(const QImage &image, + SurfaceCreationOptions options); + IDirectFBSurface *createDFBSurface(const QSize &size, + QImage::Format format, + SurfaceCreationOptions options); + IDirectFBSurface *copyDFBSurface(IDirectFBSurface *src, + QImage::Format format, + SurfaceCreationOptions options); + IDirectFBSurface *copyToDFBSurface(const QImage &image, + QImage::Format format, + SurfaceCreationOptions options); void releaseDFBSurface(IDirectFBSurface* surface); + bool preferVideoOnly() const; static int depth(DFBSurfacePixelFormat format); - static DFBSurfacePixelFormat getSurfacePixelFormat(const QImage &image); + static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format); static DFBSurfaceDescription getSurfaceDescription(const QImage &image); static DFBSurfaceDescription getSurfaceDescription(const uint *buffer, int length); - static QImage::Format getImageFormat(DFBSurfacePixelFormat format); + static QImage::Format getImageFormat(IDirectFBSurface *surface); + static bool initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, QImage::Format format); static inline bool isPremultiplied(QImage::Format format); + QImage::Format alphaPixmapFormat() const; #ifndef QT_NO_DIRECTFB_PALETTE static void setSurfaceColorTable(IDirectFBSurface *surface, @@ -114,6 +134,8 @@ private: QDirectFBScreenPrivate *d_ptr; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions); + inline bool QDirectFBScreen::isPremultiplied(QImage::Format format) { switch (format) { |