The Birdfont Source Code
High resolution drawing canvas
These changes was commited to the Birdfont repository Wed, 24 Jun 2015 20:34:16 +0000.
Contributing
Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
High resolution drawing canvas
--- a/libbirdfont/Expander.vala
+++ b/libbirdfont/Expander.vala
@@ -282,7 +282,6 @@
if (unlikely (cached == null)) {
Context cc;
-
double text_height = 17 * Toolbox.get_scale ();
double offset_y = 0;
--- a/libbirdfont/Glyph.vala
+++ b/libbirdfont/Glyph.vala
@@ -1729,30 +1729,27 @@
allocation = a;
}
- public override void draw (WidgetAllocation allocation, Context cr) {
+ public override void draw (WidgetAllocation allocation, Context cmp) {
Tool tool;
this.allocation = allocation;
-
- ImageSurface ps = new ImageSurface (Format.ARGB32, allocation.width, allocation.height);
- Context cmp = new Context (ps);
-
- cr.save ();
- draw_background_color (cr, 1);
- cr.restore ();
+
+ cmp.save ();
+ draw_background_color (cmp, 1);
+ cmp.restore ();
if (background_image != null && background_image_visible) {
- ((!)background_image).draw (cr, allocation, view_offset_x, view_offset_y, view_zoom);
+ ((!)background_image).draw (cmp, allocation, view_offset_x, view_offset_y, view_zoom);
}
if (unlikely (Preferences.draw_boundaries)) {
foreach (Path p in get_visible_paths ()) {
- p.draw_boundaries (cr);
+ p.draw_boundaries (cmp);
}
}
- draw_background_glyph (allocation, cr);
- juxtapose (allocation, cr);
+ draw_background_glyph (allocation, cmp);
+ juxtapose (allocation, cmp);
if (BirdFont.show_coordinates) {
draw_coordinate (cmp);
@@ -1776,11 +1773,6 @@
tool = MainWindow.get_toolbox ().get_current_tool ();
tool.draw_action (tool, cmp, this);
cmp.restore ();
-
- cr.save ();
- cr.set_source_surface (ps, 0, 0);
- cr.paint ();
- cr.restore ();
}
private void zoom_in_at_point (double x, double y, double amount = 15) {
--- a/libbirdfont/Renderer/Text.vala
+++ b/libbirdfont/Renderer/Text.vala
@@ -346,6 +346,7 @@
warning ("Base line not zero.");
}
+ // FIXME: cache is disabled for retina testing
if (use_cached_glyphs) {
iterate ((glyph, kerning, last) => {
double end;
--- a/libbirdfont/Toolbox.vala
+++ b/libbirdfont/Toolbox.vala
@@ -38,7 +38,7 @@
public static int allocation_width = 0;
public static int allocation_height = 0;
-
+
/** Scrolling with scroll wheel */
bool scrolling_toolbox = false;
@@ -124,10 +124,10 @@
redraw_tool_box ();
}
- public static void set_allocation (int w, int h) {
- if (w != allocation_width || allocation_height != h) {
- allocation_width = w;
- allocation_height = h;
+ public static void set_allocation (int width, int height) {
+ if (width != allocation_width || allocation_height != height) {
+ allocation_width = width;
+ allocation_height = height;
Toolbox.redraw_tool_box ();
}
}