-
/*
* Copyright 2011 Google Inc.
*
#import "SkNSView.h"
#include "SkCanvas.h"
+#include "SkSurface.h"
#include "SkCGUtils.h"
#include "SkEvent.h"
SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
selector:@selector(backingPropertiesChanged:)
name:@"NSWindowDidChangeBackingPropertiesNotification"
object:[self window]];
- if (NULL != fWind) {
+ if (fWind) {
fWind->setVisibleP(true);
NSSize size = self.frame.size;
#if RETINA_API_AVAILABLE
#if RETINA_API_AVAILABLE
newSize = [self convertSizeToBacking:newSize];
#endif
- if (NULL != fWind &&
- (fWind->width() != newSize.width ||
- fWind->height() != newSize.height))
- {
+ if (fWind && (fWind->width() != newSize.width || fWind->height() != newSize.height)) {
fWind->resize((int) newSize.width, (int) newSize.height);
- if (NULL != fGLContext) {
+ if (fGLContext) {
glClear(GL_STENCIL_BUFFER_BIT);
[fGLContext update];
}
- (void)drawSkia {
fRedrawRequestPending = false;
- if (NULL != fWind) {
- SkAutoTUnref<SkCanvas> canvas(fWind->createCanvas());
- fWind->draw(canvas);
+ if (fWind) {
+ SkAutoTUnref<SkSurface> surface(fWind->createSurface());
+ fWind->draw(surface->getCanvas());
#ifdef FORCE_REDRAW
fWind->inval(NULL);
#endif
NSPoint p = [event locationInWindow];
unsigned modi = convertNSModifiersToSk([event modifierFlags]);
- if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
+ if ([self mouse:p inRect:[self bounds]] && fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
#if RETINA_API_AVAILABLE
loc = [self convertPointToBacking:loc]; //y-up
NSPoint p = [event locationInWindow];
unsigned modi = convertNSModifiersToSk([event modifierFlags]);
- if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
+ if ([self mouse:p inRect:[self bounds]] && fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
#if RETINA_API_AVAILABLE
loc = [self convertPointToBacking:loc]; //y-up
NSPoint p = [event locationInWindow];
unsigned modi = convertNSModifiersToSk([event modifierFlags]);
- if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
+ if ([self mouse:p inRect:[self bounds]] && fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
#if RETINA_API_AVAILABLE
loc = [self convertPointToBacking:loc]; //y-up
NSPoint p = [event locationInWindow];
unsigned modi = convertNSModifiersToSk([event modifierFlags]);
- if ([self mouse:p inRect:[self bounds]] && NULL != fWind) {
+ if ([self mouse:p inRect:[self bounds]] && fWind) {
NSPoint loc = [self convertPoint:p fromView:nil];
#if RETINA_API_AVAILABLE
loc = [self convertPointToBacking:loc]; //y-up