summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moreau <oreaus@gmail.com>2012-01-03 15:26:01 -0700
committerScott Moreau <oreaus@gmail.com>2012-01-03 15:29:54 -0700
commit3c9ec4e6e01ce09463c8445b839fd368bbba34c4 (patch)
treed82ed2829e47a056353d662869d754b72cd463f7
parent88037507bde0840f4973c6ebb5b03aacc89ccb58 (diff)
downloadcore-master.tar.gz
core-master.tar.bz2
Cleanup.HEADmaster
-rw-r--r--plugins/opengl/src/paint.cpp154
1 files changed, 75 insertions, 79 deletions
diff --git a/plugins/opengl/src/paint.cpp b/plugins/opengl/src/paint.cpp
index 0c73b35..26c6d0a 100644
--- a/plugins/opengl/src/paint.cpp
+++ b/plugins/opengl/src/paint.cpp
@@ -75,125 +75,121 @@ PrivateGLScreen::paintBackground (const CompRegion &region,
if (screen->desktopWindowCount ())
{
- if (!backgroundTextures.empty ())
- {
- backgroundTextures.clear ();
- }
+ if (!backgroundTextures.empty ())
+ backgroundTextures.clear ();
- backgroundLoaded = false;
+ backgroundLoaded = false;
- return;
+ return;
}
else
{
- if (!backgroundLoaded)
- updateScreenBackground ();
+ if (!backgroundLoaded)
+ updateScreenBackground ();
- backgroundLoaded = true;
+ backgroundLoaded = true;
}
if (backgroundTextures.empty ())
{
+ data = new GLfloat [nBox * 8];
+ if (!data)
+ return;
- data = new GLfloat [nBox * 8];
- if (!data)
- return;
-
- d = data;
- n = nBox;
+ d = data;
+ n = nBox;
- while (n--)
- {
- *d++ = pBox->x1;
- *d++ = pBox->y2;
+ while (n--)
+ {
+ *d++ = pBox->x1;
+ *d++ = pBox->y2;
- *d++ = pBox->x2;
- *d++ = pBox->y2;
+ *d++ = pBox->x2;
+ *d++ = pBox->y2;
- *d++ = pBox->x2;
- *d++ = pBox->y1;
+ *d++ = pBox->x2;
+ *d++ = pBox->y1;
- *d++ = pBox->x1;
- *d++ = pBox->y1;
+ *d++ = pBox->x1;
+ *d++ = pBox->y1;
- pBox++;
- }
+ pBox++;
+ }
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 2, data);
+ glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 2, data);
- glColor4us (0, 0, 0, std::numeric_limits<unsigned short>::max ());
- glDrawArrays (GL_QUADS, 0, nBox * 4);
- glColor4usv (defaultColor);
+ glColor4us (0, 0, 0, std::numeric_limits<unsigned short>::max ());
+ glDrawArrays (GL_QUADS, 0, nBox * 4);
+ glColor4usv (defaultColor);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
else
{
+ data = new GLfloat [nBox * 16];
+ if (!data)
+ return;
- data = new GLfloat [nBox * 16];
- if (!data)
- return;
-
- d = data;
- n = nBox;
+ d = data;
+ n = nBox;
- for (unsigned int i = 0; i < backgroundTextures.size (); i++)
- {
- GLTexture *bg = backgroundTextures[i];
- CompRegion r = region & *bg;
+ for (unsigned int i = 0; i < backgroundTextures.size (); i++)
+ {
+ GLTexture *bg = backgroundTextures[i];
+ CompRegion r = region & *bg;
- pBox = const_cast <Region> (r.handle ())->rects;
- nBox = const_cast <Region> (r.handle ())->numRects;
- d = data;
- n = nBox;
+ pBox = const_cast <Region> (r.handle ())->rects;
+ nBox = const_cast <Region> (r.handle ())->numRects;
+ d = data;
+ n = nBox;
- while (n--)
- {
- *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
- *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
+ while (n--)
+ {
+ *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
+ *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
- *d++ = pBox->x1;
- *d++ = pBox->y2;
+ *d++ = pBox->x1;
+ *d++ = pBox->y2;
- *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
- *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
+ *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
+ *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y2);
- *d++ = pBox->x2;
- *d++ = pBox->y2;
+ *d++ = pBox->x2;
+ *d++ = pBox->y2;
- *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
- *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
+ *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x2);
+ *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
- *d++ = pBox->x2;
- *d++ = pBox->y1;
+ *d++ = pBox->x2;
+ *d++ = pBox->y1;
- *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
- *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
+ *d++ = COMP_TEX_COORD_X (bg->matrix (), pBox->x1);
+ *d++ = COMP_TEX_COORD_Y (bg->matrix (), pBox->y1);
- *d++ = pBox->x1;
- *d++ = pBox->y1;
+ *d++ = pBox->x1;
+ *d++ = pBox->y1;
- pBox++;
- }
+ pBox++;
+ }
- glTexCoordPointer (2, GL_FLOAT, sizeof (GLfloat) * 4, data);
- glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 4, data + 2);
+ glTexCoordPointer (2, GL_FLOAT, sizeof (GLfloat) * 4, data);
+ glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 4, data + 2);
- if (bg->name ())
- {
- if (transformed)
- bg->enable (GLTexture::Good);
- else
- bg->enable (GLTexture::Fast);
+ if (bg->name ())
+ {
+ if (transformed)
+ bg->enable (GLTexture::Good);
+ else
+ bg->enable (GLTexture::Fast);
- glDrawArrays (GL_QUADS, 0, nBox * 4);
+ glDrawArrays (GL_QUADS, 0, nBox * 4);
- bg->disable ();
- }
- }
+ bg->disable ();
+ }
+ }
}
delete [] data;