[Prev][Next][Index][Thread]

Re: Gwydion Dylan - MacOS X Carbon Demos



in article 3A409DE4.5DCB809@h2g2.com, Rob Myers at robm@h2g2.com wrote on
2000.12.20 3:54 AM:

> OK, code samples for the applications (excluding .lid and export files)
> are now linked from the index page:
> 
> http://www.robmyers.org/mac-dylan

Hey, uh, this looks pretty bad:

  // Wait for a mouse click 
  while( ~Button() ) 
    newBall( window-rect ); 
    QDFlushPortBuffer( GetWindowPort( my-window ),  
                       GetPortVisibleRegion( GetWindowPort( my-window ),
                                             NewRgn() ) ); 
  end while; 

Apart from the redundant calls to GetWindowPort, calling NewRgn() each time
is going to leak like a sieve. Anyway, it isn't necessary to pass in a
region if you want to flush the whole port. Just use NULL:

    QDFlushPortBuffer( GetWindowPort( my-window ), $NULL );

-- 
Chris Page

let mailto = concatenate( "page", "@", "best.com" );




References: