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

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