dig into the bitmap creation
This commit is contained in:
parent
a8a5206b89
commit
b90c2efe2f
|
@ -2,6 +2,7 @@
|
||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include "scode.h"
|
#include "scode.h"
|
||||||
|
#include "log.h"
|
||||||
#include "gfxobj.h"
|
#include "gfxobj.h"
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "ep_types.h"
|
#include "ep_types.h"
|
||||||
|
@ -44,11 +45,13 @@ static int bitmap_init(BitmapObject *self, PyObject *args, PyObject *kwds)
|
||||||
const char *stock;
|
const char *stock;
|
||||||
int width = 0, height = 0;
|
int width = 0, height = 0;
|
||||||
|
|
||||||
|
Log(LDEBUG, "Bitmap init entry");
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|$sii", kwlist, &stock, &width, &height))
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|$sii", kwlist, &stock, &width, &height))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (stock)
|
if (stock)
|
||||||
{
|
{
|
||||||
|
Log(LDEBUG, "stock bitmap");
|
||||||
self->pbmp = _BMP_GetStock(stock);
|
self->pbmp = _BMP_GetStock(stock);
|
||||||
if (!(self->pbmp))
|
if (!(self->pbmp))
|
||||||
{
|
{
|
||||||
|
@ -58,6 +61,7 @@ static int bitmap_init(BitmapObject *self, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Log(LDEBUG, "basic bitmap");
|
||||||
width = MAX(1, width);
|
width = MAX(1, width);
|
||||||
height = MAX(1, height);
|
height = MAX(1, height);
|
||||||
self->pbmp = BMP_Create(width, height, NULL);
|
self->pbmp = BMP_Create(width, height, NULL);
|
||||||
|
@ -115,11 +119,15 @@ PyObject *Epython_wrap_bitmap(PBITMAP pbmp)
|
||||||
kwargs = PyDict_New();
|
kwargs = PyDict_New();
|
||||||
if (kwargs)
|
if (kwargs)
|
||||||
{
|
{
|
||||||
|
Log(LDEBUG, "gonna create it");
|
||||||
rc = PyType_GenericNew(&BitmapType, args, kwargs);
|
rc = PyType_GenericNew(&BitmapType, args, kwargs);
|
||||||
|
Log(LDEBUG, "created it");
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
pbitmapobj = (BitmapObject *)rc;
|
pbitmapobj = (BitmapObject *)rc;
|
||||||
|
Log(LDEBUG, "gonna delete bitmap");
|
||||||
BMP_Delete(pbitmapobj->pbmp);
|
BMP_Delete(pbitmapobj->pbmp);
|
||||||
|
Log(LDEBUG, "deleted bitmap");
|
||||||
pbitmapobj->pbmp = pbmp;
|
pbitmapobj->pbmp = pbmp;
|
||||||
}
|
}
|
||||||
Py_DECREF(kwargs);
|
Py_DECREF(kwargs);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user