summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-05-05 21:46:31 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-05-05 21:47:28 (GMT)
commit0208f6419556af968bb0bbe1d1cdedede1819e67 (patch)
treebaa9b3bb9c092a0f85d605874f18a8ae41a48de4 /src/plugins
parent183602a565147299a309fc4df3165b702f0d78f4 (diff)
downloadQt-0208f6419556af968bb0bbe1d1cdedede1819e67.zip
Qt-0208f6419556af968bb0bbe1d1cdedede1819e67.tar.gz
Qt-0208f6419556af968bb0bbe1d1cdedede1819e67.tar.bz2
Cleaned up code a little
Made SurfaceCache entirely inline for better readability. Reviewed-by: TrustMe
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp69
1 files changed, 28 insertions, 41 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index c9752e9..57b2418 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -156,22 +156,42 @@ static inline uint ALPHA_MUL(uint x, uint a)
class SurfaceCache
{
public:
- SurfaceCache();
- ~SurfaceCache();
+ SurfaceCache() : surface(0), buffer(0), bufsize(0) {}
+ ~SurfaceCache() { clear(); }
- inline IDirectFBSurface *getSurface(const uint *buffer, int size);
- inline void clear();
+ IDirectFBSurface *getSurface(const uint *buf, int size)
+ {
+ if (buffer == buf && bufsize == size)
+ return surface;
+
+ clear();
+
+ const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size);
+ surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface);
+ if (!surface)
+ qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface");
+
+ buffer = const_cast<uint*>(buf);
+ bufsize = size;
+
+ return surface;
+ }
+
+ void clear()
+ {
+ if (surface && QDirectFBScreen::instance())
+ QDirectFBScreen::instance()->releaseDFBSurface(surface);
+ surface = 0;
+ buffer = 0;
+ bufsize = 0;
+ }
private:
IDirectFBSurface *surface;
uint *buffer;
int bufsize;
};
-SurfaceCache::SurfaceCache()
- : surface(0), buffer(0), bufsize(0)
-{
-}
class CachedImage
{
@@ -228,39 +248,6 @@ CachedImage::~CachedImage()
}
static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB
-
-IDirectFBSurface* SurfaceCache::getSurface(const uint *buf, int size)
-{
- if (buffer == buf && bufsize == size)
- return surface;
-
- clear();
-
- const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size);
- surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface);
- if (!surface)
- qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface");
-
- buffer = const_cast<uint*>(buf);
- bufsize = size;
-
- return surface;
-}
-
-void SurfaceCache::clear()
-{
- if (surface)
- QDirectFBScreen::instance()->releaseDFBSurface(surface);
- surface = 0;
- buffer = 0;
- bufsize = 0;
-}
-
-SurfaceCache::~SurfaceCache()
-{
- clear();
-}
-
class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate
{
public: