From 3d8f8f075678b083ab2e167721ebf513cd52e75c Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 11 Oct 2015 11:42:07 -0400 Subject: [PATCH] Implemented a basic translation. --- test/drawtests.c | 7 ++++++- unix/area.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/drawtests.c b/test/drawtests.c index ecd9d412..fb87934c 100644 --- a/test/drawtests.c +++ b/test/drawtests.c @@ -406,7 +406,12 @@ static void drawD2DLinearBrush(uiAreaDrawParams *p) uiDrawBrushGradientStop stops[2]; uiDrawStrokeParams sp; - // TODO transform by (25,25) to leave some room + uiDrawMatrix m; + + // leave some room + uiDrawMatrixSetIdentity(&m); + uiDrawMatrixTranslate(&m, 25, 25); + uiDrawTransform(p->Context, &m); gradient.Type = uiDrawBrushTypeLinearGradient; gradient.X0 = 0; diff --git a/unix/area.c b/unix/area.c index d24314cd..917ed6df 100644 --- a/unix/area.c +++ b/unix/area.c @@ -178,6 +178,7 @@ static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr) dp.HScrollPos = gtk_adjustment_get_value(ap->ha); dp.VScrollPos = gtk_adjustment_get_value(ap->va); + // no need to save or restore the graphics state; GTK+ does that for us (*(ap->ah->Draw))(ap->ah, ap->a, &dp); freeContext(dp.Context);