aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/debugger
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-12-13 08:22:13 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-13 13:41:32 +0000
commitc8226728541fdd6434a7f1b97678246202b0edc5 (patch)
tree3443b3f2f2fb5408b3abe999390470ef0c35eff0 /tools/debugger
parent526c39f41f62f9ab82ebbeb30cc8762bb0eaa417 (diff)
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>
Diffstat (limited to 'tools/debugger')
-rw-r--r--tools/debugger/SkJsonWriteBuffer.cpp10
-rw-r--r--tools/debugger/SkJsonWriteBuffer.h1
2 files changed, 11 insertions, 0 deletions
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<const uint8_t*>(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<const uint8_t*>(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;