hackathon-dev #1
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user