aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dm/DMSrcSink.cpp3
-rw-r--r--include/core/SkPicture.h23
-rw-r--r--src/core/SkPicture.cpp11
-rw-r--r--src/core/SkPictureCommon.h2
-rw-r--r--tools/skpinfo.cpp3
5 files changed, 25 insertions, 17 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index f8be87f592..c8a4bc2911 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -35,6 +35,7 @@
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkOpts.h"
+#include "SkPictureCommon.h"
#include "SkPictureData.h"
#include "SkPictureRecorder.h"
#include "SkPipe.h"
@@ -1175,7 +1176,7 @@ static SkRect get_cull_rect_for_skp(const char* path) {
return SkRect::MakeEmpty();
}
SkPictInfo info;
- if (!SkPicture::InternalOnly_StreamIsSKP(stream.get(), &info)) {
+ if (!SkPicture_StreamIsSKP(stream.get(), &info)) {
return SkRect::MakeEmpty();
}
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 17539045f2..2b004d307b 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -131,17 +131,6 @@ public:
/** Returns the approximate byte size of this picture, not including large ref'd objects. */
virtual size_t approximateBytesUsed() const = 0;
- /** Return true if the SkStream/Buffer represents a serialized picture, and
- fills out SkPictInfo. After this function returns, the data source is not
- rewound so it will have to be manually reset before passing to
- CreateFromStream or CreateFromBuffer. Note, CreateFromStream and
- CreateFromBuffer perform this check internally so these entry points are
- intended for stand alone tools.
- If false is returned, SkPictInfo is unmodified.
- */
- static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*);
- static bool InternalOnly_BufferIsSKP(SkReadBuffer*, SkPictInfo*);
-
#ifdef SK_SUPPORT_LEGACY_PICTURE_GPUVETO
/** Return true if the picture is suitable for rendering on the GPU. */
bool suitableForGpuRasterization(GrContext*, const char** whyNot = nullptr) const;
@@ -163,6 +152,18 @@ private:
static sk_sp<SkPicture> MakeFromStream(SkStream*, const SkDeserialProcs&, SkTypefacePlayback*);
friend class SkPictureData;
+ /** Return true if the SkStream/Buffer represents a serialized picture, and
+ fills out SkPictInfo. After this function returns, the data source is not
+ rewound so it will have to be manually reset before passing to
+ CreateFromStream or CreateFromBuffer. Note, CreateFromStream and
+ CreateFromBuffer perform this check internally so these entry points are
+ intended for stand alone tools.
+ If false is returned, SkPictInfo is unmodified.
+ */
+ static bool StreamIsSKP(SkStream*, SkPictInfo*);
+ static bool BufferIsSKP(SkReadBuffer*, SkPictInfo*);
+ friend bool SkPicture_StreamIsSKP(SkStream*, SkPictInfo*);
+
virtual int numSlowPaths() const = 0;
friend class SkPictureGpuAnalyzer;
friend struct SkPathCounter;
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 4642f48c55..b163a166d4 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -86,7 +86,7 @@ bool SkPicture::IsValidPictInfo(const SkPictInfo& info) {
return true;
}
-bool SkPicture::InternalOnly_StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) {
+bool SkPicture::StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) {
if (!stream) {
return false;
}
@@ -110,8 +110,11 @@ bool SkPicture::InternalOnly_StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) {
}
return false;
}
+bool SkPicture_StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) {
+ return SkPicture::StreamIsSKP(stream, pInfo);
+}
-bool SkPicture::InternalOnly_BufferIsSKP(SkReadBuffer* buffer, SkPictInfo* pInfo) {
+bool SkPicture::BufferIsSKP(SkReadBuffer* buffer, SkPictInfo* pInfo) {
SkPictInfo info;
SkASSERT(sizeof(kMagic) == sizeof(info.fMagic));
if (!buffer->readByteArray(&info.fMagic, sizeof(kMagic))) {
@@ -181,7 +184,7 @@ sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream, const SkDeserialPro
sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream, const SkDeserialProcs& procs,
SkTypefacePlayback* typefaces) {
SkPictInfo info;
- if (!InternalOnly_StreamIsSKP(stream, &info)) {
+ if (!StreamIsSKP(stream, &info)) {
return nullptr;
}
@@ -211,7 +214,7 @@ sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream, const SkDeserialPro
sk_sp<SkPicture> SkPicture::MakeFromBuffer(SkReadBuffer& buffer) {
SkPictInfo info;
- if (!InternalOnly_BufferIsSKP(&buffer, &info)) {
+ if (!BufferIsSKP(&buffer, &info)) {
return nullptr;
}
// size should be 0, 1, or negative
diff --git a/src/core/SkPictureCommon.h b/src/core/SkPictureCommon.h
index 23d43fd65b..39f816afc9 100644
--- a/src/core/SkPictureCommon.h
+++ b/src/core/SkPictureCommon.h
@@ -144,4 +144,6 @@ struct SkPathCounter {
sk_sp<SkImage> ImageDeserializer_SkDeserialImageProc(const void*, size_t, void* imagedeserializer);
+bool SkPicture_StreamIsSKP(SkStream*, SkPictInfo*);
+
#endif // SkPictureCommon_DEFINED
diff --git a/tools/skpinfo.cpp b/tools/skpinfo.cpp
index 104322f08f..11b1bb6585 100644
--- a/tools/skpinfo.cpp
+++ b/tools/skpinfo.cpp
@@ -8,6 +8,7 @@
#include "SkCommandLineFlags.h"
#include "SkPicture.h"
#include "SkPictureData.h"
+#include "SkPictureCommon.h"
#include "SkStream.h"
#include "SkFontDescriptor.h"
@@ -51,7 +52,7 @@ int main(int argc, char** argv) {
size_t totStreamSize = stream.getLength();
SkPictInfo info;
- if (!SkPicture::InternalOnly_StreamIsSKP(&stream, &info)) {
+ if (!SkPicture_StreamIsSKP(&stream, &info)) {
return kNotAnSKP;
}