2a3009931d
This reverts commit c822672854
.
Reason for revert: broke old skps
Original change's description:
> impl SkSerial picture procs
>
> The picture serialization code is a bit of a mess, with duplicated functions for streams and buffers.
> Could not see how to fix that and land this at the same time, but I will try to circle back and
> simplify if possible afterwards.
>
> Bug: skia:
> Change-Id: I9053fdc476c60f483df013d021e248258181c199
> Reviewed-on: https://skia-review.googlesource.com/83943
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>
TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com
Change-Id: I68ae019a286691b65cc373cb29c941d6620fd34a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/84460
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
62 lines
2.1 KiB
C++
62 lines
2.1 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 SkJsonWriteBuffer_DEFINED
|
|
#define SkJsonWriteBuffer_DEFINED
|
|
|
|
#include "SkWriteBuffer.h"
|
|
|
|
#include "SkJSONCPP.h"
|
|
|
|
class SkPath;
|
|
class UrlDataManager;
|
|
|
|
class SkJsonWriteBuffer final : public SkWriteBuffer {
|
|
public:
|
|
SkJsonWriteBuffer(UrlDataManager* urlDataManager)
|
|
: fUrlDataManager(urlDataManager)
|
|
, fJson(Json::objectValue) {}
|
|
|
|
bool isCrossProcess() const override { return false; }
|
|
|
|
void writeByteArray(const void* data, size_t size) override;
|
|
void writeBool(bool value) override;
|
|
void writeScalar(SkScalar value) override;
|
|
void writeScalarArray(const SkScalar* value, uint32_t count) override;
|
|
void writeInt(int32_t value) override;
|
|
void writeIntArray(const int32_t* value, uint32_t count) override;
|
|
void writeUInt(uint32_t value) override;
|
|
void writeString(const char* value) override;
|
|
|
|
void writeFlattenable(const SkFlattenable* flattenable) override;
|
|
void writeColor(SkColor color) override;
|
|
void writeColorArray(const SkColor* color, uint32_t count) override;
|
|
void writeColor4f(const SkColor4f& color) override;
|
|
void writeColor4fArray(const SkColor4f* color, uint32_t count) override;
|
|
void writePoint(const SkPoint& point) override;
|
|
void writePointArray(const SkPoint* point, uint32_t count) override;
|
|
void writeMatrix(const SkMatrix& matrix) override;
|
|
void writeIRect(const SkIRect& rect) override;
|
|
void writeRect(const SkRect& rect) override;
|
|
void writeRegion(const SkRegion& region) override;
|
|
void writePath(const SkPath& path) override;
|
|
size_t writeStream(SkStream* stream, size_t length) override;
|
|
void writeImage(const SkImage*) override;
|
|
void writeTypeface(SkTypeface* typeface) override;
|
|
void writePaint(const SkPaint& paint) override;
|
|
|
|
const Json::Value& getValue() const { return fJson; }
|
|
|
|
private:
|
|
void append(const char* type, const Json::Value& value);
|
|
|
|
UrlDataManager* fUrlDataManager;
|
|
Json::Value fJson;
|
|
};
|
|
|
|
#endif
|