blob: 856ceaf06a84a4cde3a7993a64eb3c86cfa438c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include <compicon.h>
CompIcon::CompIcon (CompScreen *screen, unsigned int width,
unsigned int height) :
mTexture (screen),
mWidth (width),
mHeight (height),
mData (new unsigned char[width * height * 4]),
mUpdateTex (true)
{
}
CompIcon::~CompIcon ()
{
free (mData);
}
CompTexture &
CompIcon::texture ()
{
if (mUpdateTex)
{
mUpdateTex = false;
mTexture.reset ();
if (!mTexture.imageBufferToTexture (&mTexture,
reinterpret_cast<const char *> (mData), mWidth, mHeight))
mTexture.reset ();
}
return mTexture;
}
unsigned int
CompIcon::width ()
{
return mWidth;
}
unsigned int
CompIcon::height ()
{
return mHeight;
}
unsigned char*
CompIcon::data ()
{
mUpdateTex = true;
return mData;
}
|