Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: tools/debugger/SkJsonWriteBuffer.h

Issue 1911963008: DNC - JSON of flattenables, with field names. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add names to call sites Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/debugger/SkJsonWriteBuffer.h
diff --git a/tools/debugger/SkJsonWriteBuffer.h b/tools/debugger/SkJsonWriteBuffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..8e58546ef8a0d54dd005553e5ed1a50f828ae35f
--- /dev/null
+++ b/tools/debugger/SkJsonWriteBuffer.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2012 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 "SkCanvas.h"
+#include "SkTLazy.h"
+#include "SkPath.h"
+#include "SkRRect.h"
+#include "SkString.h"
+#include "SkTDArray.h"
+#include "SkJSONCPP.h"
+#include "UrlDataManager.h"
+
+class SkJsonWriteBuffer : public SkWriteBuffer {
+public:
+ SkJsonWriteBuffer() : fFieldCount(0) {}
+
+ void writeByteArray(const char* name, const void* data, size_t size) override;
+ void writeBool(const char* name, bool value) override;
+ void writeScalar(const char* name, SkScalar value) override;
+ void writeScalarArray(const char* name, const SkScalar* value, uint32_t count) override;
+ void writeInt(const char* name, int32_t value) override;
+ void writeIntArray(const char* name, const int32_t* value, uint32_t count) override;
+ void writeUInt(const char* name, uint32_t value) override;
+ void write32(const char* name, int32_t value) override;
+ void writeString(const char* name, const char* value) override;
+ void writeEncodedString(const char* name, const void* value, size_t byteLength,
+ SkPaint::TextEncoding encoding) override;
+ void writeFunctionPtr(const char* name, void* ptr) override;
+
+ void writeFlattenable(const char* name, const SkFlattenable* flattenable) override;
+ void writeColor(const char* name, const SkColor& color) override;
+ void writeColorArray(const char* name, const SkColor* color, uint32_t count) override;
+ void writePoint(const char* name, const SkPoint& point) override;
+ void writePointArray(const char* name, const SkPoint* point, uint32_t count) override;
+ void writeMatrix(const char* name, const SkMatrix& matrix) override;
+ void writeIRect(const char* name, const SkIRect& rect) override;
+ void writeRect(const char* name, const SkRect& rect) override;
+ void writeRegion(const char* name, const SkRegion& region) override;
+ void writePath(const char* name, const SkPath& path) override;
+ size_t writeStream(const char* name, SkStream* stream, size_t length) override;
+ void writeBitmap(const char* name, const SkBitmap& bitmap) override;
+ void writeImage(const char* name, const SkImage*) override;
+ void writeTypeface(const char* name, SkTypeface* typeface) override;
+ void writePaint(const char* name, const SkPaint& paint) override;
+
+ const Json::Value& getValue() const { return fJson; }
+
+private:
+ void append(const char* name, const Json::Value& value);
+
+ Json::Value fJson;
+ uint32_t fFieldCount;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698