iOS: Implement basic QPlatformOffscreenSurface subclass

Offscreen surface support was added in fb3577039ca8, as the platform
supports FBOs, but we need to return a subclass of QPlatformOffscreenSurface
that returns true for isValid() and a valid surfaceFormat().

Task-number: QTBUG-39759
Change-Id: If6aa9ee1672984bb93a01a5323af8d93b3b0f2b8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Tor Arne Vestbø 2015-03-18 16:34:15 +01:00 committed by Tor Arne Vestbø
parent 909e2b17cb
commit 28295915bc

View File

@ -46,6 +46,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qoffscreensurface.h>
#include <qpa/qplatformoffscreensurface.h>
#include <QtPlatformSupport/private/qcoretextfontdatabase_p.h>
@ -158,9 +159,22 @@ QPlatformOpenGLContext *QIOSIntegration::createPlatformOpenGLContext(QOpenGLCont
return new QIOSContext(context);
}
class QIOSOffscreenSurface : public QPlatformOffscreenSurface
{
public:
QIOSOffscreenSurface(QOffscreenSurface *offscreenSurface) : QPlatformOffscreenSurface(offscreenSurface) {}
QSurfaceFormat format() const Q_DECL_OVERRIDE
{
Q_ASSERT(offscreenSurface());
return offscreenSurface()->requestedFormat();
}
bool isValid() const Q_DECL_OVERRIDE { return true; }
};
QPlatformOffscreenSurface *QIOSIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
{
return new QPlatformOffscreenSurface(surface);
return new QIOSOffscreenSurface(surface);
}
QAbstractEventDispatcher *QIOSIntegration::createEventDispatcher() const