Fixed some bugs in the Windows uiArea code.

This commit is contained in:
Pietro Gagliardi 2015-09-08 12:11:01 -04:00
parent 4eed0d77ae
commit c5e4c3a92d
3 changed files with 8 additions and 3 deletions

View File

@ -49,7 +49,8 @@ static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
a = (uiArea *) GetWindowLongPtrW(hwnd, gwlpArea);
ah = (uiAreaHandler *) GetWindowLongPtrW(hwnd, gwlpAreaHandler);
if (a == NULL) {
//TODO if (a == NULL) {
if (ah == NULL) {
if (uMsg == WM_NCCREATE) {
ai = (struct areainit *) (cs->lpCreateParams);
SetWindowLongPtrW(hwnd, gwlpArea, (LONG_PTR) (ai->a));

View File

@ -69,7 +69,9 @@ void uiDrawArc(uiDrawContext *c, intmax_t xCenter, intmax_t yCenter, intmax_t ra
if (!lineFromCurrentPointToStart) {
// TODO
}
// TODO convert radians to degrees
// AngleArc() expects degrees
startAngle *= (180.0 / M_PI);
endAngle *= (180.0 / M_PI);
if (AngleArc(c->dc,
xCenter, yCenter,
radius,
@ -218,7 +220,7 @@ static void startAlpha(uiDrawContext *c, struct alpha *a)
// now we can finally copy the path like we were going to earlier
if (BeginPath(a->dc) == 0)
logLastError("error beginning path in startAlpha()");
if (PolyDraw(a->dc, points, ops, n) != 0)
if (PolyDraw(a->dc, points, ops, n) == 0)
logLastError("error copying path in startAlpha()");
if (EndPath(a->dc) == 0)
logLastError("error ending path in startAlpha()");

View File

@ -7,6 +7,7 @@
#define COBJMACROS
// see https://github.com/golang/go/issues/9916#issuecomment-74812211
#define INITGUID
#define _USE_MATH_DEFINES
// get Windows version right; right now Windows Vista
#define WINVER 0x0600 /* according to Microsoft's winnls.h */
#define _WIN32_WINNT 0x0600 /* according to Microsoft's sdkddkver.h */
@ -26,3 +27,4 @@
#include <oleacc.h>
#include <stdio.h>
#include <shobjidl.h>
#include <math.h>