OpenCoverage

qsgtexture.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgtexture.h
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 QtQuick 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#ifndef QSGTEXTURE_H-
41#define QSGTEXTURE_H-
42-
43#include <QtQuick/qtquickglobal.h>-
44#include <QtCore/QObject>-
45#include <QtGui/QImage>-
46-
47QT_BEGIN_NAMESPACE-
48-
49class QSGTexturePrivate;-
50class Q_QUICK_EXPORT QSGTexture : public QObject-
51{-
52 Q_OBJECT-
53 Q_DECLARE_PRIVATE(QSGTexture)
executed 135549 times by 37 tests: return reinterpret_cast<QSGTexturePrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickframebufferobject
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickpainteditem
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpointattractor
  • ...
executed 9589 times by 35 tests: return reinterpret_cast<const QSGTexturePrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickframebufferobject
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickpainteditem
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • ...
9589-135549
54-
55public:-
56 QSGTexture();-
57 ~QSGTexture() override;-
58-
59 enum WrapMode {-
60 Repeat,-
61 ClampToEdge,-
62 MirroredRepeat-
63 };-
64-
65 enum Filtering {-
66 None,-
67 Nearest,-
68 Linear-
69 };-
70-
71 enum AnisotropyLevel {-
72 AnisotropyNone,-
73 Anisotropy2x,-
74 Anisotropy4x,-
75 Anisotropy8x,-
76 Anisotropy16x-
77 };-
78-
79 virtual int textureId() const = 0;-
80 virtual QSize textureSize() const = 0;-
81 virtual bool hasAlphaChannel() const = 0;-
82 virtual bool hasMipmaps() const = 0;-
83-
84 virtual QRectF normalizedTextureSubRect() const;-
85-
86 virtual bool isAtlasTexture() const;-
87-
88 virtual QSGTexture *removedFromAtlas() const;-
89-
90 virtual void bind() = 0;-
91 void updateBindOptions(bool force = false);-
92-
93 void setMipmapFiltering(Filtering filter);-
94 QSGTexture::Filtering mipmapFiltering() const;-
95-
96 void setFiltering(Filtering filter);-
97 QSGTexture::Filtering filtering() const;-
98-
99 void setAnisotropyLevel(AnisotropyLevel level);-
100 QSGTexture::AnisotropyLevel anisotropyLevel() const;-
101-
102 void setHorizontalWrapMode(WrapMode hwrap);-
103 QSGTexture::WrapMode horizontalWrapMode() const;-
104-
105 void setVerticalWrapMode(WrapMode vwrap);-
106 QSGTexture::WrapMode verticalWrapMode() const;-
107-
108 inline QRectF convertToNormalizedSourceRect(const QRectF &rect) const;-
109-
110protected:-
111 QSGTexture(QSGTexturePrivate &dd);-
112};-
113-
114QRectF QSGTexture::convertToNormalizedSourceRect(const QRectF &rect) const-
115{-
116 QSize s = textureSize();-
117 QRectF r = normalizedTextureSubRect();-
118-
119 qreal sx = r.width() / s.width();-
120 qreal sy = r.height() / s.height();-
121-
122 return QRectF(r.x() + rect.x() * sx,
executed 56 times by 2 tests: return QRectF(r.x() + rect.x() * sx, r.y() + rect.y() * sy, rect.width() * sx, rect.height() * sy);
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
56
123 r.y() + rect.y() * sy,
executed 56 times by 2 tests: return QRectF(r.x() + rect.x() * sx, r.y() + rect.y() * sy, rect.width() * sx, rect.height() * sy);
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
56
124 rect.width() * sx,
executed 56 times by 2 tests: return QRectF(r.x() + rect.x() * sx, r.y() + rect.y() * sy, rect.width() * sx, rect.height() * sy);
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
56
125 rect.height() * sy);
executed 56 times by 2 tests: return QRectF(r.x() + rect.x() * sx, r.y() + rect.y() * sy, rect.width() * sx, rect.height() * sy);
Executed by:
  • tst_nodestest
  • tst_qquickframebufferobject
56
126}-
127-
128-
129class Q_QUICK_EXPORT QSGDynamicTexture : public QSGTexture-
130{-
131 Q_OBJECT-
132public:-
133 virtual bool updateTexture() = 0;-
134};-
135-
136QT_END_NAMESPACE-
137-
138#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0