aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-12-05 04:12:03 +0100
committerStapleButter <thetotalworm@gmail.com>2017-12-05 04:12:03 +0100
commitdd529f0f5cdf37e4196c1793c3c538be8ebe4cd9 (patch)
tree557cef1b3efda96cb671a0cd518c122b5814b325 /src/libui_sdl/libui
parentc5872dab7d9754f3d45662a931eb1baa2c8bb24a (diff)
libui/GTK: fix drawmatrix transform order to match Windows. fixes rotation.
Diffstat (limited to 'src/libui_sdl/libui')
-rw-r--r--src/libui_sdl/libui/unix/drawmatrix.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/libui_sdl/libui/unix/drawmatrix.c b/src/libui_sdl/libui/unix/drawmatrix.c
index ac7ac57..f12b303 100644
--- a/src/libui_sdl/libui/unix/drawmatrix.c
+++ b/src/libui_sdl/libui/unix/drawmatrix.c
@@ -25,35 +25,41 @@ static void c2m(cairo_matrix_t *c, uiDrawMatrix *m)
void uiDrawMatrixTranslate(uiDrawMatrix *m, double x, double y)
{
cairo_matrix_t c;
+ cairo_matrix_t tmp;
m2c(m, &c);
- cairo_matrix_translate(&c, x, y);
+ cairo_matrix_init_translate(&tmp, x, y);
+ cairo_matrix_multiply(&c, &c, &tmp);
c2m(&c, m);
}
void uiDrawMatrixScale(uiDrawMatrix *m, double xCenter, double yCenter, double x, double y)
{
cairo_matrix_t c;
+ cairo_matrix_t tmp;
double xt, yt;
m2c(m, &c);
xt = x;
yt = y;
scaleCenter(xCenter, yCenter, &xt, &yt);
- cairo_matrix_translate(&c, xt, yt);
- cairo_matrix_scale(&c, x, y);
- cairo_matrix_translate(&c, -xt, -yt);
+ cairo_matrix_init_translate(&tmp, xt, yt);
+ cairo_matrix_scale(&tmp, x, y);
+ cairo_matrix_translate(&tmp, -xt, -yt);
+ cairo_matrix_multiply(&c, &c, &tmp);
c2m(&c, m);
}
void uiDrawMatrixRotate(uiDrawMatrix *m, double x, double y, double amount)
{
cairo_matrix_t c;
+ cairo_matrix_t tmp;
m2c(m, &c);
- cairo_matrix_translate(&c, x, y);
- cairo_matrix_rotate(&c, amount);
- cairo_matrix_translate(&c, -x, -y);
+ cairo_matrix_init_translate(&tmp, x, y);
+ cairo_matrix_rotate(&tmp, amount);
+ cairo_matrix_translate(&tmp, -x, -y);
+ cairo_matrix_multiply(&c, &c, &tmp);
c2m(&c, m);
}