summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorJason Barron <jason.barron@nokia.com>2010-08-04 14:09:04 (GMT)
committerJason Barron <jason.barron@nokia.com>2010-08-05 12:59:11 (GMT)
commitbd1aeaa50c60cffa3e195f3f6aed808f23a5c73c (patch)
tree1557f755f7817da48f11080bf2964838f9e688aa /src/gui/painting
parente5071275f719ec36ff5e14b1e92258f270ef22b6 (diff)
downloadQt-bd1aeaa50c60cffa3e195f3f6aed808f23a5c73c.zip
Qt-bd1aeaa50c60cffa3e195f3f6aed808f23a5c73c.tar.gz
Qt-bd1aeaa50c60cffa3e195f3f6aed808f23a5c73c.tar.bz2
Remove the memory tracking attempt from the runtime graphics system.
It has been decided that this logic will not be used by anyone at the moment so let's remove it. This removes an exported (although private) virtual function so breaks binary compatiblity for plugins built with previous versions. Reviewed-by: Jani Hautakangas
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qgraphicssystem_runtime.cpp77
-rw-r--r--src/gui/painting/qgraphicssystem_runtime_p.h13
2 files changed, 3 insertions, 87 deletions
diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp
index 568f4d7..be04df6 100644
--- a/src/gui/painting/qgraphicssystem_runtime.cpp
+++ b/src/gui/painting/qgraphicssystem_runtime.cpp
@@ -53,10 +53,8 @@ QT_BEGIN_NAMESPACE
static int qt_pixmap_serial = 0;
#define READBACK(f) \
- m_graphicsSystem->decreaseMemoryUsage(memoryUsage()); \
f \
- readBackInfo(); \
- m_graphicsSystem->increaseMemoryUsage(memoryUsage()); \
+ readBackInfo();
class QDeferredGraphicsSystemChange : public QObject
@@ -252,14 +250,6 @@ QPixmapData* QRuntimePixmapData::runtimeData() const
return m_data;
}
-uint QRuntimePixmapData::memoryUsage() const
-{
- if(is_null || d == 0)
- return 0;
- return w * h * (d / 8);
-}
-
-
QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window)
: QWindowSurface(window), m_windowSurface(0), m_pendingWindowSurface(0), m_graphicsSystem(gs)
{
@@ -295,9 +285,7 @@ void QRuntimeWindowSurface::flush(QWidget *widget, const QRegion &region,
void QRuntimeWindowSurface::setGeometry(const QRect &rect)
{
- m_graphicsSystem->decreaseMemoryUsage(memoryUsage());
m_windowSurface->setGeometry(rect);
- m_graphicsSystem->increaseMemoryUsage(memoryUsage());
}
bool QRuntimeWindowSurface::scroll(const QRegion &area, int dx, int dy)
@@ -330,18 +318,9 @@ QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const
return m_windowSurface->offset(widget);
}
-uint QRuntimeWindowSurface::memoryUsage() const
-{
- QPaintDevice *pdev = m_windowSurface->paintDevice();
- if (pdev && pdev->depth() != 0)
- return pdev->width() * pdev->height() * (pdev->depth()/8);
-
- return 0;
-}
-
QRuntimeGraphicsSystem::QRuntimeGraphicsSystem()
- : m_memoryUsage(0), m_windowSurfaceDestroyPolicy(DestroyImmediately),
- m_graphicsSystem(0), m_graphicsSystemChangeMemoryLimit(0)
+ : m_windowSurfaceDestroyPolicy(DestroyImmediately),
+ m_graphicsSystem(0)
{
QApplicationPrivate::graphics_system_name = QLatin1String("runtime");
QApplicationPrivate::runtime_graphics_system = true;
@@ -379,34 +358,15 @@ QWindowSurface *QRuntimeGraphicsSystem::createWindowSurface(QWidget *widget) con
rtSurface->m_windowSurface = m_graphicsSystem->createWindowSurface(widget);
widget->setWindowSurface(rtSurface);
m_windowSurfaces << rtSurface;
- increaseMemoryUsage(rtSurface->memoryUsage());
return rtSurface;
}
-/*!
- Sets graphics system when resource memory consumption is under /a memoryUsageLimit.
-*/
-void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name, uint memoryUsageLimit)
-{
-#ifdef QT_DEBUG
- qDebug() << "QRuntimeGraphicsSystem::setGraphicsSystem( "<< name <<", " << memoryUsageLimit << ")";
- qDebug() << " current approximated graphics system memory usage " << memoryUsage() << " bytes";
-#endif
- if (memoryUsage() >= memoryUsageLimit) {
- m_graphicsSystemChangeMemoryLimit = memoryUsageLimit;
- m_pendingGraphicsSystemName = name;
- } else {
- setGraphicsSystem(name);
- }
-}
-
void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name)
{
if (m_graphicsSystemName == name)
return;
#ifdef QT_DEBUG
qDebug() << "QRuntimeGraphicsSystem::setGraphicsSystem( " << name << " )";
- qDebug() << " current approximated graphics system memory usage "<< memoryUsage() << " bytes";
#endif
delete m_graphicsSystem;
m_graphicsSystem = QGraphicsSystemFactory::create(name);
@@ -414,7 +374,6 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name)
Q_ASSERT(m_graphicsSystem);
- m_graphicsSystemChangeMemoryLimit = 0;
m_pendingGraphicsSystemName = QString();
for (int i = 0; i < m_pixmapDatas.size(); ++i) {
@@ -447,42 +406,12 @@ void QRuntimeGraphicsSystem::removePixmapData(QRuntimePixmapData *pixmapData) co
{
int index = m_pixmapDatas.lastIndexOf(pixmapData);
m_pixmapDatas.removeAt(index);
- decreaseMemoryUsage(pixmapData->memoryUsage(), true);
}
void QRuntimeGraphicsSystem::removeWindowSurface(QRuntimeWindowSurface *windowSurface) const
{
int index = m_windowSurfaces.lastIndexOf(windowSurface);
m_windowSurfaces.removeAt(index);
- decreaseMemoryUsage(windowSurface->memoryUsage(), true);
-}
-
-void QRuntimeGraphicsSystem::increaseMemoryUsage(uint amount) const
-{
- m_memoryUsage += amount;
-
- if (m_graphicsSystemChangeMemoryLimit &&
- m_memoryUsage < m_graphicsSystemChangeMemoryLimit) {
-
- QRuntimeGraphicsSystem *gs = const_cast<QRuntimeGraphicsSystem*>(this);
- QDeferredGraphicsSystemChange *deferredChange =
- new QDeferredGraphicsSystemChange(gs, m_pendingGraphicsSystemName);
- deferredChange->launch();
- }
-}
-
-void QRuntimeGraphicsSystem::decreaseMemoryUsage(uint amount, bool persistent) const
-{
- m_memoryUsage -= amount;
-
- if (persistent && m_graphicsSystemChangeMemoryLimit &&
- m_memoryUsage < m_graphicsSystemChangeMemoryLimit) {
-
- QRuntimeGraphicsSystem *gs = const_cast<QRuntimeGraphicsSystem*>(this);
- QDeferredGraphicsSystemChange *deferredChange =
- new QDeferredGraphicsSystemChange(gs, m_pendingGraphicsSystemName);
- deferredChange->launch();
- }
}
#include "qgraphicssystem_runtime.moc"
diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h
index 7aab89c..d4c9152 100644
--- a/src/gui/painting/qgraphicssystem_runtime_p.h
+++ b/src/gui/painting/qgraphicssystem_runtime_p.h
@@ -104,8 +104,6 @@ public:
virtual QPixmapData *runtimeData() const;
- virtual uint memoryUsage() const;
-
private:
const QRuntimeGraphicsSystem *m_graphicsSystem;
@@ -131,8 +129,6 @@ public:
virtual QPoint offset(const QWidget *widget) const;
- virtual uint memoryUsage() const;
-
QWindowSurface *m_windowSurface;
QWindowSurface *m_pendingWindowSurface;
@@ -159,7 +155,6 @@ public:
void removePixmapData(QRuntimePixmapData *pixmapData) const;
void removeWindowSurface(QRuntimeWindowSurface *windowSurface) const;
- void setGraphicsSystem(const QString &name, uint memoryUsageLimit);
void setGraphicsSystem(const QString &name);
QString graphicsSystemName() const { return m_graphicsSystemName; }
@@ -170,22 +165,14 @@ public:
int windowSurfaceDestroyPolicy() const { return m_windowSurfaceDestroyPolicy; }
- uint memoryUsage() const { return m_memoryUsage; }
-
-private:
-
- void increaseMemoryUsage(uint amount) const;
- void decreaseMemoryUsage(uint amount, bool persistent = false) const;
private:
- mutable uint m_memoryUsage;
int m_windowSurfaceDestroyPolicy;
QGraphicsSystem *m_graphicsSystem;
mutable QList<QRuntimePixmapData *> m_pixmapDatas;
mutable QList<QRuntimeWindowSurface *> m_windowSurfaces;
QString m_graphicsSystemName;
- uint m_graphicsSystemChangeMemoryLimit;
QString m_pendingGraphicsSystemName;
friend class QRuntimePixmapData;