summaryrefslogtreecommitdiffstats
path: root/src/display/sodipodi-ctrlrect.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-06-22 21:36:47 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-06-22 21:36:47 +0000
commit917de2bab458d51b4149a1b794cbb1b6b9562171 (patch)
tree9abd6fe6497b8b0965bb85caf4b4456ff2099989 /src/display/sodipodi-ctrlrect.cpp
parent* [INTL:sk] Slovak translation update (diff)
downloadinkscape-917de2bab458d51b4149a1b794cbb1b6b9562171.tar.gz
inkscape-917de2bab458d51b4149a1b794cbb1b6b9562171.zip
Initial Cairo rendering commit: solid shapes, gradients, opacity and patterns
(bzr r9508.1.1)
Diffstat (limited to 'src/display/sodipodi-ctrlrect.cpp')
-rw-r--r--src/display/sodipodi-ctrlrect.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp
index dcd6dc0a6..09bfde6fb 100644
--- a/src/display/sodipodi-ctrlrect.cpp
+++ b/src/display/sodipodi-ctrlrect.cpp
@@ -18,7 +18,7 @@
#include "display-forward.h"
#include "sp-canvas-util.h"
#include "sodipodi-ctrlrect.h"
-#include "libnr/nr-pixops.h"
+#include "display/inkscape-cairo.h"
/*
* Currently we do not have point method, as it should always be painted
@@ -84,7 +84,7 @@ static void sp_ctrlrect_destroy(GtkObject *object)
(* GTK_OBJECT_CLASS(parent_class)->destroy)(object);
}
}
-
+#if 0
/* FIXME: use definitions from somewhere else */
#define RGBA_R(v) ((v) >> 24)
#define RGBA_G(v) (((v) >> 16) & 0xff)
@@ -154,6 +154,7 @@ static void sp_ctrlrect_area(SPCanvasBuf *buf, gint xs, gint ys, gint xe, gint y
}
}
}
+#endif
static void sp_ctrlrect_render(SPCanvasItem *item, SPCanvasBuf *buf)
{
@@ -189,13 +190,38 @@ void CtrlRect::init()
void CtrlRect::render(SPCanvasBuf *buf)
{
+ static double const dashes[2] = {4.0, 4.0};
+
if ((_area.x0 != 0 || _area.x1 != 0 || _area.y0 != 0 || _area.y1 != 0) &&
(_area.x0 < buf->rect.x1) &&
(_area.y0 < buf->rect.y1) &&
((_area.x1 + _shadow_size) >= buf->rect.x0) &&
- ((_area.y1 + _shadow_size) >= buf->rect.y0)) {
- sp_canvas_prepare_buffer(buf);
+ ((_area.y1 + _shadow_size) >= buf->rect.y0))
+ {
+ cairo_save(buf->ct);
+ cairo_translate(buf->ct, -buf->rect.x0, -buf->rect.y0);
+ cairo_set_line_width(buf->ct, 1);
+ if (_dashed) cairo_set_dash(buf->ct, dashes, 2, 0);
+ cairo_rectangle(buf->ct, 0.5 + _area.x0, 0.5 + _area.y0,
+ _area.x1 - _area.x0, _area.y1 - _area.y0);
+ if (_has_fill) {
+ ink_cairo_set_source_rgba32(buf->ct, _fill_color);
+ cairo_fill_preserve(buf->ct);
+ }
+ ink_cairo_set_source_rgba32(buf->ct, _border_color);
+ cairo_stroke(buf->ct);
+
+ if (_shadow_size > 0) {
+ ink_cairo_set_source_rgba32(buf->ct, _shadow_color);
+ cairo_rectangle(buf->ct, 1 + _area.x1, _area.y0 + _shadow_size,
+ _shadow_size, _area.y1 - _area.y0 + 1); // right shadow
+ cairo_rectangle(buf->ct, _area.x0 + _shadow_size, 1 + _area.y1,
+ _area.x1 - _area.x0 - _shadow_size + 1, _shadow_size);
+ cairo_fill(buf->ct);
+ }
+ cairo_restore(buf->ct);
+#if 0
/* Top */
sp_ctrlrect_hline(buf, _area.y0, _area.x0, _area.x1, _border_color, _dashed);
/* Bottom */
@@ -217,6 +243,7 @@ void CtrlRect::render(SPCanvasBuf *buf)
sp_ctrlrect_area(buf, _area.x0 + 1, _area.y0 + 1,
_area.x1 - 1, _area.y1 - 1, _fill_color);
}
+#endif
}
}