1 | // Copyright (C) 2020 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qssgrendertexturedata_p.h" |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | QSSGRenderTextureData::QSSGRenderTextureData() |
9 | : QSSGRenderGraphObject(QSSGRenderGraphObject::Type::TextureData) |
10 | { |
11 | |
12 | } |
13 | |
14 | QSSGRenderTextureData::QSSGRenderTextureData(QSSGRenderGraphObject::Type type) |
15 | : QSSGRenderGraphObject(type) |
16 | { |
17 | |
18 | } |
19 | |
20 | QSSGRenderTextureData::~QSSGRenderTextureData() |
21 | { |
22 | |
23 | } |
24 | |
25 | const QByteArray &QSSGRenderTextureData::textureData() const |
26 | { |
27 | return m_textureData; |
28 | } |
29 | |
30 | void QSSGRenderTextureData::setTextureData(const QByteArray &data) |
31 | { |
32 | m_textureData = data; |
33 | markDirty(); |
34 | } |
35 | |
36 | QSize QSSGRenderTextureData::size() const |
37 | { |
38 | return m_size; |
39 | } |
40 | |
41 | void QSSGRenderTextureData::setSize(const QSize &size) |
42 | { |
43 | if (m_size == size) |
44 | return; |
45 | m_size = size; |
46 | markDirty(); |
47 | } |
48 | |
49 | int QSSGRenderTextureData::depth() const |
50 | { |
51 | return m_depth; |
52 | } |
53 | |
54 | void QSSGRenderTextureData::setDepth(int depth) |
55 | { |
56 | if (m_depth == depth) |
57 | return; |
58 | m_depth = depth; |
59 | markDirty(); |
60 | } |
61 | |
62 | QSSGRenderTextureFormat QSSGRenderTextureData::format() const |
63 | { |
64 | return m_format; |
65 | } |
66 | |
67 | void QSSGRenderTextureData::setFormat(QSSGRenderTextureFormat format) |
68 | { |
69 | if (m_format == format) |
70 | return; |
71 | |
72 | m_format = format; |
73 | markDirty(); |
74 | } |
75 | |
76 | bool QSSGRenderTextureData::hasTransparancy() const |
77 | { |
78 | return m_hasTransparency; |
79 | } |
80 | |
81 | void QSSGRenderTextureData::setHasTransparency(bool hasTransparency) |
82 | { |
83 | if (m_hasTransparency == hasTransparency) |
84 | return; |
85 | |
86 | m_hasTransparency = hasTransparency; |
87 | markDirty(); |
88 | } |
89 | |
90 | uint32_t QSSGRenderTextureData::generationId() const |
91 | { |
92 | return m_generationId; |
93 | } |
94 | |
95 | void QSSGRenderTextureData::markDirty() |
96 | { |
97 | // The generation ID changes every time a property of this texture |
98 | // changes so that the buffer manager can compare the generation it |
99 | // holds vs the current generation. |
100 | m_generationId++; |
101 | } |
102 | |
103 | QT_END_NAMESPACE |
104 |