← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~jassmith/notify-osd/exponential-blur into lp:notify-osd

 

Jason Smith has proposed merging lp:~jassmith/notify-osd/exponential-blur into lp:notify-osd.

    Requested reviews:
    Notify OSD Developers (notify-osd-developers)


Corrects existing implementation of exponential blur, it is blazing fast compared to the gaussian and looks pretty decent actually. The only place I can see the difference is in the drop shadow and there its not worse, just different. I have also enabled this as the low quality blur.
-- 
https://code.launchpad.net/~jassmith/notify-osd/exponential-blur/+merge/14456
Your team ayatana-commits is subscribed to branch lp:notify-osd.
=== modified file 'src/exponential-blur.c'
--- src/exponential-blur.c	2009-07-02 10:41:13 +0000
+++ src/exponential-blur.c	2009-11-05 03:20:24 +0000
@@ -36,10 +36,10 @@
 
 static inline void
 _blurinner (guchar* pixel,
-	    gint    zR,
-	    gint    zG,
-	    gint    zB,
-	    gint    zA,
+	    gint   *zR,
+	    gint   *zG,
+	    gint   *zB,
+	    gint   *zA,
 	    gint    alpha,
 	    gint    aprec,
 	    gint    zprec);
@@ -175,10 +175,10 @@
 
 static inline void
 _blurinner (guchar* pixel,
-	    gint    zR,
-	    gint    zG,
-	    gint    zB,
-	    gint    zA,
+	    gint   *zR,
+	    gint   *zG,
+	    gint   *zB,
+	    gint   *zA,
 	    gint    alpha,
 	    gint    aprec,
 	    gint    zprec)
@@ -193,15 +193,15 @@
 	B = *(pixel + 2);
 	A = *(pixel + 3);
 
-	zR += (alpha * ((R << zprec) - zR)) >> aprec;
-	zG += (alpha * ((G << zprec) - zG)) >> aprec;
-	zB += (alpha * ((B << zprec) - zB)) >> aprec;
-	zA += (alpha * ((A << zprec) - zA)) >> aprec;
+	*zR += (alpha * ((R << zprec) - *zR)) >> aprec;
+	*zG += (alpha * ((G << zprec) - *zG)) >> aprec;
+	*zB += (alpha * ((B << zprec) - *zB)) >> aprec;
+	*zA += (alpha * ((A << zprec) - *zA)) >> aprec;
 
-	*pixel       = zR >> zprec;
-	*(pixel + 1) = zG >> zprec;
-	*(pixel + 2) = zB >> zprec;
-	*(pixel + 3) = zA >> zprec;
+	*pixel       = *zR >> zprec;
+	*(pixel + 1) = *zG >> zprec;
+	*(pixel + 2) = *zB >> zprec;
+	*(pixel + 3) = *zA >> zprec;
 } 
 
 static inline void
@@ -228,22 +228,22 @@
 	zB = *(scanline + 2) << zprec;
 	zA = *(scanline + 3) << zprec;
 
-	for (index = 0; index < width * channels; index += channels)
-		_blurinner (&scanline[index],
-			    zR,
-			    zG,
-			    zB,
-			    zA,
+	for (index = 0; index < width; index ++)
+		_blurinner (&scanline[index * channels],
+			    &zR,
+			    &zG,
+			    &zB,
+			    &zA,
 			    alpha,
 			    aprec,
 			    zprec);
 
 	for (index = width - 2; index >= 0; index--)
-		_blurinner (&scanline[index],
-			    zR,
-			    zG,
-			    zB,
-			    zA,
+		_blurinner (&scanline[index * channels],
+			    &zR,
+			    &zG,
+			    &zB,
+			    &zA,
 			    alpha,
 			    aprec,
 			    zprec);
@@ -276,21 +276,21 @@
 	zA = *((guchar*) ptr + 3) << zprec;
 
 	for (index = width; index < (height - 1) * width; index += width)
-		_blurinner ((guchar*) &ptr[index],
-			    zR,
-			    zG,
-			    zB,
-			    zA,
+		_blurinner ((guchar*) &ptr[index * channels],
+			    &zR,
+			    &zG,
+			    &zB,
+			    &zA,
 			    alpha,
 			    aprec,
 			    zprec);
 
 	for (index = (height - 2) * width; index >= 0; index -= width)
-		_blurinner ((guchar*) &ptr[index],
-			    zR,
-			    zG,
-			    zB,
-			    zA,
+		_blurinner ((guchar*) &ptr[index * channels],
+			    &zR,
+			    &zG,
+			    &zB,
+			    &zA,
 			    alpha,
 			    aprec,
 			    zprec);

=== modified file 'src/raico-blur.c'
--- src/raico-blur.c	2009-07-02 10:41:13 +0000
+++ src/raico-blur.c	2009-11-05 03:20:24 +0000
@@ -155,8 +155,7 @@
 	switch (blur->priv->quality)
 	{
 		case RAICO_BLUR_QUALITY_LOW:
-			//surface_exponential_blur (surface, blur->priv->radius);
-			surface_gaussian_blur (surface, blur->priv->radius);
+			surface_exponential_blur (surface, blur->priv->radius);
 		break;
 
 		case RAICO_BLUR_QUALITY_MEDIUM:


Follow ups