summaryrefslogtreecommitdiff
path: root/plugins/unitydialog
diff options
authorSam Spilsbury <sam.spilsbury@canonical.com>2012-08-30 16:06:38 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2012-08-30 16:06:38 +0800
commitae133514ba0e60dc8170211d50129b90f77a76de (patch)
tree83c861bdc2007218f3aad1be0052ebf64e7f39ba /plugins/unitydialog
parenta011109f609567c48ef3c54f04f3d22f544da004 (diff)
Remove usage of USE_MODERN_COMPIZ_GL bump the compiz dep
(bzr r2637.6.1)
Diffstat (limited to 'plugins/unitydialog')
-rw-r--r--plugins/unitydialog/src/unitydialog.cpp131
-rw-r--r--plugins/unitydialog/src/unitydialog.h20
2 files changed, 28 insertions, 123 deletions
diff --git a/plugins/unitydialog/src/unitydialog.cpp b/plugins/unitydialog/src/unitydialog.cpp
index 91f7f235e..3951b65f7 100644
--- a/plugins/unitydialog/src/unitydialog.cpp
+++ b/plugins/unitydialog/src/unitydialog.cpp
@@ -420,12 +420,8 @@ UnityDialogWindow::glAddGeometry(const GLTexture::MatrixList& matrices,
/* Collect textures */
void
UnityDialogWindow::glDrawTexture(GLTexture* texture,
-#ifdef USE_MODERN_COMPIZ_GL
const GLMatrix &transform,
const GLWindowPaintAttrib &attrib,
-#else
- GLFragment::Attrib& fa,
-#endif
unsigned int mask)
{
unity::PaintInfoCollector::Active ()->processTexture (texture);
@@ -448,16 +444,12 @@ unity::GeometryCollection::status ()
collectedMinVertices.size () == collectedMatrixLists.size ());
}
-void
+bool
unity::GeometryCollection::addGeometryForWindow (CompWindow *w, const CompRegion &paintRegion)
{
/* We can reset the window geometry since it will be
* re-added later */
-#ifdef USE_MODERN_COMPIZ_GL
GLWindow::get (w)->vertexBuffer()->begin();
-#else
- GLWindow::get (w)->geometry().reset();
-#endif
for (unsigned int i = 0; i < collectedMatrixLists.size (); i++)
{
@@ -472,9 +464,7 @@ unity::GeometryCollection::addGeometryForWindow (CompWindow *w, const CompRegion
GLWindow::get (w)->glAddGeometry(matl, reg, paintRegion, min, max);
}
-#ifdef USE_MODERN_COMPIZ_GL
- GLWindow::get (w)->vertexBuffer()->end();
-#endif
+ return GLWindow::get (w)->vertexBuffer()->end();
}
void
@@ -511,9 +501,7 @@ unity::TexGeometryCollection::setTexture (GLTexture *tex)
void
unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w,
-#ifdef USE_MODERN_COMPIZ_GL
const GLMatrix &transform,
-#endif
unsigned int mask)
{
if (mTexture && mGeometries.status ())
@@ -524,47 +512,25 @@ unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w
if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
paintRegion = infiniteRegion;
- mGeometries.addGeometryForWindow (w, paintRegion);
-
-#ifdef USE_MODERN_COMPIZ_GL
- UnityDialogScreen *uds = UnityDialogScreen::get (screen);
- GLWindowPaintAttrib attrib (gWindow->lastPaintAttrib());
- unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
- /* Texture rendering set-up */
-// uds->gScreen->setTexEnvMode(GL_MODULATE);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- /* Draw the dim texture with all of it's modified
- * geometry glory */
- gWindow->glDrawTextureSetCurrentIndex(MAXSHORT);
- gWindow->glDrawTexture(mTexture, transform, attrib, mask
- | PAINT_WINDOW_BLEND_MASK
- | PAINT_WINDOW_TRANSLUCENT_MASK
- | PAINT_WINDOW_TRANSFORMED_MASK);
- gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex);
- /* Texture rendering tear-down */
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- uds->gScreen->setTexEnvMode(GL_REPLACE);
-#else
- if (gWindow->geometry().vertices)
+ if (mGeometries.addGeometryForWindow (w, paintRegion))
{
- UnityDialogScreen *uds = UnityDialogScreen::get (screen);
- GLFragment::Attrib fa (gWindow->lastPaintAttrib());
- unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
- /* Texture rendering set-up */
- uds->gScreen->setTexEnvMode(GL_MODULATE);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- /* Draw the dim texture with all of it's modified
- * geometry glory */
- gWindow->glDrawTextureSetCurrentIndex(MAXSHORT);
- gWindow->glDrawTexture(mTexture, fa, mask | PAINT_WINDOW_BLEND_MASK
- | PAINT_WINDOW_TRANSLUCENT_MASK |
- PAINT_WINDOW_TRANSFORMED_MASK);
- gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex);
- /* Texture rendering tear-down */
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- uds->gScreen->setTexEnvMode(GL_REPLACE);
+ UnityDialogScreen *uds = UnityDialogScreen::get (screen);
+ GLWindowPaintAttrib attrib (gWindow->lastPaintAttrib());
+ unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
+ /* Texture rendering set-up */
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ /* Draw the dim texture with all of it's modified
+ * geometry glory */
+ gWindow->glDrawTextureSetCurrentIndex(MAXSHORT);
+ gWindow->glDrawTexture(mTexture, transform, attrib, mask
+ | PAINT_WINDOW_BLEND_MASK
+ | PAINT_WINDOW_TRANSLUCENT_MASK
+ | PAINT_WINDOW_TRANSFORMED_MASK);
+ gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex);
+ /* Texture rendering tear-down */
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ uds->gScreen->setTexEnvMode(GL_REPLACE);
}
-#endif
}
}
@@ -619,17 +585,11 @@ unity::PaintInfoCollector::processTexture (GLTexture *tex)
void
unity::PaintInfoCollector::drawGeometriesForWindow(CompWindow *w,
-#ifdef USE_MODERN_COMPIZ_GL
const GLMatrix &transform,
-#endif
unsigned int pm)
{
for (unity::TexGeometryCollection &tcg : mCollection)
-#if USE_MODERN_COMPIZ_GL
tcg.addGeometriesAndDrawTextureForWindow (w, transform, pm);
-#else
- tcg.addGeometriesAndDrawTextureForWindow (w, pm);
-#endif
}
unity::PaintInfoCollector * unity::PaintInfoCollector::active_collector = NULL;
@@ -644,11 +604,7 @@ unity::PaintInfoCollector::Active ()
bool
UnityDialogWindow::glDraw(const GLMatrix& transform,
-#ifdef USE_MODERN_COMPIZ_GL
const GLWindowPaintAttrib& attrib,
-#else
- GLFragment::Attrib& fragment,
-#endif
const CompRegion& region,
unsigned int mask)
{
@@ -660,11 +616,7 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
/* Draw the window on the bottom, we will be drawing the
* dim render on top */
bool status = gWindow->glDraw(transform,
-#ifdef USE_MODERN_COMPIZ_GL
attrib,
-#else
- fragment,
-#endif
region, mask);
UNITY_DIALOG_SCREEN(screen);
@@ -673,17 +625,11 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
{
GLTexture::MatrixList matl;
GLTexture::Matrix mat = tex->matrix();
-#ifdef USE_MODERN_COMPIZ_GL
GLWindowPaintAttrib wAttrib(attrib);
-#endif
/* We can reset the window geometry since it will be
* re-added later */
-#ifdef USE_MODERN_COMPIZ_GL
gWindow->vertexBuffer()->begin();
-#else
- gWindow->geometry().reset();
-#endif
/* Scale the dim render by the ratio of dim size
* to window size */
@@ -704,48 +650,25 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
* dim (so we get a nice render for things like
* wobbly etc etc */
gWindow->glAddGeometry(matl, reg, paintRegion);
-#ifdef USE_MODERN_COMPIZ_GL
- gWindow->vertexBuffer()->end();
-#endif
-
-#ifdef USE_MODERN_COMPIZ_GL
- unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
- wAttrib.opacity = mShadeProgress;
- /* Texture rendering set-up */
-// uds->gScreen->setTexEnvMode(GL_MODULATE);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- /* Draw the dim texture with all of it's modified
- * geometry glory */
- gWindow->glDrawTextureSetCurrentIndex(MAXSHORT);
- gWindow->glDrawTexture(tex, transform, attrib, mask
- | PAINT_WINDOW_BLEND_MASK
- | PAINT_WINDOW_TRANSLUCENT_MASK
- | PAINT_WINDOW_TRANSFORMED_MASK);
- gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex);
- /* Texture rendering tear-down */
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- uds->gScreen->setTexEnvMode(GL_REPLACE);
-#else
- /* Did it succeed? */
- if (gWindow->geometry().vertices)
+ if (gWindow->vertexBuffer()->end())
{
unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
- fragment.setOpacity(mShadeProgress);
+ wAttrib.opacity = mShadeProgress;
/* Texture rendering set-up */
- uds->gScreen->setTexEnvMode(GL_MODULATE);
+ // uds->gScreen->setTexEnvMode(GL_MODULATE);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
/* Draw the dim texture with all of it's modified
* geometry glory */
gWindow->glDrawTextureSetCurrentIndex(MAXSHORT);
- gWindow->glDrawTexture(tex, fragment, mask | PAINT_WINDOW_BLEND_MASK
- | PAINT_WINDOW_TRANSLUCENT_MASK |
- PAINT_WINDOW_TRANSFORMED_MASK);
+ gWindow->glDrawTexture(tex, transform, attrib, mask
+ | PAINT_WINDOW_BLEND_MASK
+ | PAINT_WINDOW_TRANSLUCENT_MASK
+ | PAINT_WINDOW_TRANSFORMED_MASK);
gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex);
/* Texture rendering tear-down */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
uds->gScreen->setTexEnvMode(GL_REPLACE);
}
-#endif
}
for (CompWindow* w : mTransients)
@@ -759,9 +682,7 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
pc.collect();
pc.drawGeometriesForWindow (window,
-#ifdef USE_MODERN_COMPIZ_GL
transform,
-#endif
mask);
}
}
diff --git a/plugins/unitydialog/src/unitydialog.h b/plugins/unitydialog/src/unitydialog.h
index eee9adea7..4f3f26338 100644
--- a/plugins/unitydialog/src/unitydialog.h
+++ b/plugins/unitydialog/src/unitydialog.h
@@ -40,7 +40,7 @@ namespace unity
GeometryCollection ();
bool status ();
- void addGeometryForWindow (CompWindow *, const CompRegion &paintRegion);
+ bool addGeometryForWindow (CompWindow *, const CompRegion &paintRegion);
void addGeometry (const GLTexture::MatrixList &ml,
const CompRegion &r,
int min,
@@ -64,13 +64,9 @@ namespace unity
int max);
void setTexture (GLTexture *);
-#ifdef USE_MODERN_COMPIZ_GL
void addGeometriesAndDrawTextureForWindow (CompWindow *w,
const GLMatrix &transform,
- unsigned int mask);
-#else
- void addGeometriesAndDrawTextureForWindow (CompWindow *, unsigned int pm);
-#endif
+ unsigned int mask);
private:
GLTexture* mTexture;
@@ -84,13 +80,9 @@ namespace unity
PaintInfoCollector (CompWindow *w);
void collect ();
-#ifdef USE_MODERN_COMPIZ_GL
void drawGeometriesForWindow (CompWindow *w,
const GLMatrix &transform,
unsigned int pm);
-#else
- void drawGeometriesForWindow (CompWindow *w, unsigned int pm);
-#endif
void processGeometry (const GLTexture::MatrixList &ml,
const CompRegion &r,
@@ -255,11 +247,7 @@ public:
bool
glDraw(const GLMatrix&,
-#ifdef USE_MODERN_COMPIZ_GL
const GLWindowPaintAttrib&,
-#else
- GLFragment::Attrib&,
-#endif
const CompRegion&, unsigned int);
bool
@@ -275,12 +263,8 @@ public:
void
glDrawTexture(GLTexture* texture,
-#ifdef USE_MODERN_COMPIZ_GL
const GLMatrix& transform,
const GLWindowPaintAttrib& attrib,
-#else
- GLFragment::Attrib& attrib,
-#endif
unsigned int mask);