From c8226728541fdd6434a7f1b97678246202b0edc5 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Wed, 13 Dec 2017 08:22:13 -0500 Subject: 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 Commit-Queue: Mike Reed --- tools/debugger/SkJsonWriteBuffer.cpp | 10 ++++++++++ tools/debugger/SkJsonWriteBuffer.h | 1 + 2 files changed, 11 insertions(+) (limited to 'tools') diff --git a/tools/debugger/SkJsonWriteBuffer.cpp b/tools/debugger/SkJsonWriteBuffer.cpp index bdabc8aea5..9a9a032d6b 100644 --- a/tools/debugger/SkJsonWriteBuffer.cpp +++ b/tools/debugger/SkJsonWriteBuffer.cpp @@ -15,6 +15,16 @@ void SkJsonWriteBuffer::append(const char* type, const Json::Value& value) { fJson[fullName.c_str()] = value; } +void SkJsonWriteBuffer::writePad32(const void* data, size_t size) { + Json::Value jsonArray(Json::arrayValue); + const uint8_t* bytes = reinterpret_cast(data); + for (size_t i = 0; i < size; ++i) { + SkString hexByte = SkStringPrintf("%02x", bytes[i]); + jsonArray.append(hexByte.c_str()); + } + this->append("rawBytes", jsonArray); +} + void SkJsonWriteBuffer::writeByteArray(const void* data, size_t size) { Json::Value jsonArray(Json::arrayValue); const uint8_t* bytes = reinterpret_cast(data); diff --git a/tools/debugger/SkJsonWriteBuffer.h b/tools/debugger/SkJsonWriteBuffer.h index c1a72313e0..efd896c989 100644 --- a/tools/debugger/SkJsonWriteBuffer.h +++ b/tools/debugger/SkJsonWriteBuffer.h @@ -23,6 +23,7 @@ public: bool isCrossProcess() const override { return false; } + void writePad32(const void* buffer, size_t bytes) override; void writeByteArray(const void* data, size_t size) override; void writeBool(bool value) override; void writeScalar(SkScalar value) override; -- cgit v1.2.3