The backing store already knows about the window.
Also, rename surface to backing store in QFbWindow.
Change-Id: I3701b3cdbdc228200da9b93b13037655dc436f53
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Thomas Senyk <thomas.senyk@nokia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
#include "qfbscreen_p.h"
#include <qpa/qplatformwindow.h>
+#include <QtGui/qscreen.h>
QT_BEGIN_NAMESPACE
-QFbBackingStore::QFbBackingStore(QFbScreen *screen, QWindow *window)
- : QPlatformBackingStore(window),
- mScreen(screen)
+QFbBackingStore::QFbBackingStore(QWindow *window)
+ : QPlatformBackingStore(window)
{
- mImage = QImage(window->size(), mScreen->format());
-
- platformWindow = static_cast<QFbWindow*>(window->handle());
- platformWindow->surface = this;
+ mImage = QImage(window->size(), window->screen()->handle()->format());
+ (static_cast<QFbWindow *>(window->handle()))->setBackingStore(this);
}
QFbBackingStore::~QFbBackingStore()
Q_UNUSED(window);
Q_UNUSED(offset);
- platformWindow->repaint(region);
+ (static_cast<QFbWindow *>(window->handle()))->repaint(region);
}
void QFbBackingStore::resize(const QSize &size, const QRegion ®ion)
Q_UNUSED(region);
// change the widget's QImage if this is a resize
if (mImage.size() != size)
- mImage = QImage(size, mScreen->format());
+ mImage = QImage(size, window()->screen()->handle()->format());
// QPlatformBackingStore::resize(size);
}
class QFbBackingStore : public QPlatformBackingStore
{
public:
- QFbBackingStore(QFbScreen *screen, QWindow *window);
+ QFbBackingStore(QWindow *window);
~QFbBackingStore();
virtual QPaintDevice *paintDevice() { return &mImage; }
virtual void beginPaint(const QRegion ®ion);
virtual void endPaint(const QRegion ®ion);
+ virtual void resize(const QSize &size, const QRegion ®ion);
+
const QImage image() { return mImage; }
- void resize(const QSize &size, const QRegion ®ion);
protected:
friend class QFbWindow;
- QFbWindow *platformWindow;
- QFbScreen *mScreen;
QImage mImage;
};
QRect windowRect = windowStack[layerIndex]->geometry().translated(-screenOffset);
QRect windowIntersect = rect.translated(-windowRect.left(),
-windowRect.top());
- compositePainter->drawImage(rect, windowStack[layerIndex]->surface->image(),
+ compositePainter->drawImage(rect, windowStack[layerIndex]->backingStore()->image(),
windowIntersect);
if (firstLayer) {
firstLayer = false;
}
QFbWindow::QFbWindow(QWindow *window)
- : QPlatformWindow(window), visibleFlag(false)
+ : QPlatformWindow(window), mBackingStore(0), visibleFlag(false)
{
static QAtomicInt winIdGenerator(1);
windowId = winIdGenerator.fetchAndAddRelaxed(1);
WId winId() const { return windowId; }
+ void setBackingStore(QFbBackingStore *store) { mBackingStore = store; }
+ QFbBackingStore *backingStore() const { return mBackingStore; }
+
virtual void repaint(const QRegion&);
protected:
friend class QFbScreen;
- friend class QFbBackingStore;
- QFbBackingStore *surface;
+ QFbBackingStore *mBackingStore;
QList<QFbScreen *> mScreens;
QRect oldGeometry;
bool visibleFlag;
QPlatformBackingStore *QLinuxFbIntegration::createPlatformBackingStore(QWindow *window) const
{
- QFbBackingStore *surface = new QFbBackingStore(mPrimaryScreen, window);
- return surface;
+ return new QFbBackingStore(window);
}
QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWindow *window) const