1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "labelitem_p.h"
5
6QT_BEGIN_NAMESPACE
7
8LabelItem::LabelItem()
9 : m_size(QSize(0, 0)),
10 m_textureId(0)
11{
12}
13
14LabelItem::~LabelItem()
15{
16 clear();
17}
18
19void LabelItem::setSize(const QSize &size)
20{
21 m_size = size;
22}
23
24QSize LabelItem::size() const
25{
26 return m_size;
27}
28
29void LabelItem::setTextureId(GLuint textureId)
30{
31 QOpenGLContext::currentContext()->functions()->glDeleteTextures(n: 1, textures: &m_textureId);
32 m_textureId = textureId;
33}
34
35GLuint LabelItem::textureId() const
36{
37 return m_textureId;
38}
39
40void LabelItem::clear()
41{
42 if (m_textureId && QOpenGLContext::currentContext())
43 QOpenGLContext::currentContext()->functions()->glDeleteTextures(n: 1, textures: &m_textureId);
44 m_textureId = 0;
45 m_size = QSize(0, 0);
46}
47
48QT_END_NAMESPACE
49

source code of qtdatavis3d/src/datavisualization/data/labelitem.cpp