[ease/themes] Round the position of actors containing text to avoid blurring.



commit a35e5ee98912cb8074105351925b72b86617aa30
Author: Nate Stedman <natesm gmail com>
Date:   Sat Jun 5 12:04:49 2010 -0400

    Round the position of actors containing text to avoid blurring.

 src/EditorEmbed.vala   |   12 ++++++------
 src/WelcomeActor.vala  |    4 ++--
 src/WelcomeWindow.vala |   11 +++++++----
 3 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/src/EditorEmbed.vala b/src/EditorEmbed.vala
index b0fde05..2a95b1c 100644
--- a/src/EditorEmbed.vala
+++ b/src/EditorEmbed.vala
@@ -258,13 +258,13 @@ public class Ease.EditorEmbed : ScrollableEmbed
 		
 		slide_actor.set_scale_full(zoom, zoom, 0, 0);
 
-		slide_actor.x = w < width
-		              ? width / 2 - w / 2
-	                  : 0;
+		slide_actor.x = Math.roundf(w < width
+		                            ? width / 2 - w / 2
+	                                : 0);
 		        
-		slide_actor.y = h < height
-		              ? height / 2 - h / 2
-		              : 0;
+		slide_actor.y = Math.roundf(h < height
+		                            ? height / 2 - h / 2
+		                            : 0);
 		              
 		if (selection_rectangle != null)
 		{
diff --git a/src/WelcomeActor.vala b/src/WelcomeActor.vala
index 3852dd2..4ffcc14 100644
--- a/src/WelcomeActor.vala
+++ b/src/WelcomeActor.vala
@@ -98,8 +98,8 @@ public class Ease.WelcomeActor : Clutter.Group
 		rect.width = w;
 		rect.height = h;
 		
-		text.x = rect.width / 2 - text.width / 2;
-		text.y = h + TEXT_OFFSET;
+		text.x = Math.roundf(rect.width / 2 - text.width / 2);
+		text.y = Math.roundf(h + TEXT_OFFSET);
 		
 		if (slide_actor != null)
 		{
diff --git a/src/WelcomeWindow.vala b/src/WelcomeWindow.vala
index 6cfd585..ebde761 100644
--- a/src/WelcomeWindow.vala
+++ b/src/WelcomeWindow.vala
@@ -359,13 +359,16 @@ public class Ease.WelcomeWindow : Gtk.Window
 			float x_pixels = x_origin + x_position *
 			                  (PREVIEW_PADDING + preview_width);
 			
+			float x_round = Math.roundf(x_pixels);
+			float y_round = Math.roundf(y_pixels);
+			
 			if (animate_resize)
 			{	
 				// create new animations if the reshuffle is starting
 				if (x_anims.size == i)
 				{
-					x_anims.add(a.animate(ANIM_EASE, ANIM_TIME, "x", x_pixels));
-					y_anims.add(a.animate(ANIM_EASE, ANIM_TIME, "y", y_pixels));
+					x_anims.add(a.animate(ANIM_EASE, ANIM_TIME, "x", x_round));
+					y_anims.add(a.animate(ANIM_EASE, ANIM_TIME, "y", y_round));
 				}
 				
 				// otherwise, replace the intial target with a new one
@@ -374,8 +377,8 @@ public class Ease.WelcomeWindow : Gtk.Window
 					x_anims.get(i).unbind_property("x");
 					y_anims.get(i).unbind_property("y");
 					
-					x_anims.get(i).bind("x", x_pixels);
-					y_anims.get(i).bind("y", y_pixels);
+					x_anims.get(i).bind("x", x_round);
+					y_anims.get(i).bind("y", y_round);
 				}
 			}
 			else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]