aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/render.c24
-rw-r--r--src/sc_editor.c9
2 files changed, 21 insertions, 12 deletions
diff --git a/src/render.c b/src/render.c
index 1ac4faa..1c24175 100644
--- a/src/render.c
+++ b/src/render.c
@@ -70,10 +70,6 @@ static void render_callback_box(cairo_t *cr, struct wrap_box *box)
ascd = pango_units_to_double(box->ascent);
- x = 0.0;
- y = -ascd;
- cairo_user_to_device(cr, &x, &y);
-
/* This is how wide the image should be in Cairo units */
w = pango_units_to_double(box->width);
h = pango_units_to_double(box->height);
@@ -83,18 +79,30 @@ static void render_callback_box(cairo_t *cr, struct wrap_box *box)
surf = box->draw_func(w, h, box->bvp, box->vp);
cairo_new_path(cr);
- cairo_rectangle(cr, 0.0, -ascd, pango_units_to_double(box->width),
- pango_units_to_double(box->height));
+ x = 0.0; y = -ascd;
+ cairo_user_to_device(cr, &x, &y);
+ x = rint(x); y = rint(y);
+ cairo_device_to_user(cr, &x, &y);
+ cairo_rectangle(cr, x, y, pango_units_to_double(box->width),
+ pango_units_to_double(box->height));
+ cairo_clip_preserve(cr);
if ( surf == NULL ) {
cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 1.0);
fprintf(stderr, "Null surface box");
} else {
- cairo_identity_matrix(cr);
cairo_set_source_surface(cr, surf, x, y);
}
- cairo_fill(cr);
+ cairo_paint(cr);
+ cairo_reset_clip(cr);
+
+ cairo_new_path(cr);
+ cairo_rectangle(cr, x+0.5, y+0.5, pango_units_to_double(box->width),
+ pango_units_to_double(box->height));
+ cairo_set_line_width(cr, 1.0);
+ cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
+ cairo_stroke(cr);
cairo_restore(cr);
}
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 7fa8af4..a6515c7 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -428,8 +428,8 @@ static gboolean draw_sig(GtkWidget *da, cairo_t *cr,
cairo_fill(cr);
/* Get the overall size */
- e->border_offs_x = (width - e->w)/2.0;
- e->border_offs_y = (height - e->h)/2.0;
+ e->border_offs_x = rint((width - e->w)/2.0);
+ e->border_offs_y = rint((height - e->h)/2.0);
if ( e->border_offs_x < e->min_border ) {
e->border_offs_x = e->min_border;
}
@@ -439,8 +439,9 @@ static gboolean draw_sig(GtkWidget *da, cairo_t *cr,
/* Draw the slide from the cache */
if ( e->surface != NULL ) {
- cairo_set_source_surface(cr, e->surface, e->border_offs_x,
- e->border_offs_y);
+ cairo_set_source_surface(cr, e->surface,
+ rint(e->border_offs_x),
+ rint(e->border_offs_y));
cairo_paint(cr);
} else {
fprintf(stderr, "Current slide not rendered yet!\n");