| Index: tools/debugger/SkDrawCommand.cpp
|
| diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
|
| index 985f7d5cc3705de219d2b7620e69e1fd0456b941..bc0161e2678aa989befdff6f6fc5a9eaf48a0f02 100644
|
| --- a/tools/debugger/SkDrawCommand.cpp
|
| +++ b/tools/debugger/SkDrawCommand.cpp
|
| @@ -12,6 +12,7 @@
|
| #include "SkColorFilter.h"
|
| #include "SkDashPathEffect.h"
|
| #include "SkImageFilter.h"
|
| +#include "SkJsonWriteBuffer.h"
|
| #include "SkMaskFilter.h"
|
| #include "SkObjectParser.h"
|
| #include "SkPaintDefaults.h"
|
| @@ -63,6 +64,7 @@
|
| #define SKDEBUGCANVAS_ATTRIBUTE_VERBS "verbs"
|
| #define SKDEBUGCANVAS_ATTRIBUTE_NAME "name"
|
| #define SKDEBUGCANVAS_ATTRIBUTE_DATA "data"
|
| +#define SKDEBUGCANVAS_ATTRIBUTE_VALUES "values"
|
| #define SKDEBUGCANVAS_ATTRIBUTE_SHADER "shader"
|
| #define SKDEBUGCANVAS_ATTRIBUTE_PATHEFFECT "pathEffect"
|
| #define SKDEBUGCANVAS_ATTRIBUTE_MASKFILTER "maskFilter"
|
| @@ -592,7 +594,7 @@ static void encode_data(const void* bytes, size_t count, const char* contentType
|
|
|
| static void flatten(const SkFlattenable* flattenable, Json::Value* target,
|
| UrlDataManager& urlDataManager) {
|
| - SkWriteBuffer buffer;
|
| + SkBinaryWriteBuffer buffer;
|
| flattenable->flatten(buffer);
|
| void* data = sk_malloc_throw(buffer.bytesWritten());
|
| buffer.writeToMemory(data);
|
| @@ -601,6 +603,11 @@ static void flatten(const SkFlattenable* flattenable, Json::Value* target,
|
| Json::Value jsonFlattenable;
|
| jsonFlattenable[SKDEBUGCANVAS_ATTRIBUTE_NAME] = Json::Value(flattenable->getTypeName());
|
| jsonFlattenable[SKDEBUGCANVAS_ATTRIBUTE_DATA] = jsonData;
|
| +
|
| + SkJsonWriteBuffer jsonBuffer(&urlDataManager);
|
| + flattenable->flatten(jsonBuffer);
|
| + jsonFlattenable[SKDEBUGCANVAS_ATTRIBUTE_VALUES] = jsonBuffer.getValue();
|
| +
|
| (*target) = jsonFlattenable;
|
| sk_free(data);
|
| }
|
| @@ -643,8 +650,8 @@ void SkDrawCommand::WritePNG(const png_bytep rgba, png_uint_32 width, png_uint_3
|
| sk_free(pixels);
|
| }
|
|
|
| -static bool SK_WARN_UNUSED_RESULT flatten(const SkImage& image, Json::Value* target,
|
| - UrlDataManager& urlDataManager) {
|
| +bool SK_WARN_UNUSED_RESULT flatten(const SkImage& image, Json::Value* target,
|
| + UrlDataManager& urlDataManager) {
|
| size_t rowBytes = 4 * image.width();
|
| SkAutoFree buffer(sk_malloc_throw(rowBytes * image.height()));
|
| SkImageInfo dstInfo = SkImageInfo::Make(image.width(), image.height(),
|
| @@ -815,8 +822,8 @@ static sk_sp<SkImage> load_image(const Json::Value& jsonImage, UrlDataManager& u
|
| return result;
|
| }
|
|
|
| -static bool SK_WARN_UNUSED_RESULT flatten(const SkBitmap& bitmap, Json::Value* target,
|
| - UrlDataManager& urlDataManager) {
|
| +bool SK_WARN_UNUSED_RESULT flatten(const SkBitmap& bitmap, Json::Value* target,
|
| + UrlDataManager& urlDataManager) {
|
| bitmap.lockPixels();
|
| sk_sp<SkImage> image(SkImage::MakeFromBitmap(bitmap));
|
| bitmap.unlockPixels();
|
|
|