summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-01-29 14:07:01 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-01-29 14:07:01 (GMT)
commit5c3c58bde00b04b54e62a2deacdbd36ffc36f9b8 (patch)
tree8b9e7a08e6e81a7fb36ede8443b4013810fe9760 /Mac
parent9b897ecaac0007f44331b82bf59f4057b4092c63 (diff)
downloadcpython-5c3c58bde00b04b54e62a2deacdbd36ffc36f9b8.zip
cpython-5c3c58bde00b04b54e62a2deacdbd36ffc36f9b8.tar.gz
cpython-5c3c58bde00b04b54e62a2deacdbd36ffc36f9b8.tar.bz2
Accessor functions for regions and such expect an existing region as parameter. Fixed for grafport attribute access.
Got GetPortBitMapForCopyBits() and port.portBits to work.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/qd/Qdmodule.c30
-rw-r--r--Mac/Modules/qd/qdscan.py1
-rw-r--r--Mac/Modules/qd/qdsupport.py13
3 files changed, 29 insertions, 15 deletions
diff --git a/Mac/Modules/qd/Qdmodule.c b/Mac/Modules/qd/Qdmodule.c
index 1ca8647..7c9d49b 100644
--- a/Mac/Modules/qd/Qdmodule.c
+++ b/Mac/Modules/qd/Qdmodule.c
@@ -255,10 +255,8 @@ static PyObject *GrafObj_getattr(self, name)
#else
{ CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
- /*
if ( strcmp(name, "portBits") == 0 )
- return BMObj_New((BitMapPtr)GetPortPixMap(itself_color));
- */
+ return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color));
if ( strcmp(name, "chExtra") == 0 )
return Py_BuildValue("h", GetPortChExtra(itself_color));
if ( strcmp(name, "pnLocHFrac") == 0 )
@@ -276,12 +274,12 @@ static PyObject *GrafObj_getattr(self, name)
return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c));
}
if ( strcmp(name, "pnPixPat") == 0 ) {
- PixPatHandle h=0;
+ PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h));
}
if ( strcmp(name, "fillPixPat") == 0 ) {
- PixPatHandle h=0;
+ PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h));
}
if ( strcmp(name, "portRect") == 0 ) {
@@ -289,11 +287,11 @@ static PyObject *GrafObj_getattr(self, name)
return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r));
}
if ( strcmp(name, "visRgn") == 0 ) {
- RgnHandle h=0;
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h));
}
if ( strcmp(name, "clipRgn") == 0 ) {
- RgnHandle h=0;
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h));
}
if ( strcmp(name, "pnLoc") == 0 ) {
@@ -3858,6 +3856,22 @@ static PyObject *Qd_GetPortPixMap(_self, _args)
return _res;
}
+static PyObject *Qd_GetPortBitMapForCopyBits(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ const BitMap * _rv;
+ CGrafPtr port;
+ if (!PyArg_ParseTuple(_args, "O&",
+ GrafObj_Convert, &port))
+ return NULL;
+ _rv = GetPortBitMapForCopyBits(port);
+ _res = Py_BuildValue("O&",
+ BMObj_New, _rv);
+ return _res;
+}
+
static PyObject *Qd_GetPortBounds(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -5931,6 +5945,8 @@ static PyMethodDef Qd_methods[] = {
"(Fixed slope) -> (short _rv)"},
{"GetPortPixMap", (PyCFunction)Qd_GetPortPixMap, 1,
"(CGrafPtr port) -> (PixMapHandle _rv)"},
+ {"GetPortBitMapForCopyBits", (PyCFunction)Qd_GetPortBitMapForCopyBits, 1,
+ "(CGrafPtr port) -> (const BitMap * _rv)"},
{"GetPortBounds", (PyCFunction)Qd_GetPortBounds, 1,
"(CGrafPtr port) -> (Rect rect)"},
{"GetPortForeColor", (PyCFunction)Qd_GetPortForeColor, 1,
diff --git a/Mac/Modules/qd/qdscan.py b/Mac/Modules/qd/qdscan.py
index 6711ac2..6336ba8 100644
--- a/Mac/Modules/qd/qdscan.py
+++ b/Mac/Modules/qd/qdscan.py
@@ -100,7 +100,6 @@ extend = 0x40
'GetPortHWND',
'GetHWNDPort',
'GetPICTFromDIB',
- 'GetPortBitMapForCopyBits', # Something funny in the declaration
'HandleToRgn', # Funny signature
diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py
index 80d1709..b255110 100644
--- a/Mac/Modules/qd/qdsupport.py
+++ b/Mac/Modules/qd/qdsupport.py
@@ -45,6 +45,7 @@ GDHandle = OpaqueByValueType("GDHandle", "ResObj")
CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
BitMap_ptr = OpaqueByValueType("BitMapPtr", "BMObj")
+const_BitMap_ptr = OpaqueByValueType("const BitMap *", "BMObj")
BitMap = OpaqueType("BitMap", "BMObj")
RGBColor = OpaqueType('RGBColor', 'QdRGB')
RGBColor_ptr = RGBColor
@@ -284,10 +285,8 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
Output("#else")
Output("""
{ CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
- /*
if ( strcmp(name, "portBits") == 0 )
- return BMObj_New((BitMapPtr)GetPortPixMap(itself_color));
- */
+ return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color));
if ( strcmp(name, "chExtra") == 0 )
return Py_BuildValue("h", GetPortChExtra(itself_color));
if ( strcmp(name, "pnLocHFrac") == 0 )
@@ -305,12 +304,12 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c));
}
if ( strcmp(name, "pnPixPat") == 0 ) {
- PixPatHandle h=0;
+ PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h));
}
if ( strcmp(name, "fillPixPat") == 0 ) {
- PixPatHandle h=0;
+ PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h));
}
if ( strcmp(name, "portRect") == 0 ) {
@@ -318,11 +317,11 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r));
}
if ( strcmp(name, "visRgn") == 0 ) {
- RgnHandle h=0;
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h));
}
if ( strcmp(name, "clipRgn") == 0 ) {
- RgnHandle h=0;
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h));
}
if ( strcmp(name, "pnLoc") == 0 ) {