@@ -255,10 +255,8 @@ static PyObject *GrafObj_getattr(self, name)
255255#else
256256
257257 { CGrafPtr itself_color = (CGrafPtr )self -> ob_itself ;
258- /*
259258 if ( strcmp (name , "portBits" ) == 0 )
260- return BMObj_New((BitMapPtr)GetPortPixMap(itself_color));
261- */
259+ return BMObj_New ((BitMapPtr )GetPortBitMapForCopyBits (itself_color ));
262260 if ( strcmp (name , "chExtra" ) == 0 )
263261 return Py_BuildValue ("h" , GetPortChExtra (itself_color ));
264262 if ( strcmp (name , "pnLocHFrac" ) == 0 )
@@ -276,24 +274,24 @@ static PyObject *GrafObj_getattr(self, name)
276274 return Py_BuildValue ("O&" , QdRGB_New , GetPortBackColor (itself_color , & c ));
277275 }
278276 if ( strcmp (name , "pnPixPat" ) == 0 ) {
279- PixPatHandle h = 0 ;
277+ PixPatHandle h = NewPixPat (); /* XXXX wrong dispose routine */
280278
281279 return Py_BuildValue ("O&" , ResObj_New , (Handle )GetPortPenPixPat (itself_color , h ));
282280 }
283281 if ( strcmp (name , "fillPixPat" ) == 0 ) {
284- PixPatHandle h = 0 ;
282+ PixPatHandle h = NewPixPat (); /* XXXX wrong dispose routine */
285283 return Py_BuildValue ("O&" , ResObj_New , (Handle )GetPortFillPixPat (itself_color , h ));
286284 }
287285 if ( strcmp (name , "portRect" ) == 0 ) {
288286 Rect r ;
289287 return Py_BuildValue ("O&" , PyMac_BuildRect , GetPortBounds (itself_color , & r ));
290288 }
291289 if ( strcmp (name , "visRgn" ) == 0 ) {
292- RgnHandle h = 0 ;
290+ RgnHandle h = NewRgn (); /* XXXX wrong dispose routine */
293291 return Py_BuildValue ("O&" , ResObj_New , (Handle )GetPortVisibleRegion (itself_color , h ));
294292 }
295293 if ( strcmp (name , "clipRgn" ) == 0 ) {
296- RgnHandle h = 0 ;
294+ RgnHandle h = NewRgn (); /* XXXX wrong dispose routine */
297295 return Py_BuildValue ("O&" , ResObj_New , (Handle )GetPortClipRegion (itself_color , h ));
298296 }
299297 if ( strcmp (name , "pnLoc" ) == 0 ) {
@@ -3858,6 +3856,22 @@ static PyObject *Qd_GetPortPixMap(_self, _args)
38583856 return _res ;
38593857}
38603858
3859+ static PyObject * Qd_GetPortBitMapForCopyBits (_self , _args )
3860+ PyObject * _self ;
3861+ PyObject * _args ;
3862+ {
3863+ PyObject * _res = NULL ;
3864+ const BitMap * _rv ;
3865+ CGrafPtr port ;
3866+ if (!PyArg_ParseTuple (_args , "O&" ,
3867+ GrafObj_Convert , & port ))
3868+ return NULL ;
3869+ _rv = GetPortBitMapForCopyBits (port );
3870+ _res = Py_BuildValue ("O&" ,
3871+ BMObj_New , _rv );
3872+ return _res ;
3873+ }
3874+
38613875static PyObject * Qd_GetPortBounds (_self , _args )
38623876 PyObject * _self ;
38633877 PyObject * _args ;
@@ -5931,6 +5945,8 @@ static PyMethodDef Qd_methods[] = {
59315945 "(Fixed slope) -> (short _rv)" },
59325946 {"GetPortPixMap" , (PyCFunction )Qd_GetPortPixMap , 1 ,
59335947 "(CGrafPtr port) -> (PixMapHandle _rv)" },
5948+ {"GetPortBitMapForCopyBits" , (PyCFunction )Qd_GetPortBitMapForCopyBits , 1 ,
5949+ "(CGrafPtr port) -> (const BitMap * _rv)" },
59345950 {"GetPortBounds" , (PyCFunction )Qd_GetPortBounds , 1 ,
59355951 "(CGrafPtr port) -> (Rect rect)" },
59365952 {"GetPortForeColor" , (PyCFunction )Qd_GetPortForeColor , 1 ,
0 commit comments