Relocate SK_SUPPORT_LEGACY_PICTURE_PTR
Move to platform-specific defines.
(Chromium already has this guard)
R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1831053002
Review URL: https://codereview.chromium.org/1831053002
diff --git a/experimental/nanomsg/picture_demo.cpp b/experimental/nanomsg/picture_demo.cpp
index 5efa03c..859f20e 100644
--- a/experimental/nanomsg/picture_demo.cpp
+++ b/experimental/nanomsg/picture_demo.cpp
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#include "nanomsg/src/nn.h"
#include "nanomsg/src/pipeline.h"
#include "nanomsg/src/reqrep.h"
@@ -53,7 +60,7 @@
nn_sendmsg(socket, &msg, 0/*flags*/);
}
-static SkPicture* recv_picture(int socket, PictureHeader* header) {
+static sk_sp<SkPicture> recv_picture(int socket, PictureHeader* header) {
static const size_t hSize = sizeof(*header); // It's easy to slip up and use sizeof(header).
void* msg;
@@ -63,7 +70,7 @@
// msg is first a fixed-size header, then an .skp.
memcpy(header, msg, hSize);
SkMemoryStream stream((uint8_t*)msg + hSize, size - hSize);
- SkPicture* pic = SkPicture::CreateFromStream(&stream);
+ sk_sp<SkPicture> pic = SkPicture::MakeFromStream(&stream);
SkDebugf(" from proccess %d:", header->pid);
@@ -79,7 +86,7 @@
exit(1);
}
SkMemoryStream stream(skp->data(), skp->size());
- SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&stream));
+ sk_sp<SkPicture> picture(SkPicture::MakeFromStream(&stream));
PictureHeader header;
SkRandom rand(picture->cullRect().width() * picture->cullRect().height());
@@ -143,7 +150,7 @@
// We should have an .skp waiting for us on data socket.
PictureHeader header;
- SkAutoTUnref<SkPicture> picture(recv_picture(data, &header));
+ sk_sp<SkPicture> picture(recv_picture(data, &header));
SkPaint paint;
paint.setAlpha(header.alpha);
diff --git a/gyp/skia_for_android_framework_defines.gypi b/gyp/skia_for_android_framework_defines.gypi
index 88a9e23..aab2ea7 100644
--- a/gyp/skia_for_android_framework_defines.gypi
+++ b/gyp/skia_for_android_framework_defines.gypi
@@ -24,6 +24,7 @@
'SK_SUPPORT_LEGACY_CREATESHADER_PTR',
'SK_SUPPORT_LEGACY_PATHEFFECT_PTR',
'SK_SUPPORT_LEGACY_NEW_SURFACE_API',
+ 'SK_SUPPORT_LEGACY_PICTURE_PTR',
],
},
}
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 0cf9411..808944b 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -27,8 +27,6 @@
class SkWriteBuffer;
struct SkPictInfo;
-#define SK_SUPPORT_LEGACY_PICTURE_PTR
-
/** \class SkPicture
An SkPicture records drawing commands made to a canvas to be played back at a later time.
diff --git a/public.bzl b/public.bzl
index f55cd35..65d5e03 100644
--- a/public.bzl
+++ b/public.bzl
@@ -530,6 +530,7 @@
# Staging flags for API changes
"SK_SUPPORT_LEGACY_COLORFILTER_PTR",
"SK_SUPPORT_LEGACY_CREATESHADER_PTR",
+ "SK_SUPPORT_LEGACY_PICTURE_PTR",
]
################################################################################