skia2/experimental/pipe/SkPipe.h
Mike Klein 60900b55f9 move skpipe to experimental
Nothing's using it except test tools.
I'd like to make that a bit clearer by getting it out of src.

Disabled the fuzzer.

Removed the bench so Android's building nanobench doesn't block this.

Bug: chromium:886713

Change-Id: I761f52c40171c27ff4b699409b32647e84684ec3
Reviewed-on: https://skia-review.googlesource.com/156240
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-09-21 17:20:25 +00:00

77 lines
1.5 KiB
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkPipe_DEFINED
#define SkPipe_DEFINED
#include "SkData.h"
#include "SkImage.h"
#include "SkPicture.h"
#include "SkSerialProcs.h"
class SkCanvas;
class SkTypeface;
class SkWStream;
struct SkRect;
class SkPipeSerializer {
public:
SkPipeSerializer();
~SkPipeSerializer();
void setSerialProcs(const SkSerialProcs&);
void resetCache();
sk_sp<SkData> writeImage(SkImage*);
sk_sp<SkData> writePicture(SkPicture*);
void writeImage(SkImage*, SkWStream*);
void writePicture(SkPicture*, SkWStream*);
SkCanvas* beginWrite(const SkRect& cullBounds, SkWStream*);
void endWrite();
private:
class Impl;
std::unique_ptr<Impl> fImpl;
};
class SkPipeDeserializer {
public:
SkPipeDeserializer();
~SkPipeDeserializer();
void setDeserialProcs(const SkDeserialProcs&);
sk_sp<SkImage> readImage(const SkData* data) {
if (!data) {
return nullptr;
}
return this->readImage(data->data(), data->size());
}
sk_sp<SkPicture> readPicture(const SkData* data) {
if (!data) {
return nullptr;
}
return this->readPicture(data->data(), data->size());
}
sk_sp<SkImage> readImage(const void*, size_t);
sk_sp<SkPicture> readPicture(const void*, size_t);
bool playback(const void*, size_t, SkCanvas*);
private:
class Impl;
std::unique_ptr<Impl> fImpl;
};
#endif