Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/fbconvenience/qfbbackingstore.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the plugins of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
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 http://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at http://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 2.1 or version 3 as published by the Free | - | ||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
25 | ** | - | ||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
29 | ** | - | ||||||
30 | ** $QT_END_LICENSE$ | - | ||||||
31 | ** | - | ||||||
32 | ****************************************************************************/ | - | ||||||
33 | - | |||||||
34 | #include "qfbbackingstore_p.h" | - | ||||||
35 | #include "qfbwindow_p.h" | - | ||||||
36 | #include "qfbscreen_p.h" | - | ||||||
37 | - | |||||||
38 | #include <qpa/qplatformwindow.h> | - | ||||||
39 | #include <QtGui/qscreen.h> | - | ||||||
40 | #include <QtGui/qpainter.h> | - | ||||||
41 | - | |||||||
42 | QT_BEGIN_NAMESPACE | - | ||||||
43 | - | |||||||
44 | QFbBackingStore::QFbBackingStore(QWindow *window) | - | ||||||
45 | : QPlatformBackingStore(window) | - | ||||||
46 | { | - | ||||||
47 | if (window->handle())
| 0 | ||||||
48 | (static_cast<QFbWindow *>(window->handle()))->setBackingStore(this); never executed: (static_cast<QFbWindow *>(window->handle()))->setBackingStore(this); | 0 | ||||||
49 | else | - | ||||||
50 | (static_cast<QFbScreen *>(window->screen()->handle()))->addPendingBackingStore(this); never executed: (static_cast<QFbScreen *>(window->screen()->handle()))->addPendingBackingStore(this); | 0 | ||||||
51 | } | - | ||||||
52 | - | |||||||
53 | QFbBackingStore::~QFbBackingStore() | - | ||||||
54 | { | - | ||||||
55 | } | - | ||||||
56 | - | |||||||
57 | void QFbBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) | - | ||||||
58 | { | - | ||||||
59 | Q_UNUSED(window); | - | ||||||
60 | Q_UNUSED(offset); | - | ||||||
61 | - | |||||||
62 | (static_cast<QFbWindow *>(window->handle()))->repaint(region); | - | ||||||
63 | } never executed: end of block | 0 | ||||||
64 | - | |||||||
65 | void QFbBackingStore::resize(const QSize &size, const QRegion &staticContents) | - | ||||||
66 | { | - | ||||||
67 | Q_UNUSED(staticContents); | - | ||||||
68 | - | |||||||
69 | if (mImage.size() != size)
| 0 | ||||||
70 | mImage = QImage(size, window()->screen()->handle()->format()); never executed: mImage = QImage(size, window()->screen()->handle()->format()); | 0 | ||||||
71 | } never executed: end of block | 0 | ||||||
72 | - | |||||||
73 | const QImage QFbBackingStore::image() | - | ||||||
74 | { | - | ||||||
75 | return mImage; never executed: return mImage; | 0 | ||||||
76 | } | - | ||||||
77 | - | |||||||
78 | void QFbBackingStore::lock() | - | ||||||
79 | { | - | ||||||
80 | mImageMutex.lock(); | - | ||||||
81 | } never executed: end of block | 0 | ||||||
82 | - | |||||||
83 | void QFbBackingStore::unlock() | - | ||||||
84 | { | - | ||||||
85 | mImageMutex.unlock(); | - | ||||||
86 | } never executed: end of block | 0 | ||||||
87 | - | |||||||
88 | void QFbBackingStore::beginPaint(const QRegion ®ion) | - | ||||||
89 | { | - | ||||||
90 | lock(); | - | ||||||
91 | - | |||||||
92 | if (mImage.hasAlphaChannel()) {
| 0 | ||||||
93 | QPainter p(&mImage); | - | ||||||
94 | p.setCompositionMode(QPainter::CompositionMode_Source); | - | ||||||
95 | const QVector<QRect> rects = region.rects(); | - | ||||||
96 | for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it)
| 0 | ||||||
97 | p.fillRect(*it, Qt::transparent); never executed: p.fillRect(*it, Qt::transparent); | 0 | ||||||
98 | } never executed: end of block | 0 | ||||||
99 | } never executed: end of block | 0 | ||||||
100 | - | |||||||
101 | void QFbBackingStore::endPaint() | - | ||||||
102 | { | - | ||||||
103 | unlock(); | - | ||||||
104 | } never executed: end of block | 0 | ||||||
105 | - | |||||||
106 | QT_END_NAMESPACE | - | ||||||
107 | - | |||||||
Source code | Switch to Preprocessed file |