From 519e58fd779e2cda88da40af7d9442e92ab1cbd9 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Tue, 10 Dec 2019 12:55:32 -0700 Subject: [PATCH] fixed compile errors --- src/dc_screen.c | 11 +++++++---- src/devctxt.c | 5 +++-- src/ep_devctxt.c | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/dc_screen.c b/src/dc_screen.c index 8e37e98..31b3197 100755 --- a/src/dc_screen.c +++ b/src/dc_screen.c @@ -1,3 +1,4 @@ +#include #include "fbinit.h" #include "devctxt.h" #include "dc_screen.h" @@ -30,7 +31,7 @@ static inline UINT16 apply_rop2(INT32 op, UINT16 disp, UINT16 pen) return disp & (~pen); case R2_NOTCOPYPEN: return ~pen; - case R2_MASKPENNOT; + case R2_MASKPENNOT: return (~disp) & pen; case R2_NOT: return ~disp; @@ -55,6 +56,7 @@ static inline UINT16 apply_rop2(INT32 op, UINT16 disp, UINT16 pen) case R2_WHITE: return (UINT16)(-1); } + return pen; /* last ditch default */ } static COLORREF screen_set_pixel(PVOID privdata, INT32 x, INT32 y, COLORREF color, INT32 op) @@ -91,7 +93,7 @@ static BOOL screen_line(PVOID privdata, INT32 x1, INT32 y1, INT32 x2, INT32 y2, } loc = loc_from_coords(priv, x1, y1); tmp = x1; - x1 << 16; + x1 <<= 16; dx = (dx << 16) / dy; while (y1 <= y2) { @@ -131,11 +133,12 @@ static BOOL screen_line(PVOID privdata, INT32 x1, INT32 y1, INT32 x2, INT32 y2, ++loc; if (tmp != (y1 >> 16)) { - loc += ((((y1 >> 16) - tmp) * priv->pix_per_row); + loc += (((y1 >> 16) - tmp) * priv->pix_per_row); tmp = y1 >> 16; } } } + return TRUE; } static const DCFUNTABLE screen_funtable = { @@ -159,7 +162,7 @@ PDCTXT DC_CreateScreenContext(void) if (!priv) return NULL; priv->pix_per_row = Fb_Info->width; - priv->pdata = Pb_Ptr; + priv->pdata = Fb_Ptr; rc = _DC_Allocate(&screen_funtable, priv); if (rc) diff --git a/src/devctxt.c b/src/devctxt.c index df89755..83fc8ab 100755 --- a/src/devctxt.c +++ b/src/devctxt.c @@ -1,4 +1,5 @@ #include +#include #include "gfxtype.h" #include "gfxobj.h" #include "devctxt.h" @@ -41,7 +42,7 @@ static BOOL line_clip(PINT32 output, INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT y2 = tmp; tmpb = outcode1; outcode1 = outcode2; - outcode2 = tmp; + outcode2 = tmpb; } if (outcode1 & 0x8) { @@ -102,7 +103,7 @@ COLORREF DC_SetPixel(PDCTXT pdctxt, INT32 x, INT32 y, COLORREF color) { if (!G_coords_in_rect(&(pdctxt->cliprect), x, y)) return (COLORREF)(-1); - return (*(pdctxt->funcs->set_pixel))(pdctxt->privdata, xm, y, colorref, pdctxt->rop2); + return (*(pdctxt->funcs->set_pixel))(pdctxt->privdata, x, y, color, pdctxt->rop2); } BOOL DC_LineTo(PDCTXT pdctxt, INT32 x, INT32 y) diff --git a/src/ep_devctxt.c b/src/ep_devctxt.c index f8b3069..ae05cdc 100755 --- a/src/ep_devctxt.c +++ b/src/ep_devctxt.c @@ -203,18 +203,18 @@ static void devctxt_dealloc(DevCtxtObject *self) static int devctxt_init(DevCtxtObject *self, PyObject *args, PyObject *kwds) { - static char *kwlist[] = { "type" } + static char *kwlist[] = { "type" }; char *type; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|s", kwlist, &type)) return -1; - if (stricmp(type, "screen") == 0) + if (strcmp(type, "screen") == 0) { self->pdctxt = DC_CreateScreenContext(); if (!(self->pdctxt)) { PyErr_SetString(PyExc_RuntimeError, "unable to create screen context"); - return -1 + return -1; } } else @@ -237,7 +237,7 @@ static PyTypeObject DevCtxtType = { .tp_dealloc = (destructor)devctxt_dealloc, .tp_methods = DevCtxtMethods, .tp_getset = DevCtxtProperties, -} +}; HRESULT Epython_register_devctxt(PyObject *module) {