#include "wx/wxPython/pydrawxxx.h"
-//----------------------------------------------------------------------
+//---------------------------------------------------------------------------
+// Called from _gdiinit so we can do the API import while the GIL is held
+void wxPyDrawList_SetAPIPtr()
+{
+ wxPyCoreAPI_IMPORT();
+}
-PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw,
- PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes) {
- wxPyBeginBlockThreads();
+PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw,
+ PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
+{
+ bool blocked = wxPyBeginBlockThreads();
- if ( !wxPyCoreAPIPtr)
- wxPyCoreAPI_IMPORT();
-
bool isFastSeq = PyList_Check(pyCoords) || PyTuple_Check(pyCoords);
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
bool isFastBrushes = PyList_Check(pyBrushes) || PyTuple_Check(pyBrushes);
exit:
- wxPyEndBlockThreads();
+ wxPyEndBlockThreads(blocked);
return retval;
}
-bool wxPyDrawXXXPoint(wxDC& dc, PyObject* coords) {
+bool wxPyDrawXXXPoint(wxDC& dc, PyObject* coords)
+{
int x, y;
if (! wxPy2int_seq_helper(coords, &x, &y)) {
return True;
}
-bool wxPyDrawXXXLine(wxDC& dc, PyObject* coords) {
+bool wxPyDrawXXXLine(wxDC& dc, PyObject* coords)
+{
int x1, y1, x2, y2;
if (! wxPy4int_seq_helper(coords, &x1, &y1, &x2, &y2)) {
return True;
}
-bool wxPyDrawXXXRectangle(wxDC& dc, PyObject* coords) {
+bool wxPyDrawXXXRectangle(wxDC& dc, PyObject* coords)
+{
int x, y, w, h;
if (! wxPy4int_seq_helper(coords, &x, &y, &w, &h)) {
return True;
}
-bool wxPyDrawXXXEllipse(wxDC& dc, PyObject* coords) {
+bool wxPyDrawXXXEllipse(wxDC& dc, PyObject* coords)
+{
int x, y, w, h;
if (! wxPy4int_seq_helper(coords, &x, &y, &w, &h)) {
}
-bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords) {
+bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords)
+{
wxPoint* points;
int numPoints;
}
-//----------------------------------------------------------------------
+//---------------------------------------------------------------------------
-PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList) {
- wxPyBeginBlockThreads();
+PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)
+{
+ bool blocked = wxPyBeginBlockThreads();
- if ( !wxPyCoreAPIPtr)
- wxPyCoreAPI_IMPORT();
-
bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
bool isFastText = PyList_Check(textList) || PyTuple_Check(textList);
bool isFastForeground = PyList_Check(foregroundList) || PyTuple_Check(foregroundList);
else {
obj = PySequence_GetItem(foregroundList, i);
}
- if (! wxPyConvertSwigPtr(obj, (void **) &color, wxT("wxColour_p"))) {
+ if (! wxPyConvertSwigPtr(obj, (void **) &color, wxT("wxColour"))) {
if (!isFastForeground)
Py_DECREF(obj);
goto err2;
goto exit;
exit:
- wxPyEndBlockThreads();
+ wxPyEndBlockThreads(blocked);
return retval;
}
-//----------------------------------------------------------------------
+//---------------------------------------------------------------------------