| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | class QOpenGLPaintDevicePrivate | - |
| 8 | { | - |
| 9 | public: | - |
| 10 | QOpenGLPaintDevicePrivate(const QSize &size); | - |
| 11 | | - |
| 12 | QSize size; | - |
| 13 | QOpenGLContext *ctx; | - |
| 14 | | - |
| 15 | qreal dpmx; | - |
| 16 | qreal dpmy; | - |
| 17 | | - |
| 18 | bool flipped; | - |
| 19 | | - |
| 20 | QPaintEngine *engine; | - |
| 21 | }; | - |
| 22 | QOpenGLPaintDevice::QOpenGLPaintDevice() | - |
| 23 | : d_ptr(new QOpenGLPaintDevicePrivate(QSize())) | - |
| 24 | { | - |
| 25 | } | 0 |
| 26 | QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size) | - |
| 27 | : d_ptr(new QOpenGLPaintDevicePrivate(size)) | - |
| 28 | { | - |
| 29 | } | 0 |
| 30 | QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height) | - |
| 31 | : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height))) | - |
| 32 | { | - |
| 33 | } | 0 |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | QOpenGLPaintDevice::~QOpenGLPaintDevice() | - |
| 40 | { | - |
| 41 | delete d_ptr->engine; | - |
| 42 | } | 0 |
| 43 | | - |
| 44 | | - |
| 45 | | - |
| 46 | | - |
| 47 | | - |
| 48 | | - |
| 49 | | - |
| 50 | QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz) | - |
| 51 | : size(sz) | - |
| 52 | , ctx(QOpenGLContext::currentContext()) | - |
| 53 | , dpmx(qt_defaultDpiX() * 100. / 2.54) | - |
| 54 | , dpmy(qt_defaultDpiY() * 100. / 2.54) | - |
| 55 | , flipped(false) | - |
| 56 | , engine(0) | - |
| 57 | { | - |
| 58 | } | 0 |
| 59 | | - |
| 60 | class QOpenGLEngineThreadStorage | - |
| 61 | { | - |
| 62 | public: | - |
| 63 | QPaintEngine *engine() { | - |
| 64 | QPaintEngine *&localEngine = storage.localData(); | - |
| 65 | if (!localEngine) never evaluated: !localEngine | 0 |
| 66 | localEngine = new QOpenGL2PaintEngineEx; never executed: localEngine = new QOpenGL2PaintEngineEx; | 0 |
| 67 | return localEngine; never executed: return localEngine; | 0 |
| 68 | } | - |
| 69 | | - |
| 70 | private: | - |
| 71 | QThreadStorage<QPaintEngine *> storage; | - |
| 72 | }; | - |
| 73 | | - |
| 74 | static QOpenGLEngineThreadStorage *qt_opengl_engine() { static QGlobalStatic<QOpenGLEngineThreadStorage > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QOpenGLEngineThreadStorage *x = new QOpenGLEngineThreadStorage; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QOpenGLEngineThreadStorage > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) never evaluated: !thisGlobalStatic.pointer.load() never evaluated: !thisGlobalStatic.destroyed never executed: delete x; never executed: return thisGlobalStatic.pointer.load(); | 0 |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | QPaintEngine *QOpenGLPaintDevice::paintEngine() const | - |
| 81 | { | - |
| 82 | if (d_ptr->engine) never evaluated: d_ptr->engine | 0 |
| 83 | return d_ptr->engine; never executed: return d_ptr->engine; | 0 |
| 84 | | - |
| 85 | QPaintEngine *engine = qt_opengl_engine()->engine(); | - |
| 86 | if (engine->isActive() && engine->paintDevice() != this) { never evaluated: engine->isActive() never evaluated: engine->paintDevice() != this | 0 |
| 87 | d_ptr->engine = new QOpenGL2PaintEngineEx; | - |
| 88 | return d_ptr->engine; never executed: return d_ptr->engine; | 0 |
| 89 | } | - |
| 90 | | - |
| 91 | return engine; never executed: return engine; | 0 |
| 92 | } | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | | - |
| 97 | | - |
| 98 | QOpenGLContext *QOpenGLPaintDevice::context() const | - |
| 99 | { | - |
| 100 | return d_ptr->ctx; never executed: return d_ptr->ctx; | 0 |
| 101 | } | - |
| 102 | | - |
| 103 | | - |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | QSize QOpenGLPaintDevice::size() const | - |
| 110 | { | - |
| 111 | return d_ptr->size; never executed: return d_ptr->size; | 0 |
| 112 | } | - |
| 113 | | - |
| 114 | | - |
| 115 | | - |
| 116 | | - |
| 117 | | - |
| 118 | | - |
| 119 | | - |
| 120 | void QOpenGLPaintDevice::setSize(const QSize &size) | - |
| 121 | { | - |
| 122 | d_ptr->size = size; | - |
| 123 | } | 0 |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | | - |
| 128 | | - |
| 129 | int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const | - |
| 130 | { | - |
| 131 | switch (metric) { | - |
| 132 | case PdmWidth: | - |
| 133 | return d_ptr->size.width(); never executed: return d_ptr->size.width(); | 0 |
| 134 | case PdmHeight: | - |
| 135 | return d_ptr->size.height(); never executed: return d_ptr->size.height(); | 0 |
| 136 | case PdmDepth: | - |
| 137 | return 32; never executed: return 32; | 0 |
| 138 | case PdmWidthMM: | - |
| 139 | return qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx); never executed: return qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx); | 0 |
| 140 | case PdmHeightMM: | - |
| 141 | return qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy); never executed: return qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy); | 0 |
| 142 | case PdmNumColors: | - |
| 143 | return 0; never executed: return 0; | 0 |
| 144 | case PdmDpiX: | - |
| 145 | return qRound(d_ptr->dpmx * 0.0254); never executed: return qRound(d_ptr->dpmx * 0.0254); | 0 |
| 146 | case PdmDpiY: | - |
| 147 | return qRound(d_ptr->dpmy * 0.0254); never executed: return qRound(d_ptr->dpmy * 0.0254); | 0 |
| 148 | case PdmPhysicalDpiX: | - |
| 149 | return qRound(d_ptr->dpmx * 0.0254); never executed: return qRound(d_ptr->dpmx * 0.0254); | 0 |
| 150 | case PdmPhysicalDpiY: | - |
| 151 | return qRound(d_ptr->dpmy * 0.0254); never executed: return qRound(d_ptr->dpmy * 0.0254); | 0 |
| 152 | default: | - |
| 153 | QMessageLogger("opengl/qopenglpaintdevice.cpp", 279, __PRETTY_FUNCTION__).warning("QOpenGLPaintDevice::metric() - metric %d not known", metric); | - |
| 154 | return 0; never executed: return 0; | 0 |
| 155 | } | - |
| 156 | } | 0 |
| 157 | | - |
| 158 | | - |
| 159 | | - |
| 160 | | - |
| 161 | | - |
| 162 | | - |
| 163 | | - |
| 164 | qreal QOpenGLPaintDevice::dotsPerMeterX() const | - |
| 165 | { | - |
| 166 | return d_ptr->dpmx; never executed: return d_ptr->dpmx; | 0 |
| 167 | } | - |
| 168 | | - |
| 169 | | - |
| 170 | | - |
| 171 | | - |
| 172 | | - |
| 173 | | - |
| 174 | | - |
| 175 | qreal QOpenGLPaintDevice::dotsPerMeterY() const | - |
| 176 | { | - |
| 177 | return d_ptr->dpmy; never executed: return d_ptr->dpmy; | 0 |
| 178 | } | - |
| 179 | | - |
| 180 | | - |
| 181 | | - |
| 182 | | - |
| 183 | | - |
| 184 | | - |
| 185 | | - |
| 186 | void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx) | - |
| 187 | { | - |
| 188 | d_ptr->dpmx = dpmx; | - |
| 189 | } | 0 |
| 190 | | - |
| 191 | | - |
| 192 | | - |
| 193 | | - |
| 194 | | - |
| 195 | | - |
| 196 | | - |
| 197 | void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy) | - |
| 198 | { | - |
| 199 | d_ptr->dpmx = dpmy; | - |
| 200 | } | 0 |
| 201 | | - |
| 202 | | - |
| 203 | | - |
| 204 | | - |
| 205 | | - |
| 206 | | - |
| 207 | void QOpenGLPaintDevice::setPaintFlipped(bool flipped) | - |
| 208 | { | - |
| 209 | d_ptr->flipped = flipped; | - |
| 210 | } | 0 |
| 211 | | - |
| 212 | | - |
| 213 | | - |
| 214 | | - |
| 215 | | - |
| 216 | | - |
| 217 | | - |
| 218 | bool QOpenGLPaintDevice::paintFlipped() const | - |
| 219 | { | - |
| 220 | return d_ptr->flipped; never executed: return d_ptr->flipped; | 0 |
| 221 | } | - |
| 222 | void QOpenGLPaintDevice::ensureActiveTarget() | - |
| 223 | { | - |
| 224 | } | - |
| 225 | | - |
| 226 | | - |
| 227 | | - |
| | |