diff options
author | Andy Nichols <andy.nichols@digia.com> | 2014-09-01 16:05:38 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2014-09-01 17:11:46 +0300 |
commit | f013631527b3cc569527e9541c11b0f12c420473 (patch) | |
tree | a23eeda842584806839348fb7c5050b3f7fe9ab3 /softwarecontext | |
parent | b97e65a9767941c292b17e96d276c803571af9ab (diff) |
Provide a default SurfaceFormat for our Context
Since we are not using OpenGL the content of the SurfaceFormat does not
matter to us. Instead it gives us a way to expose the fact that we are
rendering to a raster surface. Using the OpenGLInfo API from QML allows
you to check the properties of the SurfaceFormat and see that the
QSurfaceFormat::RenderableType is not OpenGL or OpenGLES.
Change-Id: Iac087dd89115f3455b4fb1941385352cadd2a364
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'softwarecontext')
-rw-r--r-- | softwarecontext/context.cpp | 9 | ||||
-rw-r--r-- | softwarecontext/context.h | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/softwarecontext/context.cpp b/softwarecontext/context.cpp index 6b72bbfaad..33dc7e87e4 100644 --- a/softwarecontext/context.cpp +++ b/softwarecontext/context.cpp @@ -164,6 +164,15 @@ QSGLayer *Context::createLayer(QSGRenderContext *renderContext) return new SoftwareLayer(renderContext); } +QSurfaceFormat Context::defaultSurfaceFormat() const +{ + QSurfaceFormat format = QSurfaceFormat::defaultFormat(); + format.setRenderableType(QSurfaceFormat::DefaultRenderableType); + format.setMajorVersion(0); + format.setMinorVersion(0); + return format; +} + void RenderContext::initialize(QOpenGLContext *context) { Q_UNUSED(context) diff --git a/softwarecontext/context.h b/softwarecontext/context.h index 0e685fdfa9..88fe4e447f 100644 --- a/softwarecontext/context.h +++ b/softwarecontext/context.h @@ -90,8 +90,7 @@ public: virtual QSGGlyphNode *createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode); virtual QSGNinePatchNode *createNinePatchNode(); virtual QSGLayer *createLayer(QSGRenderContext *renderContext); - -private: + virtual QSurfaceFormat defaultSurfaceFormat() const; }; } // namespace |