| Index: src/core/SkSerializeDrawable.h
|
| diff --git a/src/core/SkSerializeDrawable.h b/src/core/SkSerializeDrawable.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..39f17a51f929b8f911f253f2fe36499202fc7377
|
| --- /dev/null
|
| +++ b/src/core/SkSerializeDrawable.h
|
| @@ -0,0 +1,30 @@
|
| +/*
|
| + * 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 "SkDrawable.h"
|
| +#include "SkReadBuffer.h"
|
| +#include "SkWriteBuffer.h"
|
| +
|
| +class SkSerializeDrawable {
|
| +public:
|
| +
|
| + /**
|
| + * Create an SkDrawable from serialized data.
|
| + */
|
| + static SkDrawable* NewFromSerialized(SkReadBuffer& buffer) {
|
| + return (SkDrawable*) buffer.readFlattenable(SkFlattenable::kSkDrawable_Type);
|
| + }
|
| +
|
| + /**
|
| + * Serialize an SkDrawable.
|
| + */
|
| + static SkWriteBuffer* Serialize(const SkDrawable& drawable) {
|
| + SkWriteBuffer* buffer = new SkWriteBuffer();
|
| + buffer->writeFlattenable(&drawable);
|
| + return buffer;
|
| + }
|
| +};
|
|
|