qrasterwindow.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qrasterwindow.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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 QtGui module 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 "qrasterwindow.h"-
35-
36#include <QtGui/private/qpaintdevicewindow_p.h>-
37-
38#include <QtGui/QBackingStore>-
39#include <QtGui/QPainter>-
40-
41QT_BEGIN_NAMESPACE-
42-
43/*!-
44 \class QRasterWindow-
45 \inmodule QtGui-
46 \since 5.4-
47 \brief QRasterWindow is a convenience class for using QPainter on a QWindow-
48-
49 QRasterWindow is a QWindow with a raster-based, non-OpenGL surface. On top of-
50 the functionality offered by QWindow, QRasterWindow adds a virtual-
51 paintEvent() function and the possibility to open a QPainter on itself. The-
52 underlying paint engine will be the raster one, meaning that all drawing will-
53 happen on the CPU. For performing accelerated, OpenGL-based drawing, use-
54 QOpenGLWindow instead.-
55-
56 Internally the class is thin wrapper for QWindow and QBackingStore-
57 and is very similar to the \l{Raster Window Example}{Raster Window-
58 Example} that uses these classes directly.-
59-
60 \sa QPaintDeviceWindow::paintEvent(), QPaintDeviceWindow::update()-
61*/-
62-
63class QRasterWindowPrivate : public QPaintDeviceWindowPrivate-
64{-
65 Q_DECLARE_PUBLIC(QRasterWindow)-
66public:-
67 void beginPaint(const QRegion &region) Q_DECL_OVERRIDE-
68 {-
69 Q_Q(QRasterWindow);-
70 if (backingstore->size() != q->size()) {
backingstore->...) != q->size()Description
TRUEnever evaluated
FALSEnever evaluated
0
71 backingstore->resize(q->size());-
72 markWindowAsDirty();-
73 }
never executed: end of block
0
74 backingstore->beginPaint(region);-
75 }
never executed: end of block
0
76-
77 void endPaint() Q_DECL_OVERRIDE-
78 {-
79 backingstore->endPaint();-
80 }
never executed: end of block
0
81-
82 void flush(const QRegion &region) Q_DECL_OVERRIDE-
83 {-
84 Q_Q(QRasterWindow);-
85 backingstore->flush(region, q);-
86 }
never executed: end of block
0
87-
88 QScopedPointer<QBackingStore> backingstore;-
89};-
90-
91/*!-
92 Constructs a new QRasterWindow with \a parent.-
93*/-
94QRasterWindow::QRasterWindow(QWindow *parent)-
95 : QPaintDeviceWindow(*(new QRasterWindowPrivate), parent)-
96{-
97 setSurfaceType(QSurface::RasterSurface);-
98 d_func()->backingstore.reset(new QBackingStore(this));-
99}
never executed: end of block
0
100-
101/*!-
102 \internal-
103*/-
104int QRasterWindow::metric(PaintDeviceMetric metric) const-
105{-
106 Q_D(const QRasterWindow);-
107-
108 switch (metric) {-
109 case PdmDepth:
never executed: case PdmDepth:
0
110 return d->backingstore->paintDevice()->depth();
never executed: return d->backingstore->paintDevice()->depth();
0
111 default:
never executed: default:
0
112 break;
never executed: break;
0
113 }-
114 return QPaintDeviceWindow::metric(metric);
never executed: return QPaintDeviceWindow::metric(metric);
0
115}-
116-
117/*!-
118 \internal-
119*/-
120QPaintDevice *QRasterWindow::redirected(QPoint *) const-
121{-
122 Q_D(const QRasterWindow);-
123 return d->backingstore->paintDevice();
never executed: return d->backingstore->paintDevice();
0
124}-
125-
126QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9