finished disco debugging

This commit is contained in:
Amy Bowersox 2019-12-11 14:27:14 -07:00
parent 372f48eab7
commit 6a4938e4ee
3 changed files with 0 additions and 19 deletions

View File

@ -107,11 +107,8 @@ hdc.rectangle(cmd2_rect[0], cmd2_rect[1], cmd2_rect[2], cmd2_rect[3])
hdc.rectangle(cmd3_rect[0], cmd3_rect[1], cmd3_rect[2], cmd3_rect[3])
hdc.rectangle(cmd4_rect[0], cmd4_rect[1], cmd4_rect[2], cmd4_rect[3])
print('GOT HERE 1')
hdc_bits.select_object(bmp_freehand)
print('GOT HERE 2')
hdc.bitblt(cmd1_rect[0] + 6, cmd1_rect[1] + 6, cmd1_rect[0] + 54, cmd1_rect[1] + 54, hdc_bits, 0, 0, 0)
print('GOT HERE 3')
# Main message loop
msg = {}

View File

@ -45,13 +45,11 @@ static int bitmap_init(BitmapObject *self, PyObject *args, PyObject *kwds)
const char *stock;
int width = 0, height = 0;
Log(LDEBUG, "Bitmap init entry");
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|$sii", kwlist, &stock, &width, &height))
return -1;
if (stock)
{
Log(LDEBUG, "stock bitmap");
self->pbmp = _BMP_GetStock(stock);
if (!(self->pbmp))
{
@ -61,7 +59,6 @@ static int bitmap_init(BitmapObject *self, PyObject *args, PyObject *kwds)
}
else
{
Log(LDEBUG, "basic bitmap");
width = MAX(1, width);
height = MAX(1, height);
self->pbmp = BMP_Create(width, height, NULL);
@ -119,16 +116,12 @@ PyObject *Epython_wrap_bitmap(PBITMAP pbmp)
kwargs = PyDict_New();
if (kwargs)
{
Log(LDEBUG, "gonna create it");
rc = PyType_GenericNew(&BitmapType, args, kwargs);
Log(LDEBUG, "created it");
if (rc)
{
pbitmapobj = (BitmapObject *)rc;
Log(LDEBUG, "gonna delete bitmap");
if (pbitmapobj->pbmp)
BMP_Delete(pbitmapobj->pbmp);
Log(LDEBUG, "deleted bitmap");
pbitmapobj->pbmp = pbmp;
}
Py_DECREF(kwargs);

View File

@ -144,24 +144,18 @@ static PyObject *devctxt_select_bitmap(DevCtxtObject *self, BitmapObject *newbmp
BitmapObject *old_bitmap = NULL;
PBITMAP old_pbmp;
Log(LDEBUG, "select_bitmap entry");
if ((self->pdctxt->flags & DCFLG_TYPES) != DCFLG_IS_MEMORY)
{
PyErr_SetString(PyExc_RuntimeError, "must select bitmap into memory device context");
return NULL;
}
Log(LDEBUG, "verified 1");
old_bitmap = self->selected_bitmap;
old_pbmp = (PBITMAP)DC_SelectObject(self->pdctxt, (PGFXOBJECT)(newbmp->pbmp));
Log(LDEBUG, "old_bitmap present=%d, old_pbmp present=%d", !!old_bitmap, !!old_pbmp);
if (!old_bitmap)
{
Log(LDEBUG, "need to wrap old bitmap");
old_bitmap = (BitmapObject *)Epython_wrap_bitmap(old_pbmp);
Log(LDEBUG, "wrapper finished");
if (!old_bitmap)
{
Log(LDEBUG, "wrapper failed");
DC_SelectObject(self->pdctxt, (PGFXOBJECT)old_pbmp);
return NULL;
}
@ -171,7 +165,6 @@ static PyObject *devctxt_select_bitmap(DevCtxtObject *self, BitmapObject *newbmp
self->selected_bitmap = old_bitmap;
}
}
Log(LDEBUG, "replacement sequence");
ASSERT(old_bitmap);
ASSERT(self->selected_bitmap);
ASSERT(newbmp);
@ -185,7 +178,6 @@ static PyObject *devctxt_select_object(DevCtxtObject *self, PyObject *args)
{
PyObject *obj;
Log(LDEBUG, "select_object entry");
if (!PyArg_ParseTuple(args, "O", &obj))
return NULL;
if (!obj)
@ -193,7 +185,6 @@ static PyObject *devctxt_select_object(DevCtxtObject *self, PyObject *args)
PyErr_SetString(PyExc_RuntimeError, "bad object selected");
return NULL;
}
Log(LDEBUG, "ready to comb objects");
if (PyObject_TypeCheck(obj, &BitmapType))
return devctxt_select_bitmap(self, (BitmapObject *)obj);
PyErr_SetString(PyExc_RuntimeError, "unknown type of object selected");