qopenglpixeltransferoptions.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/opengl/qopenglpixeltransferoptions.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).-
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 "qopenglpixeltransferoptions.h"-
35#include <QSharedData>-
36-
37QT_BEGIN_NAMESPACE-
38-
39/*!-
40 * \class QOpenGLPixelTransferOptions-
41 *-
42 * \brief The QOpenGLPixelTransferOptions class describes the pixel storage-
43 * modes that affect the unpacking of pixels during texture upload.-
44 */-
45-
46/*!-
47 * \fn QOpenGLPixelTransferOptions & QOpenGLPixelTransferOptions::operator=(QOpenGLPixelTransferOptions &&other)-
48 * \internal-
49 */-
50-
51/*!-
52 * \fn void QOpenGLPixelTransferOptions::swap(QOpenGLPixelTransferOptions &other)-
53 * \internal-
54 */-
55-
56class QOpenGLPixelTransferOptionsData : public QSharedData-
57{-
58public:-
59 QOpenGLPixelTransferOptionsData()-
60 : alignment(4)-
61 , skipImages(0)-
62 , skipRows(0)-
63 , skipPixels(0)-
64 , imageHeight(0)-
65 , rowLength(0)-
66 , lsbFirst(false)-
67 , swapBytes(false)-
68 {}
never executed: end of block
0
69-
70 int alignment;-
71 int skipImages;-
72 int skipRows;-
73 int skipPixels;-
74 int imageHeight;-
75 int rowLength;-
76 bool lsbFirst;-
77 bool swapBytes;-
78};-
79-
80/*!-
81 * Constructs a new QOpenGLPixelTransferOptions instance with the default settings.-
82 */-
83QOpenGLPixelTransferOptions::QOpenGLPixelTransferOptions()-
84 : data(new QOpenGLPixelTransferOptionsData)-
85{-
86}
never executed: end of block
0
87-
88/*!-
89 * \internal-
90 */-
91QOpenGLPixelTransferOptions::QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &rhs)-
92 : data(rhs.data)-
93{-
94}
never executed: end of block
0
95-
96/*!-
97 * \internal-
98 */-
99QOpenGLPixelTransferOptions &QOpenGLPixelTransferOptions::operator=(const QOpenGLPixelTransferOptions &rhs)-
100{-
101 if (this != &rhs)
this != &rhsDescription
TRUEnever evaluated
FALSEnever evaluated
0
102 data.operator=(rhs.data);
never executed: data.operator=(rhs.data);
0
103 return *this;
never executed: return *this;
0
104}-
105-
106/*!-
107 * Destructor.-
108 */-
109QOpenGLPixelTransferOptions::~QOpenGLPixelTransferOptions()-
110{-
111}-
112-
113/*!-
114 * Sets the \a alignment requirements for each pixel row. Corresponds to \c GL_UNPACK_ALIGNMENT.-
115 * The default value is 4, as specified by OpenGL.-
116 */-
117void QOpenGLPixelTransferOptions::setAlignment(int alignment)-
118{-
119 data->alignment = alignment;-
120}
never executed: end of block
0
121-
122/*!-
123 * \return the current alignment requirement for each pixel row.-
124 */-
125int QOpenGLPixelTransferOptions::alignment() const-
126{-
127 return data->alignment;
never executed: return data->alignment;
0
128}-
129-
130/*!-
131 * Sets the number of images that are skipped to \a skipImages.-
132 * Corresponds to \c GL_UNPACK_SKIP_IMAGES. Equivalent to incrementing the pointer-
133 * passed to QOpenGLTexture::setData(). The default value is 0.-
134 */-
135void QOpenGLPixelTransferOptions::setSkipImages(int skipImages)-
136{-
137 data->skipImages = skipImages;-
138}
never executed: end of block
0
139-
140/*!-
141 * \return the number of images that are skipped.-
142 */-
143int QOpenGLPixelTransferOptions::skipImages() const-
144{-
145 return data->skipImages;
never executed: return data->skipImages;
0
146}-
147-
148/*!-
149 * Sets the number of rows that are skipped to \a skipRows.-
150 * Corresponds to \c GL_UNPACK_SKIP_ROWS. Equivalent to incrementing the pointer-
151 * passed to QOpenGLTexture::setData(). The default value is 0.-
152 */-
153void QOpenGLPixelTransferOptions::setSkipRows(int skipRows)-
154{-
155 data->skipRows = skipRows;-
156}
never executed: end of block
0
157-
158/*!-
159 * \return the number of rows that are skipped.-
160 */-
161int QOpenGLPixelTransferOptions::skipRows() const-
162{-
163 return data->skipRows;
never executed: return data->skipRows;
0
164}-
165-
166/*!-
167 * Sets the number of pixels that are skipped to \a skipPixels.-
168 * Corresponds to \c GL_UNPACK_SKIP_PIXELS. Equivalent to incrementing the pointer-
169 * passed to QOpenGLTexture::setData(). The default value is 0.-
170 */-
171void QOpenGLPixelTransferOptions::setSkipPixels(int skipPixels)-
172{-
173 data->skipPixels = skipPixels;-
174}
never executed: end of block
0
175-
176/*!-
177 * \return the number of pixels that are skipped.-
178 */-
179int QOpenGLPixelTransferOptions::skipPixels() const-
180{-
181 return data->skipPixels;
never executed: return data->skipPixels;
0
182}-
183-
184/*!-
185 * Sets the image height for 3D textures to \a imageHeight.-
186 * Corresponds to \c GL_UNPACK_IMAGE_HEIGHT.-
187 * The default value is 0.-
188 */-
189void QOpenGLPixelTransferOptions::setImageHeight(int imageHeight)-
190{-
191 data->imageHeight = imageHeight;-
192}
never executed: end of block
0
193-
194/*!-
195 * \return the currently set image height.-
196 */-
197int QOpenGLPixelTransferOptions::imageHeight() const-
198{-
199 return data->imageHeight;
never executed: return data->imageHeight;
0
200}-
201-
202/*!-
203 * Sets the number of pixels in a row to \a rowLength.-
204 * Corresponds to \c GL_UNPACK_ROW_LENGTH.-
205 * The default value is 0.-
206 */-
207void QOpenGLPixelTransferOptions::setRowLength(int rowLength)-
208{-
209 data->rowLength = rowLength;-
210}
never executed: end of block
0
211-
212/*!-
213 * \return the currently set row length.-
214 */-
215int QOpenGLPixelTransferOptions::rowLength() const-
216{-
217 return data->rowLength;
never executed: return data->rowLength;
0
218}-
219-
220/*!-
221 * \a lsbFirst specifies if bits within a byte are ordered from least to most significat.-
222 * The default value is \c false, meaning that the first bit in each byte is the-
223 * most significant one. This is significant for bitmap data only.-
224 * Corresponds to \c GL_UNPACK_LSB_FIRST.-
225 */-
226void QOpenGLPixelTransferOptions::setLeastSignificantByteFirst(bool lsbFirst)-
227{-
228 data->lsbFirst = lsbFirst;-
229}
never executed: end of block
0
230-
231/*!-
232 * \return \c true if bits within a byte are ordered from least to most significant.-
233 */-
234bool QOpenGLPixelTransferOptions::isLeastSignificantBitFirst() const-
235{-
236 return data->lsbFirst;
never executed: return data->lsbFirst;
0
237}-
238-
239/*!-
240 * \a swapBytes specifies if the byte ordering for multibyte components is reversed.-
241 * The default value is \c false.-
242 * Corresponds to \c GL_UNPACK_SWAP_BYTES.-
243 */-
244void QOpenGLPixelTransferOptions::setSwapBytesEnabled(bool swapBytes)-
245{-
246 data->swapBytes = swapBytes;-
247}
never executed: end of block
0
248-
249/*!-
250 * \return \c true if the byte ordering for multibyte components is reversed.-
251 */-
252bool QOpenGLPixelTransferOptions::isSwapBytesEnabled() const-
253{-
254 return data->swapBytes;
never executed: return data->swapBytes;
0
255}-
256-
257QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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