]> git.cworth.org Git - apitrace/blob - gui/apisurface.cpp
Don't read all json output to memory.
[apitrace] / gui / apisurface.cpp
1 #include "apisurface.h"
2
3 #include <QDebug>
4 #include <QSysInfo>
5
6 ApiSurface::ApiSurface()
7 {
8 }
9
10 QSize ApiSurface::size() const
11 {
12     return m_size;
13 }
14
15 void ApiSurface::setSize(const QSize &size)
16 {
17     m_size = size;
18 }
19
20 int ApiSurface::numChannels() const
21 {
22     return m_numChannels;
23 }
24
25 void ApiSurface::setNumChannels(int numChannels)
26 {
27     m_numChannels = numChannels;
28 }
29
30 void ApiSurface::contentsFromBase64(const QByteArray &base64)
31 {
32     QByteArray dataArray = QByteArray::fromBase64(base64);
33     m_image.loadFromData(dataArray, "png");
34     m_thumb = m_image.scaled(64, 64, Qt::KeepAspectRatio);
35 }
36
37 QImage ApiSurface::image() const
38 {
39     return m_image;
40 }
41
42 QImage ApiSurface::thumb() const
43 {
44     return m_thumb;
45 }
46
47 int ApiSurface::depth() const
48 {
49     return m_depth;
50 }
51
52 void ApiSurface::setDepth(int depth)
53 {
54     m_depth = depth;
55 }
56
57 QString ApiSurface::formatName() const
58 {
59     return m_formatName;
60 }
61
62 void ApiSurface::setFormatName(const QString &str)
63 {
64     m_formatName = str;
65 }
66
67
68 ApiTexture::ApiTexture()
69     : ApiSurface()
70 {
71 }
72
73 QString ApiTexture::label() const
74 {
75     return m_label;
76 }
77
78 void ApiTexture::setLabel(const QString &str)
79 {
80     m_label = str;
81 }
82
83 ApiFramebuffer::ApiFramebuffer()
84     : ApiSurface()
85 {
86 }
87
88 QString ApiFramebuffer::type() const
89 {
90     return m_type;
91 }
92
93 void ApiFramebuffer::setType(const QString &str)
94 {
95     m_type = str;
96 }
97