Cleanup use of legacy SkSurface creation methods a bit
authorrobertphillips <robertphillips@google.com>
Tue, 23 Aug 2016 13:39:35 +0000 (06:39 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 23 Aug 2016 13:39:35 +0000 (06:39 -0700)
This CL cleans up some remaining uses of the old API

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2223023002

Committed: https://skia.googlesource.com/skia/+/f21cd16228c20927fa4e9b937d6951471cfaa37a
Review-Url: https://codereview.chromium.org/2223023002

experimental/GLFWTest/glfw_main.cpp
platform_tools/android/apps/canvasproof/src/main/jni/org_skia_canvasproof_GaneshPictureRenderer.cpp
platform_tools/android/examples/hello_skia_app/jni/helloskia.cpp

index a8ca7ea97e8f731df56f98271f7bed367c0a56df..21ec33def3c7ba7c2f26b6ecf87a4f2980955671 100644 (file)
@@ -42,7 +42,7 @@ static void init_skia(int w, int h) {
     desc.fStencilBits = 0;
     desc.fRenderTargetHandle = 0;  // assume default framebuffer
  
-    sSurface = SkSurface::NewFromBackendRenderTarget(sContext, desc, NULL);
+    sSurface = SkSurface::MakeFromBackendRenderTarget(sContext, desc, nullptr, nullptr).release();
 }
 
 static void cleanup_skia() {
index d1de529674104e39e6853e53c9d50c6e50e2ac84..de38919fe5d313c2ecc7eca0d5c662d6eecff344 100644 (file)
@@ -37,9 +37,8 @@ static void render_picture(GrContext* grContext,
     SkSurfaceProps surfaceProps(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
                                 kUnknown_SkPixelGeometry);
     // TODO:  Check to see if we can keep the surface between draw calls.
-    SkAutoTUnref<SkSurface> surface(
-            SkSurface::NewFromBackendRenderTarget(
-                    grContext, desc, &surfaceProps));
+    sk_sp<SkSurface> surface(
+            SkSurface::MakeFromBackendRenderTarget(grContext, desc, nullptr, &surfaceProps));
     if (surface) {
         SkCanvas* canvas = surface->getCanvas();
         SkASSERT(canvas);
index dec529ff3c3833c508879c6d7f4a49e81fa866aa..2e12d37a6ba57d49c7a7e324145cca0a2c3e0ab8 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
 #include <math.h>
 #include <jni.h>
 #include <android/bitmap.h>
@@ -29,7 +36,7 @@ JNIEXPORT void JNICALL Java_com_example_HelloSkiaActivity_drawIntoBitmap(JNIEnv*
     SkImageInfo info = SkImageInfo::MakeN32Premul(dstInfo.width, dstInfo.height);
 
     // Create a surface from the given bitmap
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterDirect(info, dstPixels, dstInfo.stride));
+    sk_sp<SkSurface> surface(SkSurface::MakeRasterDirect(info, dstPixels, dstInfo.stride));
     SkCanvas* canvas = surface->getCanvas();
 
     // Draw something "interesting"