Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.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 QtQuick 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 "qsgsoftwarepixmaprenderer_p.h" | - | ||||||||||||
41 | #include "qsgsoftwarecontext_p.h" | - | ||||||||||||
42 | - | |||||||||||||
43 | #include <QtQuick/QSGSimpleRectNode> | - | ||||||||||||
44 | - | |||||||||||||
45 | #include <QElapsedTimer> | - | ||||||||||||
46 | - | |||||||||||||
47 | Q_LOGGING_CATEGORY(lcPixmapRenderer, "qt.scenegraph.softwarecontext.pixmapRenderer") never executed: return category; | 0 | ||||||||||||
48 | - | |||||||||||||
49 | QT_BEGIN_NAMESPACE | - | ||||||||||||
50 | - | |||||||||||||
51 | QSGSoftwarePixmapRenderer::QSGSoftwarePixmapRenderer(QSGRenderContext *context) | - | ||||||||||||
52 | : QSGAbstractSoftwareRenderer(context) | - | ||||||||||||
53 | { | - | ||||||||||||
54 | - | |||||||||||||
55 | } never executed: end of block | 0 | ||||||||||||
56 | - | |||||||||||||
57 | QSGSoftwarePixmapRenderer::~QSGSoftwarePixmapRenderer() | - | ||||||||||||
58 | { | - | ||||||||||||
59 | - | |||||||||||||
60 | } | - | ||||||||||||
61 | - | |||||||||||||
62 | void QSGSoftwarePixmapRenderer::renderScene(uint) | - | ||||||||||||
63 | { | - | ||||||||||||
64 | class B : public QSGBindable | - | ||||||||||||
65 | { | - | ||||||||||||
66 | public: | - | ||||||||||||
67 | void bind() const override { } | - | ||||||||||||
68 | } bindable; | - | ||||||||||||
69 | QSGRenderer::renderScene(bindable); | - | ||||||||||||
70 | } never executed: end of block | 0 | ||||||||||||
71 | - | |||||||||||||
72 | void QSGSoftwarePixmapRenderer::render() | - | ||||||||||||
73 | { | - | ||||||||||||
74 | - | |||||||||||||
75 | } | - | ||||||||||||
76 | - | |||||||||||||
77 | void QSGSoftwarePixmapRenderer::render(QPaintDevice *target) | - | ||||||||||||
78 | { | - | ||||||||||||
79 | QElapsedTimer renderTimer; | - | ||||||||||||
80 | - | |||||||||||||
81 | // Setup background item | - | ||||||||||||
82 | setBackgroundRect(m_projectionRect.normalized()); | - | ||||||||||||
83 | setBackgroundColor(clearColor()); | - | ||||||||||||
84 | - | |||||||||||||
85 | renderTimer.start(); | - | ||||||||||||
86 | buildRenderList(); | - | ||||||||||||
87 | qint64 buildRenderListTime = renderTimer.restart(); | - | ||||||||||||
88 | - | |||||||||||||
89 | // Optimize Renderlist | - | ||||||||||||
90 | // Right now there is an assumption that when possible the same pixmap will | - | ||||||||||||
91 | // be reused. So we can treat it like a backing store in that we can assume | - | ||||||||||||
92 | // that when the pixmap is not being resized, the data can be reused. What is | - | ||||||||||||
93 | // different though is that everything should be marked as dirty on a resize. | - | ||||||||||||
94 | optimizeRenderList(); | - | ||||||||||||
95 | qint64 optimizeRenderListTime = renderTimer.restart(); | - | ||||||||||||
96 | - | |||||||||||||
97 | if (!isOpaque() && target->devType() == QInternal::Pixmap) {
| 0 | ||||||||||||
98 | // This fill here is wasteful, but necessary because it is the only way | - | ||||||||||||
99 | // to force a QImage based pixmap to have an alpha channel. | - | ||||||||||||
100 | static_cast<QPixmap *>(target)->fill(Qt::transparent); | - | ||||||||||||
101 | } never executed: end of block | 0 | ||||||||||||
102 | - | |||||||||||||
103 | QPainter painter(target); | - | ||||||||||||
104 | painter.setRenderHint(QPainter::Antialiasing); | - | ||||||||||||
105 | painter.setWindow(m_projectionRect); | - | ||||||||||||
106 | auto rc = static_cast<QSGSoftwareRenderContext *>(context()); | - | ||||||||||||
107 | QPainter *prevPainter = rc->m_activePainter; | - | ||||||||||||
108 | rc->m_activePainter = &painter; | - | ||||||||||||
109 | - | |||||||||||||
110 | QRegion paintedRegion = renderNodes(&painter); | - | ||||||||||||
111 | qint64 renderTime = renderTimer.elapsed(); | - | ||||||||||||
112 | - | |||||||||||||
113 | rc->m_activePainter = prevPainter; | - | ||||||||||||
114 | qCDebug(lcPixmapRenderer) << "pixmapRender" << paintedRegion << buildRenderListTime << optimizeRenderListTime << renderTime; never executed: QMessageLogger(__FILE__, 114, __PRETTY_FUNCTION__, lcPixmapRenderer().categoryName()).debug() << "pixmapRender" << paintedRegion << buildRenderListTime << optimizeRenderListTime << renderTime;
| 0 | ||||||||||||
115 | } never executed: end of block | 0 | ||||||||||||
116 | - | |||||||||||||
117 | void QSGSoftwarePixmapRenderer::setProjectionRect(const QRect &projectionRect) | - | ||||||||||||
118 | { | - | ||||||||||||
119 | m_projectionRect = projectionRect; | - | ||||||||||||
120 | } never executed: end of block | 0 | ||||||||||||
121 | - | |||||||||||||
122 | QT_END_NAMESPACE | - | ||||||||||||
Source code | Switch to Preprocessed file |