Clone in a terminal:
Commit aebbe14
Johan Mattsson - 2015-06-12T04:40:19+00:00
aebbe14d9a252f1652f0270d8623801bd7a37c97johan.mattsson.m@gmail.com

Valid region in redraw

Changed files (5)

Diff

diff --git a/libbirdfont/ColorPicker.vala b/libbirdfont/ColorPicker.valaindex 7e40758..02693af 100644--- a/libbirdfont/ColorPicker.vala+++ b/libbirdfont/ColorPicker.vala@@ -101,7 +101,7 @@ public class ColorPicker : Tool { 		double step = 1.0 / Toolbox.allocation_width; 		Color c; 		double y = this.y - py;-		+ 		for (double p = 0; p < 1; p += step) { 			c = new Color.hsba (p, 1, 0.5, 1); 			cr.save ();@@ -144,13 +144,14 @@ public class ColorPicker : Tool { 		double y = this.y - py; 		double scale = Toolbox.get_scale (); 		double p;-		 		p = bar_index * bar_height;+			+		return_if_fail (y + p + bar_height - 2 * scale > 0);			 		 		cr.save (); 		cr.set_line_width (1 * scale); 		cr.set_source_rgba (1, 1, 1, 1);-		cr.move_to (val * Toolbox.allocation_width - 3 * scale, y + p + bar_height);+		cr.move_to (val * Toolbox.allocation_width * scale - 3 * scale, y + p + bar_height); 		cr.line_to (val * Toolbox.allocation_width, y + p + bar_height - 2 * scale); 		cr.line_to (val * Toolbox.allocation_width + 3 * scale, y + p + bar_height); 		cr.stroke_preserve ();@@ -161,7 +162,7 @@ public class ColorPicker : Tool { 		cr.save (); 		cr.set_line_width (1 * scale); 		cr.set_source_rgba (1, 1, 1, 1);-		cr.move_to (val * Toolbox.allocation_width - 3 * scale, y + p);+		cr.move_to (val * Toolbox.allocation_width * scale - 3 * scale, y + p); 		cr.line_to (val * Toolbox.allocation_width, y + p + 2 * scale); 		cr.line_to (val * Toolbox.allocation_width + 3 * scale, y + p); 		cr.stroke_preserve ();diff --git a/libbirdfont/Expander.vala b/libbirdfont/Expander.valaindex 5f1e732..3ee4720 100644--- a/libbirdfont/Expander.vala+++ b/libbirdfont/Expander.vala@@ -196,6 +196,10 @@ public class Expander : GLib.Object { 			 			content_height += 5 * scale; 		}+		+		if (unlikely (content_height < 0)) {+			warning (@"content_height < 0");	+		} 	} 	 	public void set_scroll (double scroll) {@@ -279,7 +283,7 @@ public class Expander : GLib.Object { 			 			double text_height = 17 * Toolbox.get_scale (); 			double offset_y = 0;-		+			 			cache = new Surface.similar (cr.get_target (), Cairo.Content.COLOR_ALPHA, Toolbox.allocation_width, (int) (h + content_height)); 			cc = new Context (cache); 		@@ -298,6 +302,7 @@ public class Expander : GLib.Object { 			cache = (!) cached; 			cr.save (); 			cr.set_antialias (Cairo.Antialias.NONE);+			 			cr.set_source_surface (cache, 0, (int) (y + scroll)); 			cr.paint (); 			cr.restore ();@@ -308,7 +313,7 @@ public class Expander : GLib.Object { 		double offset_y = 0; 		double offset_x = 0; 		-		update_tool_position (); //FIXME+		update_tool_position (); 		 		if (tool.size > 0) { 			offset_x = tool.get (0).x;diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 6919b60..806a125 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -156,7 +156,7 @@ public class Glyph : FontDisplay { 	}  	public Gee.ArrayList<Path> get_paths_in_current_layer () {-		return get_current_layer ().paths.paths;+		return get_current_layer ().get_all_paths ().paths; 	} 	 	public Gee.ArrayList<Path> get_all_paths () {diff --git a/libbirdfont/Layer.vala b/libbirdfont/Layer.valaindex aef827b..7a0c39b 100644--- a/libbirdfont/Layer.vala+++ b/libbirdfont/Layer.vala@@ -87,11 +87,24 @@ public class Layer : GLib.Object { 	} 	 	public void print (int indent = 0) {+		foreach (Path p in paths.paths) {+			for (int i = 0; i < indent; i++) {+				stdout.printf ("\t");+			}+			stdout.printf ("Path");+			+			if (p.color != null) {+				stdout.printf (" %s", ((!) p.color).to_rgb_hex ());+			}+			+			stdout.printf ("\n");+		}+		 		foreach (Layer l in subgroups) { 			for (int i = 0; i < indent; i++) { 				stdout.printf ("\t"); 			}-			stdout.printf ("%s\n", l.name);			+			stdout.printf ("%s\n", l.name); 			l.print (indent + 1); 		} 	}diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex 9c837b8..0fc0021 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -372,7 +372,7 @@ public class Toolbox : GLib.Object  { 	 	public void select_tool (Tool tool) { 		bool update;-		+		int offset_y; 		foreach (Expander exp in current_set.get_expanders ()) { 			if (exp.visible) { 				foreach (Tool t in exp.tool) {@@ -389,8 +389,9 @@ public class Toolbox : GLib.Object  { 							 							tool.select_action (tool); 							-							if (update) {							-								redraw ((int) exp.x - 10, (int) exp.y - 10, allocation_width, (int) (allocation_height - exp.y + 10));+							if (update) {+								offset_y = (int) (exp.y - scroll_y);+								redraw ((int) exp.x - 10, (int) offset_y - 10, allocation_width, (int) (allocation_height - offset_y + 10)); 							} 							 							set_current_tool (tool);

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112