2016-05-04 18:06:28 +00:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
2019-01-28 18:41:19 +00:00
|
|
|
class SkJSONWriter;
|
2016-05-04 18:06:28 +00:00
|
|
|
class SkPath;
|
|
|
|
class UrlDataManager;
|
|
|
|
|
|
|
|
class SkJsonWriteBuffer final : public SkWriteBuffer {
|
|
|
|
public:
|
2019-01-28 18:41:19 +00:00
|
|
|
SkJsonWriteBuffer(SkJSONWriter* writer, UrlDataManager* urlDataManager)
|
2016-05-04 18:06:28 +00:00
|
|
|
: fUrlDataManager(urlDataManager)
|
2019-01-28 18:41:19 +00:00
|
|
|
, fWriter(writer)
|
|
|
|
, fCount(0) {}
|
2016-05-04 18:06:28 +00:00
|
|
|
|
2017-12-13 16:38:57 +00:00
|
|
|
void writePad32(const void* buffer, size_t bytes) override;
|
2016-05-04 18:06:28 +00:00
|
|
|
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;
|
2016-09-25 20:15:58 +00:00
|
|
|
void writeColor4f(const SkColor4f& color) override;
|
|
|
|
void writeColor4fArray(const SkColor4f* color, uint32_t count) override;
|
2016-05-04 18:06:28 +00:00
|
|
|
void writePoint(const SkPoint& point) override;
|
|
|
|
void writePointArray(const SkPoint* point, uint32_t count) override;
|
2018-08-22 13:26:33 +00:00
|
|
|
void writePoint3(const SkPoint3& point) override;
|
2016-05-04 18:06:28 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
private:
|
2019-01-28 18:41:19 +00:00
|
|
|
void append(const char* type);
|
2016-05-04 18:06:28 +00:00
|
|
|
|
|
|
|
UrlDataManager* fUrlDataManager;
|
2019-01-28 18:41:19 +00:00
|
|
|
SkJSONWriter* fWriter;
|
|
|
|
int fCount;
|
2016-05-04 18:06:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|