diff options
author | Anders Bakken <anders.bakken@nokia.com> | 2009-05-05 21:37:53 (GMT) |
---|---|---|
committer | Anders Bakken <anders.bakken@nokia.com> | 2009-05-05 22:13:28 (GMT) |
commit | 8ee920d09ad139aedb14eaacc3f9c198d43e4351 (patch) | |
tree | 6b04d442cb98fbb42247a112b3ae357365fb03c2 /src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | |
parent | f06d186c3b9b053132d8107f843317067238083f (diff) | |
download | Qt-8ee920d09ad139aedb14eaacc3f9c198d43e4351.zip Qt-8ee920d09ad139aedb14eaacc3f9c198d43e4351.tar.gz Qt-8ee920d09ad139aedb14eaacc3f9c198d43e4351.tar.bz2 |
Refactored image caching
Make image caching a lot cleaner and more sensible.
By default we do not cache images since creating a preallocated surface
is quick and we don't really want to waste memory. In the case where the
driver does not support preallocated surfaces you can enable image
caching to speed up drawImage.
Reviewed-by: TrustMe
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index f7c428b..7297a99 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -157,6 +157,16 @@ static bool checkForAlphaPixels(const QImage &img) return false; } +bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) +{ +#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION + return ::checkForAlphaPixels(img); +#else + return img.hasAlphaChannel(); +#endif +} + + void QDirectFBPixmapData::fromImage(const QImage &i, Qt::ImageConversionFlags flags) { @@ -166,7 +176,7 @@ void QDirectFBPixmapData::fromImage(const QImage &i, const QImage img = (i.depth() == 1 ? i.convertToFormat(screen->alphaPixmapFormat()) : i); if (img.hasAlphaChannel() #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION - && (flags & Qt::NoOpaqueDetection || ::checkForAlphaPixels(img)) + && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) #endif ) { alpha = true; |