Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / src / views / mac / SkNSView.mm
index 80bfd67..6714167 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2011 Google Inc.
  *
@@ -8,6 +7,7 @@
 
 #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);
@@ -50,7 +50,7 @@ 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
@@ -103,12 +103,9 @@ SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
 #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];
         }
@@ -131,9 +128,9 @@ SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
 
 - (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
@@ -268,7 +265,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) {
     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
@@ -283,7 +280,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) {
     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
@@ -298,7 +295,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) {
     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
@@ -313,7 +310,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) {
     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