Attached patch allows use of mipmapping in scale plugin.

wolf
-- 
  Bartek   .  
  Taudul   :  
          .:....................................................................
w o l f @ p l d - l i n u x . o r g            .:. http://wolf.valkyrie.one.pl/
>From a5400dd5e9c200f76c8e1bd979ed261bfff458f2 Mon Sep 17 00:00:00 2001
From: Bartosz Taudul <[EMAIL PROTECTED]>
Date: Thu, 20 Sep 2007 22:14:33 +0200
Subject: [PATCH] Add mipmapping to scale.

---
 include/compiz-scale.h |    3 ++-
 metadata/scale.xml.in  |    5 +++++
 plugins/scale.c        |    9 ++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/compiz-scale.h b/include/compiz-scale.h
index f92cabc..e3a70ef 100644
--- a/include/compiz-scale.h
+++ b/include/compiz-scale.h
@@ -97,7 +97,8 @@ typedef struct _ScaleDisplay {
 #define SCALE_SCREEN_OPTION_ICON             6
 #define SCALE_SCREEN_OPTION_HOVER_TIME       7
 #define SCALE_SCREEN_OPTION_MULTIOUTPUT_MODE 8
-#define SCALE_SCREEN_OPTION_NUM              9
+#define SCALE_SCREEN_OPTION_MIPMAP           9
+#define SCALE_SCREEN_OPTION_NUM              10
 
 typedef enum {
     ScaleTypeNormal = 0,
diff --git a/metadata/scale.xml.in b/metadata/scale.xml.in
index 2d522b9..6f982a3 100644
--- a/metadata/scale.xml.in
+++ b/metadata/scale.xml.in
@@ -146,6 +146,11 @@
                    <_name>On all output devices</_name>
                </desc>
            </option>
+           <option name="mipmap" type="bool">
+               <_short>Mipmap</_short>
+               <_long>Generate mipmaps when possible for higher quality 
scaling</_long>
+               <default>true</default>
+           </option>
        </screen>
     </plugin>
 </compiz>
diff --git a/plugins/scale.c b/plugins/scale.c
index c4f68d7..5adee31 100644
--- a/plugins/scale.c
+++ b/plugins/scale.c
@@ -389,6 +389,7 @@ scalePaintWindow (CompWindow                  *w,
        {
            FragmentAttrib fragment;
            CompTransform  wTransform = *transform;
+           GLenum         filter = s->display->textureFilter;
 
            if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
                return FALSE;
@@ -408,12 +409,17 @@ scalePaintWindow (CompWindow                *w,
            glPushMatrix ();
            glLoadMatrixf (wTransform.m);
 
+           if (ss->opt[SCALE_SCREEN_OPTION_MIPMAP].value.b)
+               s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
+
            (*s->drawWindow) (w, &wTransform, &fragment, region,
                              mask | PAINT_WINDOW_TRANSFORMED_MASK);
 
            glPopMatrix ();
 
            (*ss->scalePaintDecoration) (w, &sAttrib, transform, region, mask);
+
+           s->display->textureFilter = filter;
        }
     }
     else
@@ -2006,7 +2012,8 @@ static const CompMetadataOptionInfo 
scaleScreenOptionInfo[] = {
     { "opacity", "int", "<min>0</min><max>100</max>", 0, 0 },
     { "overlay_icon", "int", RESTOSTRING (0, SCALE_ICON_LAST), 0, 0 },
     { "hover_time", "int", "<min>50</min>", 0, 0 },
-    { "multioutput_mode", "int", RESTOSTRING (0, SCALE_MOMODE_LAST), 0, 0 }
+    { "multioutput_mode", "int", RESTOSTRING (0, SCALE_MOMODE_LAST), 0, 0 },
+    { "mipmap", "bool", 0, 0, 0 }
 };
 
 static Bool
-- 
1.5.3.2

_______________________________________________
compiz mailing list
compiz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/compiz

Reply via email to