qsurface.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qsurface.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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 "qsurface.h"-
41#include "qopenglcontext.h"-
42-
43QT_BEGIN_NAMESPACE-
44-
45-
46/*!-
47 \class QSurface-
48 \inmodule QtGui-
49 \since 5.0-
50 \brief The QSurface class is an abstraction of renderable surfaces in Qt.-
51-
52 The size of the surface is accessible with the size() function. The rendering-
53 specific attributes of the surface are accessible through the format() function.-
54 */-
55-
56-
57/*!-
58 \enum QSurface::SurfaceClass-
59-
60 The SurfaceClass enum describes the actual subclass of the surface.-
61-
62 \value Window The surface is an instance of QWindow.-
63 \value Offscreen The surface is an instance of QOffscreenSurface.-
64 */-
65-
66-
67/*!-
68 \enum QSurface::SurfaceType-
69-
70 The SurfaceType enum describes what type of surface this is.-
71-
72 \value RasterSurface The surface is is composed of pixels and can be rendered to using-
73 a software rasterizer like Qt's raster paint engine.-
74 \value OpenGLSurface The surface is an OpenGL compatible surface and can be used-
75 in conjunction with QOpenGLContext.-
76 \value RasterGLSurface The surface can be rendered to using a software rasterizer,-
77 and also supports OpenGL. This surface type is intended for internal Qt use, and-
78 requires the use of private API.-
79 */-
80-
81-
82/*!-
83 \fn QSurfaceFormat QSurface::format() const-
84-
85 Returns the format of the surface.-
86 */-
87-
88/*!-
89 Returns true if the surface is OpenGL compatible and can be used in-
90 conjunction with QOpenGLContext; otherwise returns false.-
91-
92 \since 5.3-
93*/-
94-
95bool QSurface::supportsOpenGL() const-
96{-
97 SurfaceType type = surfaceType();-
98 return type == OpenGLSurface || type == RasterGLSurface;
never executed: return type == OpenGLSurface || type == RasterGLSurface;
0
99}-
100-
101/*!-
102 \fn QPlatformSurface *QSurface::surfaceHandle() const-
103-
104 Returns a handle to the platform-specific implementation of the surface.-
105 */-
106-
107/*!-
108 \fn SurfaceType QSurface::surfaceType() const-
109-
110 Returns the type of the surface.-
111 */-
112-
113/*!-
114 \fn QSize QSurface::size() const-
115-
116 Returns the size of the surface in pixels.-
117 */-
118-
119/*!-
120 Creates a surface with the given \a type.-
121*/-
122QSurface::QSurface(SurfaceClass type)-
123 : m_type(type), m_reserved(0)-
124{-
125}
never executed: end of block
0
126-
127/*!-
128 Destroys the surface.-
129*/-
130QSurface::~QSurface()-
131{-
132#ifndef QT_NO_OPENGL-
133 QOpenGLContext *context = QOpenGLContext::currentContext();-
134 if (context && context->surface() == this)
contextDescription
TRUEnever evaluated
FALSEnever evaluated
context->surface() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
0
135 context->doneCurrent();
never executed: context->doneCurrent();
0
136#endif-
137}
never executed: end of block
0
138-
139/*!-
140 Returns the surface class of this surface.-
141 */-
142QSurface::SurfaceClass QSurface::surfaceClass() const-
143{-
144 return m_type;
never executed: return m_type;
0
145}-
146-
147QT_END_NAMESPACE-
148-
Source codeSwitch to Preprocessed file

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