From 4cb45486f952f5d9df7a2d954073bdbc5c5ee893 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 20 Apr 2010 11:09:32 +0200 Subject: Implement QGLPaintDevice::metric() Reviewed-By: TrustMe --- src/opengl/qglpaintdevice.cpp | 16 ++++++++++++++++ src/opengl/qglpaintdevice_p.h | 1 + 2 files changed, 17 insertions(+) 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; }; -- cgit v0.12