fixed compile errors

This commit is contained in:
Amy G. Bowersox 2019-12-10 12:55:32 -07:00
parent c3b3e0a350
commit 519e58fd77
3 changed files with 14 additions and 10 deletions

View File

@ -1,3 +1,4 @@
#include <stdlib.h>
#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)

View File

@ -1,4 +1,5 @@
#include <string.h>
#include <stdlib.h>
#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)

View File

@ -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)
{