~ubuntu-branches/ubuntu/maverick/pygame/maverick

« back to all changes in this revision

Viewing changes to src/draw.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-14 17:02:11 UTC
  • mfrom: (1.3.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100114170211-21eop2ja7mr9vdcr
Tags: 1.9.1release-0ubuntu1
* New upstream version (lp: #433304)
* debian/control:
  - build-depends on libportmidi-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 *  drawing module for pygame
25
25
 */
26
26
#include "pygame.h"
 
27
#include "pgcompat.h"
27
28
#include "pygamedocs.h"
28
29
#include <math.h>
29
30
 
640
641
        /*build the pointlist*/
641
642
        points = Py_BuildValue("((ii)(ii)(ii)(ii))", l, t, r, t, r, b, l, b);
642
643
 
643
 
        args = Py_BuildValue("(OOOi)", surfobj, colorobj, points, width);
 
644
        args = Py_BuildValue("(OONi)", surfobj, colorobj, points, width);
644
645
        if(args) ret = polygon(NULL, args);
645
646
 
646
647
        Py_XDECREF(args);
647
 
        Py_XDECREF(points);
648
648
        return ret;
649
649
}
650
650
 
1551
1551
 
1552
1552
 
1553
1553
 
1554
 
static PyMethodDef draw_builtins[] =
 
1554
static PyMethodDef _draw_methods[] =
1555
1555
{
1556
1556
        { "aaline", aaline, METH_VARARGS, DOC_PYGAMEDRAWAALINE },
1557
1557
        { "line", line, METH_VARARGS, DOC_PYGAMEDRAWLINE },
1567
1567
};
1568
1568
 
1569
1569
 
1570
 
PYGAME_EXPORT
1571
 
void initdraw(void)
 
1570
MODINIT_DEFINE (draw)
1572
1571
{
1573
 
        PyObject *module, *dict;
1574
 
 
1575
 
    /* create the module */
1576
 
        module = Py_InitModule3("draw", draw_builtins, DOC_PYGAMEDRAW);
1577
 
        dict = PyModule_GetDict(module);
1578
 
 
1579
 
        /*imported needed apis*/
 
1572
        PyObject *module;
 
1573
 
 
1574
#if PY3
 
1575
        static struct PyModuleDef _module = {
 
1576
            PyModuleDef_HEAD_INIT,
 
1577
            "draw",
 
1578
            DOC_PYGAMEDRAW,
 
1579
            -1,
 
1580
            _draw_methods,
 
1581
            NULL, NULL, NULL, NULL
 
1582
        };
 
1583
#endif
 
1584
 
 
1585
        /* imported needed apis; Do this first so if there is an error
 
1586
           the module is not loaded.
 
1587
        */
1580
1588
        import_pygame_base();
1581
 
        import_pygame_color();
 
1589
        if (PyErr_Occurred ()) {
 
1590
            MODINIT_ERROR;
 
1591
        }
 
1592
        import_pygame_color();
 
1593
        if (PyErr_Occurred ()) {
 
1594
            MODINIT_ERROR;
 
1595
        }
1582
1596
        import_pygame_rect();
 
1597
        if (PyErr_Occurred ()) {
 
1598
            MODINIT_ERROR;
 
1599
        }
1583
1600
        import_pygame_surface();
 
1601
        if (PyErr_Occurred ()) {
 
1602
            MODINIT_ERROR;
 
1603
        }
 
1604
 
 
1605
        /* create the module */
 
1606
#if PY3
 
1607
        module = PyModule_Create (&_module);
 
1608
#else
 
1609
        module = Py_InitModule3(MODPREFIX "draw", _draw_methods, DOC_PYGAMEDRAW);
 
1610
#endif
 
1611
        MODINIT_RETURN (module);
1584
1612
}
1585
1613
 
1586
1614