dig into the bitmap creation
This commit is contained in:
parent
a8a5206b89
commit
b90c2efe2f
|
@ -2,6 +2,7 @@
|
|||
#define PY_SSIZE_T_CLEAN
|
||||
#include <Python.h>
|
||||
#include "scode.h"
|
||||
#include "log.h"
|
||||
#include "gfxobj.h"
|
||||
#include "bitmap.h"
|
||||
#include "ep_types.h"
|
||||
|
@ -44,11 +45,13 @@ 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))
|
||||
{
|
||||
|
@ -58,6 +61,7 @@ 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);
|
||||
|
@ -115,11 +119,15 @@ 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");
|
||||
BMP_Delete(pbitmapobj->pbmp);
|
||||
Log(LDEBUG, "deleted bitmap");
|
||||
pbitmapobj->pbmp = pbmp;
|
||||
}
|
||||
Py_DECREF(kwargs);
|
||||
|
|
Loading…
Reference in New Issue
Block a user