diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-20 09:09:32 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-22 14:33:03 (GMT) |
commit | 4cb45486f952f5d9df7a2d954073bdbc5c5ee893 (patch) | |
tree | 41b9ffc39e7fae36b7912d3eabbae5f9d438c5e5 /src/opengl | |
parent | e602ea2a7eee7ec427ba3faa7c450a29a75fb98b (diff) | |
download | Qt-4cb45486f952f5d9df7a2d954073bdbc5c5ee893.zip Qt-4cb45486f952f5d9df7a2d954073bdbc5c5ee893.tar.gz Qt-4cb45486f952f5d9df7a2d954073bdbc5c5ee893.tar.bz2 |
Implement QGLPaintDevice::metric()
Reviewed-By: TrustMe
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qglpaintdevice.cpp | 16 | ||||
-rw-r--r-- | src/opengl/qglpaintdevice_p.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index 2d82222..e874e85 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -63,6 +63,22 @@ QGLPaintDevice::~QGLPaintDevice() { } +int QGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const +{ + switch(metric) { + case PdmWidth: + return size().width(); + case PdmHeight: + return size().height(); + case PdmDepth: { + const QGLFormat f = format(); + return f.redBufferSize() + f.greenBufferSize() + f.blueBufferSize() + f.alphaBufferSize(); + } + default: + qWarning("QGLPaintDevice::metric() - metric %d not known", metric); + return 0; + } +} void QGLPaintDevice::beginPaint() { diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h index 3d669da..04f9c3c 100644 --- a/src/opengl/qglpaintdevice_p.h +++ b/src/opengl/qglpaintdevice_p.h @@ -81,6 +81,7 @@ public: static QGLPaintDevice* getDevice(QPaintDevice*); protected: + int metric(QPaintDevice::PaintDeviceMetric metric) const; GLuint m_previousFBO; GLuint m_thisFBO; }; |