Here's the cocoa sample app
http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/MainWind... File xcode/SimpleCocoaApp/MainWindow.mm (right): http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/MainWind... xcode/SimpleCocoaApp/MainWindow.mm:33: object:nil]; // Put your subclass of SkView here! http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkContai... File xcode/SimpleCocoaApp/SkContainerView.mm (right): http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkContai... xcode/SimpleCocoaApp/SkContainerView.mm:9: fMatrix = NULL; fMatrix.reset(). http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkContai... xcode/SimpleCocoaApp/SkContainerView.mm:17: void SkContainerView::setMatrix(SkMatrix* m) { (const SkMatrix& m) Change fMatrix to a matrix, not a pointer. http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkToNSVi... File xcode/SimpleCocoaApp/SkToNSView.mm (right): http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkToNSVi... xcode/SimpleCocoaApp/SkToNSView.mm:60: Lets add a comment for this block, describing what its doing Don't need to call getTotalMatrix, it will always be identity. Just change the first preTranslate call to setTranslate. http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkToNSVi... xcode/SimpleCocoaApp/SkToNSView.mm:66: m.preTranslate(-center.x, -center.y); Since this is a new api on your container, lets give it a more specific name. e.g. setBeforeChildMatrix or something. http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkToNSVi... xcode/SimpleCocoaApp/SkToNSView.mm:71: //Draw Image don't need lockPixels
http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkContai... File xcode/SimpleCocoaApp/SkContainerView.mm (right): http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkContai... xcode/SimpleCocoaApp/SkContainerView.mm:9: fMatrix = NULL; On 2011/06/15 15:29:52, reed1 wrote: > fMatrix.reset(). Done. http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkContai... xcode/SimpleCocoaApp/SkContainerView.mm:17: void SkContainerView::setMatrix(SkMatrix* m) { On 2011/06/15 15:29:52, reed1 wrote: > (const SkMatrix& m) > > Change fMatrix to a matrix, not a pointer. Done. http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkToNSVi... File xcode/SimpleCocoaApp/SkToNSView.mm (right): http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkToNSVi... xcode/SimpleCocoaApp/SkToNSView.mm:60: On 2011/06/15 15:29:52, reed1 wrote: > Lets add a comment for this block, describing what its doing > > Don't need to call getTotalMatrix, it will always be identity. Just change the > first preTranslate call to setTranslate. Done. http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkToNSVi... xcode/SimpleCocoaApp/SkToNSView.mm:66: m.preTranslate(-center.x, -center.y); On 2011/06/15 15:29:52, reed1 wrote: > Since this is a new api on your container, lets give it a more specific name. > e.g. setBeforeChildMatrix or something. Done. http://codereview.appspot.com/4576059/diff/2001/xcode/SimpleCocoaApp/SkToNSVi... xcode/SimpleCocoaApp/SkToNSView.mm:71: //Draw Image On 2011/06/15 15:29:52, reed1 wrote: > don't need lockPixels Done.
summary: rename to installSkViews unref in install, so we don't need to override dealloc can we create and install in installSkViews? http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SampleWi... File xcode/SimpleCocoaApp/SampleWindow.mm (right): http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SampleWi... xcode/SimpleCocoaApp/SampleWindow.mm:37: -(void) loadViews { SkView* v = new SkSampleView v->setThisAndThat(...) [fContainerView addSkView:v]; v->unref(); http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SkNSView.h File xcode/SimpleCocoaApp/SkNSView.h (right): http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SkNSView... xcode/SimpleCocoaApp/SkNSView.h:20: #import <Cocoa/Cocoa.h> class SkNSContainerView; http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SkNSView.mm File xcode/SimpleCocoaApp/SkNSView.mm (right): http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SkNSView... xcode/SimpleCocoaApp/SkNSView.mm:69: if (fView != nil) { // TODO -- check if our NSView is backed by a CALayer, and possibly use skia's gpu backend...
http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SampleWi... File xcode/SimpleCocoaApp/SampleWindow.mm (right): http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SampleWi... xcode/SimpleCocoaApp/SampleWindow.mm:37: -(void) loadViews { On 2011/06/15 17:26:57, reed1 wrote: > SkView* v = new SkSampleView > v->setThisAndThat(...) > [fContainerView addSkView:v]; > v->unref(); Done. http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SkNSView.h File xcode/SimpleCocoaApp/SkNSView.h (right): http://codereview.appspot.com/4576059/diff/8001/xcode/SimpleCocoaApp/SkNSView... xcode/SimpleCocoaApp/SkNSView.h:20: #import <Cocoa/Cocoa.h> On 2011/06/15 17:26:57, reed1 wrote: > class SkNSContainerView; Done.