[PATCH] Add mipmapping to scale.

Bartosz Taudul wolf.pld at gmail.com
Thu Sep 20 13:14:33 PDT 2007


---
 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


--3V7upXqbjpZ4EhLz--


More information about the compiz mailing list