Implemented skewing. Will do the test now.

This commit is contained in:
Pietro Gagliardi 2015-10-12 07:58:07 -04:00
parent 46e3fee40d
commit de3ccecd5b
4 changed files with 22 additions and 5 deletions

View File

@ -333,9 +333,9 @@ void uiDrawMatrixRotate(uiDrawMatrix *m, double x, double y, double amount)
c2m(&c, m); c2m(&c, m);
} }
void uiDrawMatrixSkew(uiDrawMatrix *m, double x, double y, double amount, double yamount) void uiDrawMatrixSkew(uiDrawMatrix *m, double x, double y, double xamount, double yamount)
{ {
complain("TODO"); fallbackSkew(m, x, y, xamount, yamount);
} }
void uiDrawMatrixMultiply(uiDrawMatrix *dest, uiDrawMatrix *src) void uiDrawMatrixMultiply(uiDrawMatrix *dest, uiDrawMatrix *src)

View File

@ -12,7 +12,23 @@ void setIdentity(uiDrawMatrix *m)
m->M32 = 0; m->M32 = 0;
} }
// TODO skew // TODO don't default to fallback functions within the fallback functions
// technique from "Programming with Quartz: 2D and PDF Graphics in Mac OS X"
// TODO if Windows 7 is ever dropped change this so we can pass in D2D1Tan()
void fallbackSkew(uiDrawMatrix *m, double x, double y, double xamount, double yamount)
{
uiDrawMatrix t, n;
setIdentity(&t);
fallbackTranslate(&t, x, y);
setIdentity(&n);
n.M12 = tan(xamount);
n.M21 = tan(yamount);
fallbackMultiply(&n, &t);
// TODO undo the translation?
fallbackMultiply(&m, &n);
}
// see windows/draw.c for more information // see windows/draw.c for more information
// TODO we don't need to do this if we can bypass the multiplication somehow // TODO we don't need to do this if we can bypass the multiplication somehow

View File

@ -62,6 +62,7 @@ extern int fromScancode(uintptr_t, uiAreaKeyEvent *);
// matrix.c // matrix.c
extern void setIdentity(uiDrawMatrix *); extern void setIdentity(uiDrawMatrix *);
extern void fallbackSkew(uiDrawMatrix *, double, double, double, double);
extern void fallbackTranslate(uiDrawMatrix *, double, double); extern void fallbackTranslate(uiDrawMatrix *, double, double);
extern void scaleCenter(double, double, double *, double *); extern void scaleCenter(double, double, double *, double *);
extern void fallbackScale(uiDrawMatrix *, double, double, double, double); extern void fallbackScale(uiDrawMatrix *, double, double, double, double);

View File

@ -362,9 +362,9 @@ void uiDrawMatrixRotate(uiDrawMatrix *m, double x, double y, double amount)
c2m(&c, m); c2m(&c, m);
} }
void uiDrawMatrixSkew(uiDrawMatrix *m, double x, double y, double amount, double yamount) void uiDrawMatrixSkew(uiDrawMatrix *m, double x, double y, double xamount, double yamount)
{ {
complain("TODO"); fallbackSkew(m, x, y, xamount, yamount);
} }
void uiDrawMatrixMultiply(uiDrawMatrix *dest, uiDrawMatrix *src) void uiDrawMatrixMultiply(uiDrawMatrix *dest, uiDrawMatrix *src)