summaryrefslogtreecommitdiff
path: root/plugins/unitydialog
diff options
authorMarc Ordinas i Llopis <marc.ordinasillopis@linaro.org>2012-01-19 19:36:58 +0100
committerMarc Ordinas i Llopis <marc.ordinasillopis@linaro.org>2012-01-19 19:36:58 +0100
commit0d86a80038208dd52345fc0c4983e4500ebf51ed (patch)
tree53fb6137b8d1f6e9002ece58eabfa6b8a060a070 /plugins/unitydialog
parented2717489793e79f8aeb4f6efe1ee2e0e9a01971 (diff)
GLES2: Ported changes to files outside plugins/unityshell.
(bzr r1826.3.1)
Diffstat (limited to 'plugins/unitydialog')
-rw-r--r--plugins/unitydialog/src/unitydialog.cpp98
-rw-r--r--plugins/unitydialog/src/unitydialog.h24
2 files changed, 116 insertions, 6 deletions
diff --git a/plugins/unitydialog/src/unitydialog.cpp b/plugins/unitydialog/src/unitydialog.cpp
index f2423fe90..b13a6f3be 100644
--- a/plugins/unitydialog/src/unitydialog.cpp
+++ b/plugins/unitydialog/src/unitydialog.cpp
@@ -420,7 +420,12 @@ UnityDialogWindow::glAddGeometry(const GLTexture::MatrixList& matrices,
/* Collect textures */
void
UnityDialogWindow::glDrawTexture(GLTexture* texture,
+#ifdef USE_GLES
+ const GLMatrix &transform,
+ const GLWindowPaintAttrib &attrib,
+#else
GLFragment::Attrib& fa,
+#endif
unsigned int mask)
{
unity::PaintInfoCollector::Active ()->processTexture (texture);
@@ -448,7 +453,11 @@ unity::GeometryCollection::addGeometryForWindow (CompWindow *w, const CompRegion
{
/* We can reset the window geometry since it will be
* re-added later */
+#ifdef USE_GLES
+ GLWindow::get (w)->vertexBuffer()->begin();
+#else
GLWindow::get (w)->geometry().reset();
+#endif
for (unsigned int i = 0; i < collectedMatrixLists.size (); i++)
{
@@ -462,6 +471,10 @@ unity::GeometryCollection::addGeometryForWindow (CompWindow *w, const CompRegion
* wobbly etc etc */
GLWindow::get (w)->glAddGeometry(matl, reg, paintRegion, min, max);
}
+
+#ifdef USE_GLES
+ GLWindow::get (w)->vertexBuffer()->end();
+#endif
}
void
@@ -497,7 +510,11 @@ unity::TexGeometryCollection::setTexture (GLTexture *tex)
}
void
-unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w, unsigned int mask)
+unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w,
+#ifdef USE_GLES
+ const GLMatrix &transform,
+#endif
+ unsigned int mask)
{
if (mTexture && mGeometries.status ())
{
@@ -509,6 +526,25 @@ unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w
mGeometries.addGeometryForWindow (w, paintRegion);
+#ifdef USE_GLES
+ 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)
{
UnityDialogScreen *uds = UnityDialogScreen::get (screen);
@@ -528,6 +564,7 @@ unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
uds->gScreen->setTexEnvMode(GL_REPLACE);
}
+#endif
}
}
@@ -581,10 +618,18 @@ unity::PaintInfoCollector::processTexture (GLTexture *tex)
}
void
-unity::PaintInfoCollector::drawGeometriesForWindow(CompWindow *w, unsigned int pm)
+unity::PaintInfoCollector::drawGeometriesForWindow(CompWindow *w,
+#ifdef USE_GLES
+ const GLMatrix &transform,
+#endif
+ unsigned int pm)
{
for (unity::TexGeometryCollection &tcg : mCollection)
+#if USE_GLES
+ tcg.addGeometriesAndDrawTextureForWindow (w, transform, pm);
+#else
tcg.addGeometriesAndDrawTextureForWindow (w, pm);
+#endif
}
unity::PaintInfoCollector * unity::PaintInfoCollector::active_collector = NULL;
@@ -599,7 +644,11 @@ unity::PaintInfoCollector::Active ()
bool
UnityDialogWindow::glDraw(const GLMatrix& transform,
+#ifdef USE_GLES
+ const GLWindowPaintAttrib& attrib,
+#else
GLFragment::Attrib& fragment,
+#endif
const CompRegion& region,
unsigned int mask)
{
@@ -610,7 +659,13 @@ 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, fragment, region, mask);
+ bool status = gWindow->glDraw(transform,
+#ifdef USE_GLES
+ attrib
+#else
+ fragment,
+#endif
+ region, mask);
UNITY_DIALOG_SCREEN(screen);
@@ -618,10 +673,17 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
{
GLTexture::MatrixList matl;
GLTexture::Matrix mat = tex->matrix();
+#ifdef USE_GLES
+ GLWindowPaintAttrib wAttrib(attrib);
+#endif
/* We can reset the window geometry since it will be
* re-added later */
+#ifdef USE_GLES
+ gWindow->vertexBuffer()->begin();
+#else
gWindow->geometry().reset();
+#endif
/* Scale the dim render by the ratio of dim size
* to window size */
@@ -642,7 +704,28 @@ 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_GLES
+ gWindow->vertexBuffer()->end();
+#endif
+
+#ifdef USE_GLES
+ 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)
{
@@ -662,6 +745,7 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
uds->gScreen->setTexEnvMode(GL_REPLACE);
}
+#endif
}
for (CompWindow* w : mTransients)
@@ -674,7 +758,11 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
unity::PaintInfoCollector pc (w);
pc.collect();
- pc.drawGeometriesForWindow (window, mask);
+ pc.drawGeometriesForWindow (window,
+#ifdef USE_GLES
+ transform,
+#endif
+ mask);
}
}
diff --git a/plugins/unitydialog/src/unitydialog.h b/plugins/unitydialog/src/unitydialog.h
index c57a99b5c..be3d785ac 100644
--- a/plugins/unitydialog/src/unitydialog.h
+++ b/plugins/unitydialog/src/unitydialog.h
@@ -64,7 +64,13 @@ namespace unity
int max);
void setTexture (GLTexture *);
+#ifdef USE_GLES
+ void addGeometriesAndDrawTextureForWindow (CompWindow *w,
+ const GLMatrix &transform,
+ unsigned int mask);
+#else
void addGeometriesAndDrawTextureForWindow (CompWindow *, unsigned int pm);
+#endif
private:
GLTexture* mTexture;
@@ -78,7 +84,13 @@ namespace unity
PaintInfoCollector (CompWindow *w);
void collect ();
+#ifdef USE_GLES
+ 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,
@@ -242,7 +254,12 @@ public:
public:
bool
- glDraw(const GLMatrix&, GLFragment::Attrib&,
+ glDraw(const GLMatrix&,
+#ifdef USE_GLES
+ const GLWindowPaintAttrib&,
+#else
+ GLFragment::Attrib&,
+#endif
const CompRegion&, unsigned int);
bool
@@ -258,7 +275,12 @@ public:
void
glDrawTexture(GLTexture* texture,
+#ifdef USE_GLES
+ const GLMatrix& transform,
+ const GLWindowPaintAttrib& attrib,
+#else
GLFragment::Attrib& attrib,
+#endif
unsigned int mask);