OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef SkJsonWriteBuffer_DEFINED |
| 9 #define SkJsonWriteBuffer_DEFINED |
| 10 |
| 11 #include "SkWriteBuffer.h" |
| 12 |
| 13 #include "SkJSONCPP.h" |
| 14 |
| 15 class SkPath; |
| 16 class UrlDataManager; |
| 17 |
| 18 class SkJsonWriteBuffer final : public SkWriteBuffer { |
| 19 public: |
| 20 SkJsonWriteBuffer(UrlDataManager* urlDataManager) |
| 21 : fUrlDataManager(urlDataManager) |
| 22 , fJson(Json::objectValue) {} |
| 23 |
| 24 bool isCrossProcess() const override { return false; } |
| 25 |
| 26 void writeByteArray(const void* data, size_t size) override; |
| 27 void writeBool(bool value) override; |
| 28 void writeScalar(SkScalar value) override; |
| 29 void writeScalarArray(const SkScalar* value, uint32_t count) override; |
| 30 void writeInt(int32_t value) override; |
| 31 void writeIntArray(const int32_t* value, uint32_t count) override; |
| 32 void writeUInt(uint32_t value) override; |
| 33 void writeString(const char* value) override; |
| 34 |
| 35 void writeFlattenable(const SkFlattenable* flattenable) override; |
| 36 void writeColor(SkColor color) override; |
| 37 void writeColorArray(const SkColor* color, uint32_t count) override; |
| 38 void writePoint(const SkPoint& point) override; |
| 39 void writePointArray(const SkPoint* point, uint32_t count) override; |
| 40 void writeMatrix(const SkMatrix& matrix) override; |
| 41 void writeIRect(const SkIRect& rect) override; |
| 42 void writeRect(const SkRect& rect) override; |
| 43 void writeRegion(const SkRegion& region) override; |
| 44 void writePath(const SkPath& path) override; |
| 45 size_t writeStream(SkStream* stream, size_t length) override; |
| 46 void writeBitmap(const SkBitmap& bitmap) override; |
| 47 void writeImage(const SkImage*) override; |
| 48 void writeTypeface(SkTypeface* typeface) override; |
| 49 void writePaint(const SkPaint& paint) override; |
| 50 |
| 51 const Json::Value& getValue() const { return fJson; } |
| 52 |
| 53 private: |
| 54 void append(const char* type, const Json::Value& value); |
| 55 |
| 56 UrlDataManager* fUrlDataManager; |
| 57 Json::Value fJson; |
| 58 }; |
| 59 |
| 60 #endif |
OLD | NEW |