diff -r 000000000000 -r 6474c204b198 gfx/skia/trunk/src/views/mac/SkSampleNSView.mm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gfx/skia/trunk/src/views/mac/SkSampleNSView.mm Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,36 @@ + +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#import "SkSampleNSView.h" +#include "SampleApp.h" +#include +@implementation SkSampleNSView + +- (id)initWithDefaults { + if ((self = [super initWithDefaults])) { + fWind = new SampleWindow(self, *_NSGetArgc(), *_NSGetArgv(), NULL); + } + return self; +} + +- (void)dealloc { + delete fWind; + [super dealloc]; +} + +- (void)swipeWithEvent:(NSEvent *)event { + CGFloat x = [event deltaX]; + if (x < 0) + ((SampleWindow*)fWind)->previousSample(); + else if (x > 0) + ((SampleWindow*)fWind)->nextSample(); + else + ((SampleWindow*)fWind)->showOverview(); +} + +@end