| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qplatformbackingstore.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||
| 2 | ** | - | ||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||
| 5 | ** | - | ||||||||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||
| 7 | ** | - | ||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||
| 16 | ** | - | ||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||
| 24 | ** | - | ||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||
| 35 | ** | - | ||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||
| 37 | ** | - | ||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||
| 39 | - | |||||||||||||
| 40 | #include "qplatformbackingstore.h" | - | ||||||||||||
| 41 | #include <qwindow.h> | - | ||||||||||||
| 42 | #include <qpixmap.h> | - | ||||||||||||
| 43 | #include <private/qwindow_p.h> | - | ||||||||||||
| 44 | - | |||||||||||||
| 45 | #include <qopengl.h> | - | ||||||||||||
| 46 | #include <qopenglcontext.h> | - | ||||||||||||
| 47 | #include <QtGui/QMatrix4x4> | - | ||||||||||||
| 48 | #include <QtGui/QOpenGLShaderProgram> | - | ||||||||||||
| 49 | #include <QtGui/QOpenGLContext> | - | ||||||||||||
| 50 | #include <QtGui/QOpenGLFunctions> | - | ||||||||||||
| 51 | #ifndef QT_NO_OPENGL | - | ||||||||||||
| 52 | #include <QtGui/private/qopengltextureblitter_p.h> | - | ||||||||||||
| 53 | #endif | - | ||||||||||||
| 54 | #include <qpa/qplatformgraphicsbuffer.h> | - | ||||||||||||
| 55 | #include <qpa/qplatformgraphicsbufferhelper.h> | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | #ifndef GL_TEXTURE_BASE_LEVEL | - | ||||||||||||
| 58 | #define GL_TEXTURE_BASE_LEVEL 0x813C | - | ||||||||||||
| 59 | #endif | - | ||||||||||||
| 60 | #ifndef GL_TEXTURE_MAX_LEVEL | - | ||||||||||||
| 61 | #define GL_TEXTURE_MAX_LEVEL 0x813D | - | ||||||||||||
| 62 | #endif | - | ||||||||||||
| 63 | #ifndef GL_UNPACK_ROW_LENGTH | - | ||||||||||||
| 64 | #define GL_UNPACK_ROW_LENGTH 0x0CF2 | - | ||||||||||||
| 65 | #endif | - | ||||||||||||
| 66 | #ifndef GL_RGB10_A2 | - | ||||||||||||
| 67 | #define GL_RGB10_A2 0x8059 | - | ||||||||||||
| 68 | #endif | - | ||||||||||||
| 69 | #ifndef GL_UNSIGNED_INT_2_10_10_10_REV | - | ||||||||||||
| 70 | #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 | - | ||||||||||||
| 71 | #endif | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | class QPlatformBackingStorePrivate | - | ||||||||||||
| 76 | { | - | ||||||||||||
| 77 | public: | - | ||||||||||||
| 78 | QPlatformBackingStorePrivate(QWindow *w) | - | ||||||||||||
| 79 | : window(w) | - | ||||||||||||
| 80 | #ifndef QT_NO_OPENGL | - | ||||||||||||
| 81 | , textureId(0) | - | ||||||||||||
| 82 | , blitter(0) | - | ||||||||||||
| 83 | #endif | - | ||||||||||||
| 84 | { | - | ||||||||||||
| 85 | } never executed: end of block | 0 | ||||||||||||
| 86 | - | |||||||||||||
| 87 | ~QPlatformBackingStorePrivate() | - | ||||||||||||
| 88 | { | - | ||||||||||||
| 89 | #ifndef QT_NO_OPENGL | - | ||||||||||||
| 90 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||
| 91 | if (ctx) {
| 0 | ||||||||||||
| 92 | if (textureId)
| 0 | ||||||||||||
| 93 | ctx->functions()->glDeleteTextures(1, &textureId); never executed: ctx->functions()->glDeleteTextures(1, &textureId); | 0 | ||||||||||||
| 94 | if (blitter)
| 0 | ||||||||||||
| 95 | blitter->destroy(); never executed: blitter->destroy(); | 0 | ||||||||||||
| 96 | } else if (textureId || blitter) { never executed: end of block
| 0 | ||||||||||||
| 97 | qWarning("No context current during QPlatformBackingStore destruction, OpenGL resources not released"); | - | ||||||||||||
| 98 | } never executed: end of block | 0 | ||||||||||||
| 99 | delete blitter; | - | ||||||||||||
| 100 | #endif | - | ||||||||||||
| 101 | } never executed: end of block | 0 | ||||||||||||
| 102 | QWindow *window; | - | ||||||||||||
| 103 | #ifndef QT_NO_OPENGL | - | ||||||||||||
| 104 | mutable GLuint textureId; | - | ||||||||||||
| 105 | mutable QSize textureSize; | - | ||||||||||||
| 106 | mutable bool needsSwizzle; | - | ||||||||||||
| 107 | mutable bool premultiplied; | - | ||||||||||||
| 108 | QOpenGLTextureBlitter *blitter; | - | ||||||||||||
| 109 | #endif | - | ||||||||||||
| 110 | }; | - | ||||||||||||
| 111 | - | |||||||||||||
| 112 | #ifndef QT_NO_OPENGL | - | ||||||||||||
| 113 | - | |||||||||||||
| 114 | struct QBackingstoreTextureInfo | - | ||||||||||||
| 115 | { | - | ||||||||||||
| 116 | void *source; // may be null | - | ||||||||||||
| 117 | GLuint textureId; | - | ||||||||||||
| 118 | QRect rect; | - | ||||||||||||
| 119 | QRect clipRect; | - | ||||||||||||
| 120 | QPlatformTextureList::Flags flags; | - | ||||||||||||
| 121 | }; | - | ||||||||||||
| 122 | - | |||||||||||||
| 123 | Q_DECLARE_TYPEINFO(QBackingstoreTextureInfo, Q_MOVABLE_TYPE); | - | ||||||||||||
| 124 | - | |||||||||||||
| 125 | class QPlatformTextureListPrivate : public QObjectPrivate | - | ||||||||||||
| 126 | { | - | ||||||||||||
| 127 | public: | - | ||||||||||||
| 128 | QPlatformTextureListPrivate() | - | ||||||||||||
| 129 | : locked(false) | - | ||||||||||||
| 130 | { | - | ||||||||||||
| 131 | } never executed: end of block | 0 | ||||||||||||
| 132 | - | |||||||||||||
| 133 | QVector<QBackingstoreTextureInfo> textures; | - | ||||||||||||
| 134 | bool locked; | - | ||||||||||||
| 135 | }; | - | ||||||||||||
| 136 | - | |||||||||||||
| 137 | QPlatformTextureList::QPlatformTextureList(QObject *parent) | - | ||||||||||||
| 138 | : QObject(*new QPlatformTextureListPrivate, parent) | - | ||||||||||||
| 139 | { | - | ||||||||||||
| 140 | } never executed: end of block | 0 | ||||||||||||
| 141 | - | |||||||||||||
| 142 | QPlatformTextureList::~QPlatformTextureList() | - | ||||||||||||
| 143 | { | - | ||||||||||||
| 144 | } | - | ||||||||||||
| 145 | - | |||||||||||||
| 146 | int QPlatformTextureList::count() const | - | ||||||||||||
| 147 | { | - | ||||||||||||
| 148 | Q_D(const QPlatformTextureList); | - | ||||||||||||
| 149 | return d->textures.count(); never executed: return d->textures.count(); | 0 | ||||||||||||
| 150 | } | - | ||||||||||||
| 151 | - | |||||||||||||
| 152 | GLuint QPlatformTextureList::textureId(int index) const | - | ||||||||||||
| 153 | { | - | ||||||||||||
| 154 | Q_D(const QPlatformTextureList); | - | ||||||||||||
| 155 | return d->textures.at(index).textureId; never executed: return d->textures.at(index).textureId; | 0 | ||||||||||||
| 156 | } | - | ||||||||||||
| 157 | - | |||||||||||||
| 158 | void *QPlatformTextureList::source(int index) | - | ||||||||||||
| 159 | { | - | ||||||||||||
| 160 | Q_D(const QPlatformTextureList); | - | ||||||||||||
| 161 | return d->textures.at(index).source; never executed: return d->textures.at(index).source; | 0 | ||||||||||||
| 162 | } | - | ||||||||||||
| 163 | - | |||||||||||||
| 164 | QPlatformTextureList::Flags QPlatformTextureList::flags(int index) const | - | ||||||||||||
| 165 | { | - | ||||||||||||
| 166 | Q_D(const QPlatformTextureList); | - | ||||||||||||
| 167 | return d->textures.at(index).flags; never executed: return d->textures.at(index).flags; | 0 | ||||||||||||
| 168 | } | - | ||||||||||||
| 169 | - | |||||||||||||
| 170 | QRect QPlatformTextureList::geometry(int index) const | - | ||||||||||||
| 171 | { | - | ||||||||||||
| 172 | Q_D(const QPlatformTextureList); | - | ||||||||||||
| 173 | return d->textures.at(index).rect; never executed: return d->textures.at(index).rect; | 0 | ||||||||||||
| 174 | } | - | ||||||||||||
| 175 | - | |||||||||||||
| 176 | QRect QPlatformTextureList::clipRect(int index) const | - | ||||||||||||
| 177 | { | - | ||||||||||||
| 178 | Q_D(const QPlatformTextureList); | - | ||||||||||||
| 179 | return d->textures.at(index).clipRect; never executed: return d->textures.at(index).clipRect; | 0 | ||||||||||||
| 180 | } | - | ||||||||||||
| 181 | - | |||||||||||||
| 182 | void QPlatformTextureList::lock(bool on) | - | ||||||||||||
| 183 | { | - | ||||||||||||
| 184 | Q_D(QPlatformTextureList); | - | ||||||||||||
| 185 | if (on != d->locked) {
| 0 | ||||||||||||
| 186 | d->locked = on; | - | ||||||||||||
| 187 | emit locked(on); | - | ||||||||||||
| 188 | } never executed: end of block | 0 | ||||||||||||
| 189 | } never executed: end of block | 0 | ||||||||||||
| 190 | - | |||||||||||||
| 191 | bool QPlatformTextureList::isLocked() const | - | ||||||||||||
| 192 | { | - | ||||||||||||
| 193 | Q_D(const QPlatformTextureList); | - | ||||||||||||
| 194 | return d->locked; never executed: return d->locked; | 0 | ||||||||||||
| 195 | } | - | ||||||||||||
| 196 | - | |||||||||||||
| 197 | void QPlatformTextureList::appendTexture(void *source, GLuint textureId, const QRect &geometry, | - | ||||||||||||
| 198 | const QRect &clipRect, Flags flags) | - | ||||||||||||
| 199 | { | - | ||||||||||||
| 200 | Q_D(QPlatformTextureList); | - | ||||||||||||
| 201 | QBackingstoreTextureInfo bi; | - | ||||||||||||
| 202 | bi.source = source; | - | ||||||||||||
| 203 | bi.textureId = textureId; | - | ||||||||||||
| 204 | bi.rect = geometry; | - | ||||||||||||
| 205 | bi.clipRect = clipRect; | - | ||||||||||||
| 206 | bi.flags = flags; | - | ||||||||||||
| 207 | d->textures.append(bi); | - | ||||||||||||
| 208 | } never executed: end of block | 0 | ||||||||||||
| 209 | - | |||||||||||||
| 210 | void QPlatformTextureList::clear() | - | ||||||||||||
| 211 | { | - | ||||||||||||
| 212 | Q_D(QPlatformTextureList); | - | ||||||||||||
| 213 | d->textures.clear(); | - | ||||||||||||
| 214 | } never executed: end of block | 0 | ||||||||||||
| 215 | #endif // QT_NO_OPENGL | - | ||||||||||||
| 216 | - | |||||||||||||
| 217 | /*! | - | ||||||||||||
| 218 | \class QPlatformBackingStore | - | ||||||||||||
| 219 | \since 5.0 | - | ||||||||||||
| 220 | \internal | - | ||||||||||||
| 221 | \preliminary | - | ||||||||||||
| 222 | \ingroup qpa | - | ||||||||||||
| 223 | - | |||||||||||||
| 224 | \brief The QPlatformBackingStore class provides the drawing area for top-level | - | ||||||||||||
| 225 | windows. | - | ||||||||||||
| 226 | */ | - | ||||||||||||
| 227 | - | |||||||||||||
| 228 | /*! | - | ||||||||||||
| 229 | \fn void QPlatformBackingStore::flush(QWindow *window, const QRegion ®ion, | - | ||||||||||||
| 230 | const QPoint &offset) | - | ||||||||||||
| 231 | - | |||||||||||||
| 232 | Flushes the given \a region from the specified \a window onto the | - | ||||||||||||
| 233 | screen. | - | ||||||||||||
| 234 | - | |||||||||||||
| 235 | The \a offset parameter is relative to the origin of the backing | - | ||||||||||||
| 236 | store image. | - | ||||||||||||
| 237 | */ | - | ||||||||||||
| 238 | - | |||||||||||||
| 239 | #ifndef QT_NO_OPENGL | - | ||||||||||||
| 240 | - | |||||||||||||
| 241 | static inline QRect deviceRect(const QRect &rect, QWindow *window) | - | ||||||||||||
| 242 | { | - | ||||||||||||
| 243 | QRect deviceRect(rect.topLeft() * window->devicePixelRatio(), | - | ||||||||||||
| 244 | rect.size() * window->devicePixelRatio()); | - | ||||||||||||
| 245 | return deviceRect; never executed: return deviceRect; | 0 | ||||||||||||
| 246 | } | - | ||||||||||||
| 247 | - | |||||||||||||
| 248 | static QRegion deviceRegion(const QRegion ®ion, QWindow *window, const QPoint &offset) | - | ||||||||||||
| 249 | { | - | ||||||||||||
| 250 | if (offset.isNull() && window->devicePixelRatio() <= 1)
| 0 | ||||||||||||
| 251 | return region; never executed: return region; | 0 | ||||||||||||
| 252 | - | |||||||||||||
| 253 | QVector<QRect> rects; | - | ||||||||||||
| 254 | const QVector<QRect> regionRects = region.rects(); | - | ||||||||||||
| 255 | rects.reserve(regionRects.count()); | - | ||||||||||||
| 256 | for (const QRect &rect : regionRects) | - | ||||||||||||
| 257 | rects.append(deviceRect(rect.translated(offset), window)); never executed: rects.append(deviceRect(rect.translated(offset), window)); | 0 | ||||||||||||
| 258 | - | |||||||||||||
| 259 | QRegion deviceRegion; | - | ||||||||||||
| 260 | deviceRegion.setRects(rects.constData(), rects.count()); | - | ||||||||||||
| 261 | return deviceRegion; never executed: return deviceRegion; | 0 | ||||||||||||
| 262 | } | - | ||||||||||||
| 263 | - | |||||||||||||
| 264 | static inline QRect toBottomLeftRect(const QRect &topLeftRect, int windowHeight) | - | ||||||||||||
| 265 | { | - | ||||||||||||
| 266 | return QRect(topLeftRect.x(), windowHeight - topLeftRect.bottomRight().y() - 1, never executed: return QRect(topLeftRect.x(), windowHeight - topLeftRect.bottomRight().y() - 1, topLeftRect.width(), topLeftRect.height()); | 0 | ||||||||||||
| 267 | topLeftRect.width(), topLeftRect.height()); never executed: return QRect(topLeftRect.x(), windowHeight - topLeftRect.bottomRight().y() - 1, topLeftRect.width(), topLeftRect.height()); | 0 | ||||||||||||
| 268 | } | - | ||||||||||||
| 269 | - | |||||||||||||
| 270 | static void blitTextureForWidget(const QPlatformTextureList *textures, int idx, QWindow *window, const QRect &deviceWindowRect, | - | ||||||||||||
| 271 | QOpenGLTextureBlitter *blitter, const QPoint &offset) | - | ||||||||||||
| 272 | { | - | ||||||||||||
| 273 | const QRect clipRect = textures->clipRect(idx); | - | ||||||||||||
| 274 | if (clipRect.isEmpty())
| 0 | ||||||||||||
| 275 | return; never executed: return; | 0 | ||||||||||||
| 276 | - | |||||||||||||
| 277 | QRect rectInWindow = textures->geometry(idx); | - | ||||||||||||
| 278 | // relative to the TLW, not necessarily our window (if the flush is for a native child widget), have to adjust | - | ||||||||||||
| 279 | rectInWindow.translate(-offset); | - | ||||||||||||
| 280 | - | |||||||||||||
| 281 | const QRect clippedRectInWindow = rectInWindow & clipRect.translated(rectInWindow.topLeft()); | - | ||||||||||||
| 282 | const QRect srcRect = toBottomLeftRect(clipRect, rectInWindow.height()); | - | ||||||||||||
| 283 | - | |||||||||||||
| 284 | const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(deviceRect(clippedRectInWindow, window), | - | ||||||||||||
| 285 | deviceWindowRect); | - | ||||||||||||
| 286 | - | |||||||||||||
| 287 | const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(deviceRect(srcRect, window), | - | ||||||||||||
| 288 | deviceRect(rectInWindow, window).size(), | - | ||||||||||||
| 289 | QOpenGLTextureBlitter::OriginBottomLeft); | - | ||||||||||||
| 290 | - | |||||||||||||
| 291 | blitter->blit(textures->textureId(idx), target, source); | - | ||||||||||||
| 292 | } never executed: end of block | 0 | ||||||||||||
| 293 | - | |||||||||||||
| 294 | /*! | - | ||||||||||||
| 295 | Flushes the given \a region from the specified \a window onto the | - | ||||||||||||
| 296 | screen, and composes it with the specified \a textures. | - | ||||||||||||
| 297 | - | |||||||||||||
| 298 | The default implementation retrieves the contents using toTexture() | - | ||||||||||||
| 299 | and composes using OpenGL. May be reimplemented in subclasses if there | - | ||||||||||||
| 300 | is a more efficient native way to do it. | - | ||||||||||||
| 301 | - | |||||||||||||
| 302 | \note \a region is relative to the window which may not be top-level in case | - | ||||||||||||
| 303 | \a window corresponds to a native child widget. \a offset is the position of | - | ||||||||||||
| 304 | the native child relative to the top-level window. | - | ||||||||||||
| 305 | */ | - | ||||||||||||
| 306 | - | |||||||||||||
| 307 | void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®ion, | - | ||||||||||||
| 308 | const QPoint &offset, | - | ||||||||||||
| 309 | QPlatformTextureList *textures, QOpenGLContext *context, | - | ||||||||||||
| 310 | bool translucentBackground) | - | ||||||||||||
| 311 | { | - | ||||||||||||
| 312 | if (!qt_window_private(window)->receivedExpose)
| 0 | ||||||||||||
| 313 | return; never executed: return; | 0 | ||||||||||||
| 314 | - | |||||||||||||
| 315 | if (!context->makeCurrent(window)) {
| 0 | ||||||||||||
| 316 | qWarning("composeAndFlush: makeCurrent() failed"); | - | ||||||||||||
| 317 | return; never executed: return; | 0 | ||||||||||||
| 318 | } | - | ||||||||||||
| 319 | - | |||||||||||||
| 320 | QWindowPrivate::get(window)->lastComposeTime.start(); | - | ||||||||||||
| 321 | - | |||||||||||||
| 322 | QOpenGLFunctions *funcs = context->functions(); | - | ||||||||||||
| 323 | funcs->glViewport(0, 0, window->width() * window->devicePixelRatio(), window->height() * window->devicePixelRatio()); | - | ||||||||||||
| 324 | funcs->glClearColor(0, 0, 0, translucentBackground ? 0 : 1); | - | ||||||||||||
| 325 | funcs->glClear(GL_COLOR_BUFFER_BIT); | - | ||||||||||||
| 326 | - | |||||||||||||
| 327 | if (!d_ptr->blitter) {
| 0 | ||||||||||||
| 328 | d_ptr->blitter = new QOpenGLTextureBlitter; | - | ||||||||||||
| 329 | d_ptr->blitter->create(); | - | ||||||||||||
| 330 | } never executed: end of block | 0 | ||||||||||||
| 331 | - | |||||||||||||
| 332 | d_ptr->blitter->bind(); | - | ||||||||||||
| 333 | - | |||||||||||||
| 334 | const QRect deviceWindowRect = deviceRect(QRect(QPoint(), window->size()), window); | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | // Textures for renderToTexture widgets. | - | ||||||||||||
| 337 | for (int i = 0; i < textures->count(); ++i) {
| 0 | ||||||||||||
| 338 | if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop))
| 0 | ||||||||||||
| 339 | blitTextureForWidget(textures, i, window, deviceWindowRect, d_ptr->blitter, offset); never executed: blitTextureForWidget(textures, i, window, deviceWindowRect, d_ptr->blitter, offset); | 0 | ||||||||||||
| 340 | } never executed: end of block | 0 | ||||||||||||
| 341 | - | |||||||||||||
| 342 | // Backingstore texture with the normal widgets. | - | ||||||||||||
| 343 | GLuint textureId = 0; | - | ||||||||||||
| 344 | QOpenGLTextureBlitter::Origin origin = QOpenGLTextureBlitter::OriginTopLeft; | - | ||||||||||||
| 345 | if (QPlatformGraphicsBuffer *graphicsBuffer = this->graphicsBuffer()) {
| 0 | ||||||||||||
| 346 | if (graphicsBuffer->size() != d_ptr->textureSize) {
| 0 | ||||||||||||
| 347 | if (d_ptr->textureId)
| 0 | ||||||||||||
| 348 | funcs->glDeleteTextures(1, &d_ptr->textureId); never executed: funcs->glDeleteTextures(1, &d_ptr->textureId); | 0 | ||||||||||||
| 349 | funcs->glGenTextures(1, &d_ptr->textureId); | - | ||||||||||||
| 350 | funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); | - | ||||||||||||
| 351 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||
| 352 | if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
| 0 | ||||||||||||
| 353 | funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); | - | ||||||||||||
| 354 | funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); | - | ||||||||||||
| 355 | } never executed: end of block | 0 | ||||||||||||
| 356 | funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | - | ||||||||||||
| 357 | funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | - | ||||||||||||
| 358 | funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | - | ||||||||||||
| 359 | funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | - | ||||||||||||
| 360 | - | |||||||||||||
| 361 | if (QPlatformGraphicsBufferHelper::lockAndBindToTexture(graphicsBuffer, &d_ptr->needsSwizzle, &d_ptr->premultiplied)) {
| 0 | ||||||||||||
| 362 | d_ptr->textureSize = graphicsBuffer->size(); | - | ||||||||||||
| 363 | } else { never executed: end of block | 0 | ||||||||||||
| 364 | d_ptr->textureSize = QSize(0,0); | - | ||||||||||||
| 365 | } never executed: end of block | 0 | ||||||||||||
| 366 | - | |||||||||||||
| 367 | graphicsBuffer->unlock(); | - | ||||||||||||
| 368 | } else if (!region.isEmpty()){ never executed: end of block
| 0 | ||||||||||||
| 369 | funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); | - | ||||||||||||
| 370 | QPlatformGraphicsBufferHelper::lockAndBindToTexture(graphicsBuffer, &d_ptr->needsSwizzle, &d_ptr->premultiplied); | - | ||||||||||||
| 371 | } never executed: end of block | 0 | ||||||||||||
| 372 | - | |||||||||||||
| 373 | if (graphicsBuffer->origin() == QPlatformGraphicsBuffer::OriginBottomLeft)
| 0 | ||||||||||||
| 374 | origin = QOpenGLTextureBlitter::OriginBottomLeft; never executed: origin = QOpenGLTextureBlitter::OriginBottomLeft; | 0 | ||||||||||||
| 375 | textureId = d_ptr->textureId; | - | ||||||||||||
| 376 | } else { never executed: end of block | 0 | ||||||||||||
| 377 | TextureFlags flags = 0; | - | ||||||||||||
| 378 | textureId = toTexture(deviceRegion(region, window, offset), &d_ptr->textureSize, &flags); | - | ||||||||||||
| 379 | d_ptr->needsSwizzle = (flags & TextureSwizzle) != 0; | - | ||||||||||||
| 380 | d_ptr->premultiplied = (flags & TexturePremultiplied) != 0; | - | ||||||||||||
| 381 | if (flags & TextureFlip)
| 0 | ||||||||||||
| 382 | origin = QOpenGLTextureBlitter::OriginBottomLeft; never executed: origin = QOpenGLTextureBlitter::OriginBottomLeft; | 0 | ||||||||||||
| 383 | } never executed: end of block | 0 | ||||||||||||
| 384 | - | |||||||||||||
| 385 | funcs->glEnable(GL_BLEND); | - | ||||||||||||
| 386 | if (d_ptr->premultiplied)
| 0 | ||||||||||||
| 387 | funcs->glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); never executed: funcs->glBlendFuncSeparate(1, 0x0303, 1, 1); | 0 | ||||||||||||
| 388 | else | - | ||||||||||||
| 389 | funcs->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); never executed: funcs->glBlendFuncSeparate(0x0302, 0x0303, 1, 1); | 0 | ||||||||||||
| 390 | - | |||||||||||||
| 391 | if (textureId) {
| 0 | ||||||||||||
| 392 | if (d_ptr->needsSwizzle)
| 0 | ||||||||||||
| 393 | d_ptr->blitter->setSwizzleRB(true); never executed: d_ptr->blitter->setSwizzleRB(true); | 0 | ||||||||||||
| 394 | // The backingstore is for the entire tlw. | - | ||||||||||||
| 395 | // In case of native children offset tells the position relative to the tlw. | - | ||||||||||||
| 396 | const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(offset), d_ptr->textureSize.height()); | - | ||||||||||||
| 397 | const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(srcRect, | - | ||||||||||||
| 398 | d_ptr->textureSize, | - | ||||||||||||
| 399 | origin); | - | ||||||||||||
| 400 | d_ptr->blitter->blit(textureId, QMatrix4x4(), source); | - | ||||||||||||
| 401 | if (d_ptr->needsSwizzle)
| 0 | ||||||||||||
| 402 | d_ptr->blitter->setSwizzleRB(false); never executed: d_ptr->blitter->setSwizzleRB(false); | 0 | ||||||||||||
| 403 | } never executed: end of block | 0 | ||||||||||||
| 404 | - | |||||||||||||
| 405 | // Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set. | - | ||||||||||||
| 406 | for (int i = 0; i < textures->count(); ++i) {
| 0 | ||||||||||||
| 407 | if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop))
| 0 | ||||||||||||
| 408 | blitTextureForWidget(textures, i, window, deviceWindowRect, d_ptr->blitter, offset); never executed: blitTextureForWidget(textures, i, window, deviceWindowRect, d_ptr->blitter, offset); | 0 | ||||||||||||
| 409 | } never executed: end of block | 0 | ||||||||||||
| 410 | - | |||||||||||||
| 411 | funcs->glDisable(GL_BLEND); | - | ||||||||||||
| 412 | d_ptr->blitter->release(); | - | ||||||||||||
| 413 | - | |||||||||||||
| 414 | context->swapBuffers(window); | - | ||||||||||||
| 415 | } never executed: end of block | 0 | ||||||||||||
| 416 | - | |||||||||||||
| 417 | /*! | - | ||||||||||||
| 418 | Implemented in subclasses to return the content of the backingstore as a QImage. | - | ||||||||||||
| 419 | - | |||||||||||||
| 420 | If QPlatformIntegration::RasterGLSurface is supported, either this function or | - | ||||||||||||
| 421 | toTexture() must be implemented. | - | ||||||||||||
| 422 | - | |||||||||||||
| 423 | \sa toTexture() | - | ||||||||||||
| 424 | */ | - | ||||||||||||
| 425 | QImage QPlatformBackingStore::toImage() const | - | ||||||||||||
| 426 | { | - | ||||||||||||
| 427 | return QImage(); never executed: return QImage(); | 0 | ||||||||||||
| 428 | } | - | ||||||||||||
| 429 | - | |||||||||||||
| 430 | /*! | - | ||||||||||||
| 431 | May be reimplemented in subclasses to return the content of the | - | ||||||||||||
| 432 | backingstore as an OpenGL texture. \a dirtyRegion is the part of the | - | ||||||||||||
| 433 | backingstore which may have changed since the last call to this function. The | - | ||||||||||||
| 434 | caller of this function must ensure that there is a current context. | - | ||||||||||||
| 435 | - | |||||||||||||
| 436 | The size of the texture is returned in \a textureSize. | - | ||||||||||||
| 437 | - | |||||||||||||
| 438 | The ownership of the texture is not transferred. The caller must not store | - | ||||||||||||
| 439 | the return value between calls, but instead call this function before each use. | - | ||||||||||||
| 440 | - | |||||||||||||
| 441 | The default implementation returns a cached texture if \a dirtyRegion is empty and | - | ||||||||||||
| 442 | \a textureSize matches the backingstore size, otherwise it retrieves the content using | - | ||||||||||||
| 443 | toImage() and performs a texture upload. This works only if the value of \a textureSize | - | ||||||||||||
| 444 | is preserved between the calls to this function. | - | ||||||||||||
| 445 | - | |||||||||||||
| 446 | If the red and blue components have to swapped, \a flags will be set to include \c | - | ||||||||||||
| 447 | TextureSwizzle. This allows creating textures from images in formats like | - | ||||||||||||
| 448 | QImage::Format_RGB32 without any further image conversion. Instead, the swizzling will | - | ||||||||||||
| 449 | be done in the shaders when performing composition. Other formats, that do not need | - | ||||||||||||
| 450 | such swizzling due to being already byte ordered RGBA, for example | - | ||||||||||||
| 451 | QImage::Format_RGBA8888, must result in having \a needsSwizzle set to false. | - | ||||||||||||
| 452 | - | |||||||||||||
| 453 | If the image has to be flipped (e.g. because the texture is attached to an FBO), \a | - | ||||||||||||
| 454 | flags will be set to include \c TextureFlip. | - | ||||||||||||
| 455 | - | |||||||||||||
| 456 | \note \a dirtyRegion is relative to the backingstore so no adjustment is needed. | - | ||||||||||||
| 457 | */ | - | ||||||||||||
| 458 | GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const | - | ||||||||||||
| 459 | { | - | ||||||||||||
| 460 | Q_ASSERT(textureSize); | - | ||||||||||||
| 461 | Q_ASSERT(flags); | - | ||||||||||||
| 462 | - | |||||||||||||
| 463 | QImage image = toImage(); | - | ||||||||||||
| 464 | QSize imageSize = image.size(); | - | ||||||||||||
| 465 | - | |||||||||||||
| 466 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||
| 467 | GLenum internalFormat = GL_RGBA; | - | ||||||||||||
| 468 | GLuint pixelType = GL_UNSIGNED_BYTE; | - | ||||||||||||
| 469 | - | |||||||||||||
| 470 | bool needsConversion = false; | - | ||||||||||||
| 471 | *flags = 0; | - | ||||||||||||
| 472 | switch (image.format()) { | - | ||||||||||||
| 473 | case QImage::Format_ARGB32_Premultiplied: never executed: case QImage::Format_ARGB32_Premultiplied: | 0 | ||||||||||||
| 474 | *flags |= TexturePremultiplied; | - | ||||||||||||
| 475 | // no break | - | ||||||||||||
| 476 | case QImage::Format_RGB32: code before this statement never executed: case QImage::Format_RGB32:never executed: case QImage::Format_RGB32: | 0 | ||||||||||||
| 477 | case QImage::Format_ARGB32: never executed: case QImage::Format_ARGB32: | 0 | ||||||||||||
| 478 | *flags |= TextureSwizzle; | - | ||||||||||||
| 479 | break; never executed: break; | 0 | ||||||||||||
| 480 | case QImage::Format_RGBA8888_Premultiplied: never executed: case QImage::Format_RGBA8888_Premultiplied: | 0 | ||||||||||||
| 481 | *flags |= TexturePremultiplied; | - | ||||||||||||
| 482 | // no break | - | ||||||||||||
| 483 | case QImage::Format_RGBX8888: code before this statement never executed: case QImage::Format_RGBX8888:never executed: case QImage::Format_RGBX8888: | 0 | ||||||||||||
| 484 | case QImage::Format_RGBA8888: never executed: case QImage::Format_RGBA8888: | 0 | ||||||||||||
| 485 | break; never executed: break; | 0 | ||||||||||||
| 486 | case QImage::Format_BGR30: never executed: case QImage::Format_BGR30: | 0 | ||||||||||||
| 487 | case QImage::Format_A2BGR30_Premultiplied: never executed: case QImage::Format_A2BGR30_Premultiplied: | 0 | ||||||||||||
| 488 | if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
| 0 | ||||||||||||
| 489 | pixelType = GL_UNSIGNED_INT_2_10_10_10_REV; | - | ||||||||||||
| 490 | internalFormat = GL_RGB10_A2; | - | ||||||||||||
| 491 | *flags |= TexturePremultiplied; | - | ||||||||||||
| 492 | } else { never executed: end of block | 0 | ||||||||||||
| 493 | needsConversion = true; | - | ||||||||||||
| 494 | } never executed: end of block | 0 | ||||||||||||
| 495 | break; never executed: break; | 0 | ||||||||||||
| 496 | case QImage::Format_RGB30: never executed: case QImage::Format_RGB30: | 0 | ||||||||||||
| 497 | case QImage::Format_A2RGB30_Premultiplied: never executed: case QImage::Format_A2RGB30_Premultiplied: | 0 | ||||||||||||
| 498 | if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
| 0 | ||||||||||||
| 499 | pixelType = GL_UNSIGNED_INT_2_10_10_10_REV; | - | ||||||||||||
| 500 | internalFormat = GL_RGB10_A2; | - | ||||||||||||
| 501 | *flags |= TextureSwizzle | TexturePremultiplied; | - | ||||||||||||
| 502 | } else { never executed: end of block | 0 | ||||||||||||
| 503 | needsConversion = true; | - | ||||||||||||
| 504 | } never executed: end of block | 0 | ||||||||||||
| 505 | break; never executed: break; | 0 | ||||||||||||
| 506 | default: never executed: default: | 0 | ||||||||||||
| 507 | needsConversion = true; | - | ||||||||||||
| 508 | break; never executed: break; | 0 | ||||||||||||
| 509 | } | - | ||||||||||||
| 510 | if (imageSize.isEmpty()) {
| 0 | ||||||||||||
| 511 | *textureSize = imageSize; | - | ||||||||||||
| 512 | return 0; never executed: return 0; | 0 | ||||||||||||
| 513 | } | - | ||||||||||||
| 514 | - | |||||||||||||
| 515 | // Must rely on the input only, not d_ptr. | - | ||||||||||||
| 516 | // With the default composeAndFlush() textureSize is &d_ptr->textureSize. | - | ||||||||||||
| 517 | bool resized = *textureSize != imageSize; | - | ||||||||||||
| 518 | if (dirtyRegion.isEmpty() && !resized)
| 0 | ||||||||||||
| 519 | return d_ptr->textureId; never executed: return d_ptr->textureId; | 0 | ||||||||||||
| 520 | - | |||||||||||||
| 521 | *textureSize = imageSize; | - | ||||||||||||
| 522 | - | |||||||||||||
| 523 | if (needsConversion)
| 0 | ||||||||||||
| 524 | image = image.convertToFormat(QImage::Format_RGBA8888); never executed: image = image.convertToFormat(QImage::Format_RGBA8888); | 0 | ||||||||||||
| 525 | - | |||||||||||||
| 526 | // The image provided by the backingstore may have a stride larger than width * 4, for | - | ||||||||||||
| 527 | // instance on platforms that manually implement client-side decorations. | - | ||||||||||||
| 528 | static const int bytesPerPixel = 4; | - | ||||||||||||
| 529 | const int strideInPixels = image.bytesPerLine() / bytesPerPixel; | - | ||||||||||||
| 530 | const bool hasUnpackRowLength = !ctx->isOpenGLES() || ctx->format().majorVersion() >= 3;
| 0 | ||||||||||||
| 531 | - | |||||||||||||
| 532 | QOpenGLFunctions *funcs = ctx->functions(); | - | ||||||||||||
| 533 | - | |||||||||||||
| 534 | if (hasUnpackRowLength) {
| 0 | ||||||||||||
| 535 | funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, strideInPixels); | - | ||||||||||||
| 536 | } else if (strideInPixels != image.width()) { never executed: end of block
| 0 | ||||||||||||
| 537 | // No UNPACK_ROW_LENGTH on ES 2.0 and yet we would need it. This case is typically | - | ||||||||||||
| 538 | // hit with QtWayland which is rarely used in combination with a ES2.0-only GL | - | ||||||||||||
| 539 | // implementation. Therefore, accept the performance hit and do a copy. | - | ||||||||||||
| 540 | image = image.copy(); | - | ||||||||||||
| 541 | } never executed: end of block | 0 | ||||||||||||
| 542 | - | |||||||||||||
| 543 | if (resized) {
| 0 | ||||||||||||
| 544 | if (d_ptr->textureId)
| 0 | ||||||||||||
| 545 | funcs->glDeleteTextures(1, &d_ptr->textureId); never executed: funcs->glDeleteTextures(1, &d_ptr->textureId); | 0 | ||||||||||||
| 546 | funcs->glGenTextures(1, &d_ptr->textureId); | - | ||||||||||||
| 547 | funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); | - | ||||||||||||
| 548 | if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
| 0 | ||||||||||||
| 549 | funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); | - | ||||||||||||
| 550 | funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); | - | ||||||||||||
| 551 | } never executed: end of block | 0 | ||||||||||||
| 552 | funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | - | ||||||||||||
| 553 | funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | - | ||||||||||||
| 554 | funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | - | ||||||||||||
| 555 | funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | - | ||||||||||||
| 556 | - | |||||||||||||
| 557 | funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, imageSize.width(), imageSize.height(), 0, GL_RGBA, pixelType, | - | ||||||||||||
| 558 | const_cast<uchar*>(image.constBits())); | - | ||||||||||||
| 559 | } else { never executed: end of block | 0 | ||||||||||||
| 560 | funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); | - | ||||||||||||
| 561 | QRect imageRect = image.rect(); | - | ||||||||||||
| 562 | QRect rect = dirtyRegion.boundingRect() & imageRect; | - | ||||||||||||
| 563 | - | |||||||||||||
| 564 | if (hasUnpackRowLength) {
| 0 | ||||||||||||
| 565 | funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType, | - | ||||||||||||
| 566 | image.constScanLine(rect.y()) + rect.x() * bytesPerPixel); | - | ||||||||||||
| 567 | } else { never executed: end of block | 0 | ||||||||||||
| 568 | // if the rect is wide enough it's cheaper to just | - | ||||||||||||
| 569 | // extend it instead of doing an image copy | - | ||||||||||||
| 570 | if (rect.width() >= imageRect.width() / 2) {
| 0 | ||||||||||||
| 571 | rect.setX(0); | - | ||||||||||||
| 572 | rect.setWidth(imageRect.width()); | - | ||||||||||||
| 573 | } never executed: end of block | 0 | ||||||||||||
| 574 | - | |||||||||||||
| 575 | // if the sub-rect is full-width we can pass the image data directly to | - | ||||||||||||
| 576 | // OpenGL instead of copying, since there's no gap between scanlines | - | ||||||||||||
| 577 | - | |||||||||||||
| 578 | if (rect.width() == imageRect.width()) {
| 0 | ||||||||||||
| 579 | funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType, | - | ||||||||||||
| 580 | image.constScanLine(rect.y())); | - | ||||||||||||
| 581 | } else { never executed: end of block | 0 | ||||||||||||
| 582 | funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, pixelType, | - | ||||||||||||
| 583 | image.copy(rect).constBits()); | - | ||||||||||||
| 584 | } never executed: end of block | 0 | ||||||||||||
| 585 | } | - | ||||||||||||
| 586 | } | - | ||||||||||||
| 587 | - | |||||||||||||
| 588 | if (hasUnpackRowLength)
| 0 | ||||||||||||
| 589 | funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); never executed: funcs->glPixelStorei(0x0CF2, 0); | 0 | ||||||||||||
| 590 | - | |||||||||||||
| 591 | return d_ptr->textureId; never executed: return d_ptr->textureId; | 0 | ||||||||||||
| 592 | } | - | ||||||||||||
| 593 | #endif // QT_NO_OPENGL | - | ||||||||||||
| 594 | - | |||||||||||||
| 595 | /*! | - | ||||||||||||
| 596 | \fn QPaintDevice* QPlatformBackingStore::paintDevice() | - | ||||||||||||
| 597 | - | |||||||||||||
| 598 | Implement this function to return the appropriate paint device. | - | ||||||||||||
| 599 | */ | - | ||||||||||||
| 600 | - | |||||||||||||
| 601 | /*! | - | ||||||||||||
| 602 | Constructs an empty surface for the given top-level \a window. | - | ||||||||||||
| 603 | */ | - | ||||||||||||
| 604 | QPlatformBackingStore::QPlatformBackingStore(QWindow *window) | - | ||||||||||||
| 605 | : d_ptr(new QPlatformBackingStorePrivate(window)) | - | ||||||||||||
| 606 | { | - | ||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||
| 608 | - | |||||||||||||
| 609 | /*! | - | ||||||||||||
| 610 | Destroys this surface. | - | ||||||||||||
| 611 | */ | - | ||||||||||||
| 612 | QPlatformBackingStore::~QPlatformBackingStore() | - | ||||||||||||
| 613 | { | - | ||||||||||||
| 614 | delete d_ptr; | - | ||||||||||||
| 615 | } never executed: end of block | 0 | ||||||||||||
| 616 | - | |||||||||||||
| 617 | /*! | - | ||||||||||||
| 618 | Returns a pointer to the top-level window associated with this | - | ||||||||||||
| 619 | surface. | - | ||||||||||||
| 620 | */ | - | ||||||||||||
| 621 | QWindow* QPlatformBackingStore::window() const | - | ||||||||||||
| 622 | { | - | ||||||||||||
| 623 | return d_ptr->window; never executed: return d_ptr->window; | 0 | ||||||||||||
| 624 | } | - | ||||||||||||
| 625 | - | |||||||||||||
| 626 | /*! | - | ||||||||||||
| 627 | This function is called before painting onto the surface begins, | - | ||||||||||||
| 628 | with the \a region in which the painting will occur. | - | ||||||||||||
| 629 | - | |||||||||||||
| 630 | \sa endPaint(), paintDevice() | - | ||||||||||||
| 631 | */ | - | ||||||||||||
| 632 | - | |||||||||||||
| 633 | void QPlatformBackingStore::beginPaint(const QRegion &) | - | ||||||||||||
| 634 | { | - | ||||||||||||
| 635 | } | - | ||||||||||||
| 636 | - | |||||||||||||
| 637 | /*! | - | ||||||||||||
| 638 | This function is called after painting onto the surface has ended. | - | ||||||||||||
| 639 | - | |||||||||||||
| 640 | \sa beginPaint(), paintDevice() | - | ||||||||||||
| 641 | */ | - | ||||||||||||
| 642 | - | |||||||||||||
| 643 | void QPlatformBackingStore::endPaint() | - | ||||||||||||
| 644 | { | - | ||||||||||||
| 645 | } | - | ||||||||||||
| 646 | - | |||||||||||||
| 647 | /*! | - | ||||||||||||
| 648 | Accessor for a backingstores graphics buffer abstraction | - | ||||||||||||
| 649 | */ | - | ||||||||||||
| 650 | QPlatformGraphicsBuffer *QPlatformBackingStore::graphicsBuffer() const | - | ||||||||||||
| 651 | { | - | ||||||||||||
| 652 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||||||||
| 653 | } | - | ||||||||||||
| 654 | - | |||||||||||||
| 655 | /*! | - | ||||||||||||
| 656 | Scrolls the given \a area \a dx pixels to the right and \a dy | - | ||||||||||||
| 657 | downward; both \a dx and \a dy may be negative. | - | ||||||||||||
| 658 | - | |||||||||||||
| 659 | Returns \c true if the area was scrolled successfully; false otherwise. | - | ||||||||||||
| 660 | */ | - | ||||||||||||
| 661 | bool QPlatformBackingStore::scroll(const QRegion &area, int dx, int dy) | - | ||||||||||||
| 662 | { | - | ||||||||||||
| 663 | Q_UNUSED(area); | - | ||||||||||||
| 664 | Q_UNUSED(dx); | - | ||||||||||||
| 665 | Q_UNUSED(dy); | - | ||||||||||||
| 666 | - | |||||||||||||
| 667 | return false; never executed: return false; | 0 | ||||||||||||
| 668 | } | - | ||||||||||||
| 669 | - | |||||||||||||
| 670 | QT_END_NAMESPACE | - | ||||||||||||
| Source code | Switch to Preprocessed file |