[gtkhtml] Fix various drawing glitches.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkhtml] Fix various drawing glitches.
- Date: Fri, 29 Oct 2010 19:14:56 +0000 (UTC)
commit 513b562466316455f45601af9616528bfaeac9b5
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Oct 29 15:14:10 2010 -0400
Fix various drawing glitches.
gtkhtml/htmlengine-edit-cursor.c | 10 +++++-----
gtkhtml/htmlgdkpainter.c | 21 +++++++++++++++------
2 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/gtkhtml/htmlengine-edit-cursor.c b/gtkhtml/htmlengine-edit-cursor.c
index 1ddfa1c..3fb528f 100644
--- a/gtkhtml/htmlengine-edit-cursor.c
+++ b/gtkhtml/htmlengine-edit-cursor.c
@@ -120,7 +120,6 @@ draw_cursor_rectangle (HTMLEngine *e, gint x1, gint y1, gint x2, gint y2,
gint offset)
{
cairo_t *cr;
- GdkColor color;
const double dashes[2] = { 1, 3 };
int ndash = G_N_ELEMENTS (dashes);
@@ -129,11 +128,11 @@ draw_cursor_rectangle (HTMLEngine *e, gint x1, gint y1, gint x2, gint y2,
/* FIXME: what is the off color for? */
cr = gdk_cairo_create (e->window);
- color = *on_color;
- gdk_cairo_set_source_color (cr, &color);
+ gdk_cairo_set_source_color (cr, on_color);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
cairo_set_dash (cr, dashes, ndash, offset);
- cairo_rectangle (cr, x1 + 0.5, y1 + 0.5, x2 - x1, y2 - y1);
+ cairo_rectangle (cr, x1 - 0.5, y1 - 0.5, x2 - x1 + 1, y2 - y1 + 1);
+ cairo_set_line_width (cr, 1.0);
cairo_stroke (cr);
cairo_destroy (cr);
}
@@ -346,7 +345,8 @@ html_engine_draw_cursor_in_area (HTMLEngine *engine,
cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_move_to (cr, x1 + 0.5, y1 + 0.5);
- cairo_line_to (cr, x2 + 0.5, y2 + 0.5);
+ cairo_line_to (cr, x2 + 0.5, y2 - 0.5);
+ cairo_set_line_width (cr, 1);
cairo_stroke (cr);
cairo_destroy (cr);
}
diff --git a/gtkhtml/htmlgdkpainter.c b/gtkhtml/htmlgdkpainter.c
index d511285..3f8e01b 100644
--- a/gtkhtml/htmlgdkpainter.c
+++ b/gtkhtml/htmlgdkpainter.c
@@ -86,15 +86,16 @@ _cairo_draw_line (cairo_t *cr,
gint x2,
gint y2)
{
- cairo_save (cr);
+ cairo_save (cr);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+ cairo_set_line_width (cr, 1);
- cairo_move_to (cr, x1 + 0.5, y1 + 0.5);
- cairo_line_to (cr, x2 + 0.5, y2 + 0.5);
- cairo_stroke (cr);
+ cairo_move_to (cr, x1 + 0.5, y1 + 0.5);
+ cairo_line_to (cr, x2 + 0.5, y2 + 0.5);
+ cairo_stroke (cr);
- cairo_restore (cr);
+ cairo_restore (cr);
}
static void
@@ -396,6 +397,8 @@ draw_border (HTMLPainter *painter,
x -= gdk_painter->x1;
y -= gdk_painter->y1;
+ cairo_save (gdk_painter->cr);
+
while (bordersize > 0) {
if (col2) {
gdk_cairo_set_source_color (gdk_painter->cr, col2);
@@ -420,6 +423,8 @@ draw_border (HTMLPainter *painter,
height-=2;
}
+ cairo_restore (gdk_painter->cr);
+
free_color (painter, &dark);
free_color (painter, &light);
}
@@ -841,10 +846,14 @@ draw_shade_line (HTMLPainter *painter,
x -= gdk_painter->x1;
y -= gdk_painter->y1;
+ cairo_save (gdk_painter->cr);
+
gdk_cairo_set_source_color (gdk_painter->cr, &gdk_painter->dark);
_cairo_draw_line (gdk_painter->cr, x, y, x+width, y);
gdk_cairo_set_source_color (gdk_painter->cr, &gdk_painter->light);
_cairo_draw_line (gdk_painter->cr, x, y + 1, x + width, y + 1);
+
+ cairo_restore (gdk_painter->cr);
}
static guint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]