| Index: skia/ext/skia_utils_base.cc
|
| diff --git a/skia/ext/skia_utils_base.cc b/skia/ext/skia_utils_base.cc
|
| index c56730bd9bc8f0b1c294617d2ab4e1829aca11d4..01ed5de6d06a48c1f2c9648b91775053abff4ba9 100644
|
| --- a/skia/ext/skia_utils_base.cc
|
| +++ b/skia/ext/skia_utils_base.cc
|
| @@ -2,10 +2,12 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "skia/ext/skia_utils_base.h"
|
| +
|
| #include <stdint.h>
|
|
|
| -#include "skia/ext/skia_utils_base.h"
|
| #include "third_party/skia/include/core/SkFontLCDConfig.h"
|
| +#include "third_party/skia/src/core/SkReadBuffer.h"
|
|
|
| namespace skia {
|
|
|
| @@ -101,5 +103,25 @@ SkPixelGeometry ComputeDefaultPixelGeometry() {
|
| return gGeo[index];
|
| }
|
|
|
| +std::unique_ptr<SkDrawable> ReadDrawable(const char* buffer, size_t size) {
|
| + SkReadBuffer rBuffer(buffer, size);
|
| + rBuffer.setCustomFactory(SkString(SkFutureDrawable::kTypeName),
|
| + SkFutureDrawable::CreateProc);
|
| +
|
| + std::unique_ptr<SkDrawable> drawable(
|
| + (SkDrawable*)rBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
|
| + return drawable;
|
| +}
|
| +
|
| +std::vector<char> WriteDrawable(SkDrawable* drawable) {
|
| + SkBinaryWriteBuffer wBuffer;
|
| + wBuffer.writeFlattenable(drawable);
|
| + size_t size = wBuffer.bytesWritten();
|
| + std::vector<char> data;
|
| + data.resize(size);
|
| + wBuffer.writeToMemory(data.data());
|
| + return data;
|
| +}
|
| +
|
| } // namespace skia
|
|
|
|
|