[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kwin_composite
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2007-04-21 16:12:04
Message-ID: 1177171924.017024.30354.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 656521 by lunakl:

GLTexture::render(), to render to a given QRect



 M  +1 -19     effects/demo_showpicture.cpp  
 M  +1 -19     effects/presentwindows.cpp  
 M  +1 -15     effects/trackmouse.cpp  
 M  +25 -0     lib/kwinglutils.cpp  
 M  +2 -0      lib/kwinglutils.h  


--- branches/work/kwin_composite/effects/demo_showpicture.cpp #656520:656521
@@ -44,25 +44,7 @@
         picture->bind();
         glEnable( GL_BLEND );
         glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-        int x = pictureRect.x();
-        int y = pictureRect.y();
-        int width = pictureRect.width();
-        int height = pictureRect.height();
-        const float verts[ 4 * 2 ] =
-            {
-            x, y,
-            x, y + height,
-            x + width, y + height,
-            x + width, y
-            };
-        const float texcoords[ 4 * 2 ] =
-            {
-            0, 1,
-            0, 0,
-            1, 0,
-            1, 1
-            };
-        renderGLGeometry( mask, region, verts, texcoords, 4 );
+        picture->render( mask, region, pictureRect );
         picture->unbind();
         glPopAttrib();
         }
--- branches/work/kwin_composite/effects/presentwindows.cpp #656520:656521
@@ -127,25 +127,7 @@
         filterTexture->bind();
         glEnable( GL_BLEND );
         glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-        int x = filterTextureRect.x();
-        int y = filterTextureRect.y();
-        int width = filterTextureRect.width();
-        int height = filterTextureRect.height();
-        const float verts[ 4 * 2 ] =
-            {
-            x, y,
-            x, y + height,
-            x + width, y + height,
-            x + width, y
-            };
-        const float texcoords[ 4 * 2 ] =
-            {
-            0, 1,
-            0, 0,
-            1, 0,
-            1, 1
-            };
-        renderGLGeometry( mask, region, verts, texcoords, 4 );
+        filterTexture->render( mask, region, filterTextureRect );
         filterTexture->unbind();
         glPopAttrib();
         }
--- branches/work/kwin_composite/effects/trackmouse.cpp #656520:656521
@@ -67,21 +67,7 @@
              ++i )
             {
             QRect r = starRect( i );
-            const float verts[ 4 * 2 ] =
-                {
-                r.x(), r.y(),
-                r.x(), r.y() + r.height(),
-                r.x() + r.width(), r.y() + r.height(),
-                r.x() + r.width(), r.y()
-                };
-            const float texcoords[ 4 * 2 ] =
-                {
-                0, 1,
-                0, 0,
-                1, 0,
-                1, 1
-                };
-            renderGLGeometry( mask, region, verts, texcoords, 4 );
+            texture->render( mask, region, r );
             }
         texture->unbind();
         glPopAttrib();
--- branches/work/kwin_composite/lib/kwinglutils.cpp #656520:656521
@@ -315,6 +315,31 @@
     glDisable( mTarget );
     }
 
+void GLTexture::render( int mask, QRegion region, const QRect& rect )
+    {
+    return render( !( mask & ( Effect::PAINT_WINDOW_TRANSFORMED | Effect::PAINT_SCREEN_TRANSFORMED )),
+        region, rect );
+    }
+
+void GLTexture::render( bool clip, QRegion region, const QRect& rect )
+    {
+    const float verts[ 4 * 2 ] =
+        {
+        rect.x(), rect.y(),
+        rect.x(), rect.y() + rect.height(),
+        rect.x() + rect.width(), rect.y() + rect.height(),
+        rect.x() + rect.width(), rect.y()
+        };
+    const float texcoords[ 4 * 2 ] =
+        {
+        0, 1,
+        0, 0,
+        1, 0,
+        1, 1
+        };
+    renderGLGeometry( clip, region, verts, texcoords, 4 );
+    }
+
 void GLTexture::enableUnnormalizedTexCoords()
     {
     // update texture matrix to handle GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE
--- branches/work/kwin_composite/lib/kwinglutils.h #656520:656521
@@ -87,6 +87,8 @@
         virtual void discard();
         virtual void bind();
         virtual void unbind();
+        void render( bool clip, QRegion region, const QRect& rect );
+        void render( int mask, QRegion region, const QRect& rect );
         void enableUnnormalizedTexCoords();
         void disableUnnormalizedTexCoords();
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic