| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkJsonWriteBuffer.h" | 8 #include "SkJsonWriteBuffer.h" |
| 9 | 9 |
| 10 #include "SkDrawCommand.h" | 10 #include "SkDrawCommand.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 void SkJsonWriteBuffer::writeColorArray(const SkColor* color, uint32_t count) { | 78 void SkJsonWriteBuffer::writeColorArray(const SkColor* color, uint32_t count) { |
| 79 Json::Value jsonArray(Json::arrayValue); | 79 Json::Value jsonArray(Json::arrayValue); |
| 80 for (uint32_t i = 0; i < count; ++i) { | 80 for (uint32_t i = 0; i < count; ++i) { |
| 81 jsonArray.append(SkDrawCommand::MakeJsonColor(color[i])); | 81 jsonArray.append(SkDrawCommand::MakeJsonColor(color[i])); |
| 82 } | 82 } |
| 83 this->append("colorArray", jsonArray); | 83 this->append("colorArray", jsonArray); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void SkJsonWriteBuffer::writeColor4f(const SkColor4f& color) { |
| 87 this->append("color", SkDrawCommand::MakeJsonColor4f(color)); |
| 88 } |
| 89 |
| 90 void SkJsonWriteBuffer::writeColor4fArray(const SkColor4f* color, uint32_t count
) { |
| 91 Json::Value jsonArray(Json::arrayValue); |
| 92 for (uint32_t i = 0; i < count; ++i) { |
| 93 jsonArray.append(SkDrawCommand::MakeJsonColor4f(color[i])); |
| 94 } |
| 95 this->append("colorArray", jsonArray); |
| 96 } |
| 97 |
| 86 void SkJsonWriteBuffer::writePoint(const SkPoint& point) { | 98 void SkJsonWriteBuffer::writePoint(const SkPoint& point) { |
| 87 this->append("point", SkDrawCommand::MakeJsonPoint(point)); | 99 this->append("point", SkDrawCommand::MakeJsonPoint(point)); |
| 88 } | 100 } |
| 89 | 101 |
| 90 void SkJsonWriteBuffer::writePointArray(const SkPoint* point, uint32_t count) { | 102 void SkJsonWriteBuffer::writePointArray(const SkPoint* point, uint32_t count) { |
| 91 Json::Value jsonArray(Json::arrayValue); | 103 Json::Value jsonArray(Json::arrayValue); |
| 92 for (uint32_t i = 0; i < count; ++i) { | 104 for (uint32_t i = 0; i < count; ++i) { |
| 93 jsonArray.append(SkDrawCommand::MakeJsonPoint(point[i])); | 105 jsonArray.append(SkDrawCommand::MakeJsonPoint(point[i])); |
| 94 } | 106 } |
| 95 this->append("pointArray", jsonArray); | 107 this->append("pointArray", jsonArray); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 147 } |
| 136 | 148 |
| 137 void SkJsonWriteBuffer::writeTypeface(SkTypeface* typeface) { | 149 void SkJsonWriteBuffer::writeTypeface(SkTypeface* typeface) { |
| 138 // Unsupported | 150 // Unsupported |
| 139 this->append("typeface", Json::Value()); | 151 this->append("typeface", Json::Value()); |
| 140 } | 152 } |
| 141 | 153 |
| 142 void SkJsonWriteBuffer::writePaint(const SkPaint& paint) { | 154 void SkJsonWriteBuffer::writePaint(const SkPaint& paint) { |
| 143 this->append("paint", SkDrawCommand::MakeJsonPaint(paint, *fUrlDataManager))
; | 155 this->append("paint", SkDrawCommand::MakeJsonPaint(paint, *fUrlDataManager))
; |
| 144 } | 156 } |
| OLD | NEW |