[dia] [transform] cairo renderer supports affine transformations
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [transform] cairo renderer supports affine transformations
- Date: Sun, 12 Sep 2010 13:56:27 +0000 (UTC)
commit ea136600bd4de80a43f4aa871b76922f7d51eddf
Author: Hans Breuer <hans breuer org>
Date: Sun Sep 12 14:26:25 2010 +0200
[transform] cairo renderer supports affine transformations
implement CairoRenderer::draw_object() to support affine transformation
plug-ins/cairo/diacairo-renderer.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
index 7fbb786..6483a6b 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -70,6 +70,7 @@
#include "diarenderer.h"
#include "filter.h"
#include "plug-ins.h"
+#include "object.h" /* only for object->ops->draw */
#include "diacairo.h"
@@ -169,10 +170,28 @@ is_capable_to (DiaRenderer *renderer, RenderCapability cap)
return TRUE;
else if (RENDER_ALPHA == cap)
return TRUE;
+ else if (RENDER_AFFINE == cap)
+ return TRUE;
return FALSE;
}
static void
+draw_object (DiaRenderer *self, DiaObject *object, DiaMatrix *matrix)
+{
+ DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
+ cairo_matrix_t before;
+
+ if (matrix) {
+ cairo_get_matrix (renderer->cr, &before);
+ g_assert (sizeof(cairo_matrix_t) == sizeof(DiaMatrix));
+ cairo_transform (renderer->cr, (cairo_matrix_t *)matrix);
+ }
+ object->ops->draw(object, renderer);
+ if (matrix)
+ cairo_set_matrix (renderer->cr, &before);
+}
+
+static void
ensure_minimum_one_device_unit(DiaCairoRenderer *renderer, real *value)
{
double ax = 1., ay = 1.;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]