summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2008-10-14 16:57:49 +0200
committerDennis Kasprzyk <onestone@compiz-fusion.org>2008-10-14 16:57:49 +0200
commit43c133cfe495ac03683adb52cf77ed679be7b5e6 (patch)
tree6f24bfdfb8cc63fc1be333d4a6b02f1c52987ac9
parentbb612a76f62e4ecfef9d90fa7d98c39b0e6c3766 (diff)
downloadunity-window-decorator-43c133cfe495ac03683adb52cf77ed679be7b5e6.tar.gz
unity-window-decorator-43c133cfe495ac03683adb52cf77ed679be7b5e6.tar.bz2
Made CompIcon derive from CompSize.
-rw-r--r--include/core/icon.h3
-rw-r--r--plugins/opengl/screen.cpp5
-rw-r--r--plugins/opengl/window.cpp6
-rw-r--r--src/icon.cpp8
-rw-r--r--src/window.cpp4
5 files changed, 8 insertions, 18 deletions
diff --git a/include/core/icon.h b/include/core/icon.h
index ba3ad38..c0b9027 100644
--- a/include/core/icon.h
+++ b/include/core/icon.h
@@ -32,12 +32,11 @@
class CompScreen;
-class CompIcon {
+class CompIcon : public CompSize {
public:
CompIcon (CompScreen *screen, unsigned width, unsigned int height);
~CompIcon ();
- const CompSize & size () const;
unsigned char* data ();
private:
diff --git a/plugins/opengl/screen.cpp b/plugins/opengl/screen.cpp
index 9fbb5a6..55cf608 100644
--- a/plugins/opengl/screen.cpp
+++ b/plugins/opengl/screen.cpp
@@ -1161,15 +1161,14 @@ GLScreen::defaultIcon ()
if (!i)
return NULL;
- size = i->size ();
- if (!size.width () || !size.height ())
+ if (!i->width () || !i->height ())
return NULL;
if (priv->defaultIcon.icon == i)
return priv->defaultIcon.textures[0];
priv->defaultIcon.textures =
- GLTexture::imageBufferToTexture ((char *) i->data (), size);
+ GLTexture::imageBufferToTexture ((char *) i->data (), *i);
if (priv->defaultIcon.textures.size () == 1)
priv->defaultIcon.icon = i;
diff --git a/plugins/opengl/window.cpp b/plugins/opengl/window.cpp
index b08d73d..3748f49 100644
--- a/plugins/opengl/window.cpp
+++ b/plugins/opengl/window.cpp
@@ -323,13 +323,11 @@ GLWindow::getIcon (int width, int height)
{
GLIcon icon;
CompIcon *i = priv->window->getIcon (width, height);
- CompSize size;
if (!i)
return NULL;
- size = i->size ();
- if (!size.width () || !size.height ())
+ if (!i->width () || !i->height ())
return NULL;
foreach (GLIcon &icon, priv->icons)
@@ -337,7 +335,7 @@ GLWindow::getIcon (int width, int height)
return icon.textures[0];
icon.icon = i;
- icon.textures = GLTexture::imageBufferToTexture ((char *) i->data (), size);
+ icon.textures = GLTexture::imageBufferToTexture ((char *) i->data (), *i);
if (icon.textures.size () > 1 || icon.textures.size () == 0)
return NULL;
diff --git a/src/icon.cpp b/src/icon.cpp
index aa17e35..0a8146b 100644
--- a/src/icon.cpp
+++ b/src/icon.cpp
@@ -29,7 +29,7 @@
CompIcon::CompIcon (CompScreen *screen, unsigned int width,
unsigned int height) :
- mSize (width, height),
+ CompSize (width, height),
mData (new unsigned char[width * height * 4])
{
}
@@ -39,12 +39,6 @@ CompIcon::~CompIcon ()
delete mData;
}
-const CompSize &
-CompIcon::size () const
-{
- return mSize;
-}
-
unsigned char*
CompIcon::data ()
{
diff --git a/src/window.cpp b/src/window.cpp
index 2437a6e..b890250 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -3714,7 +3714,7 @@ CompWindow::getIcon (int width, int height)
for (i = 0; i < priv->icons.size (); i++)
{
- const CompSize &iconSize = priv->icons[i]->size ();
+ const CompSize iconSize = *priv->icons[i];
if ((int) iconSize.width () > width ||
(int) iconSize.height () > height)
@@ -3723,7 +3723,7 @@ CompWindow::getIcon (int width, int height)
if (icon)
{
diff = wh - (iconSize.width () + iconSize.height ());
- oldDiff = wh - (icon->size ().width () + icon->size ().height ());
+ oldDiff = wh - (icon->width () + icon->height ());
if (diff < oldDiff)
icon = priv->icons[i];