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 "SkJSONCanvas.h" | 8 #include "SkJSONCanvas.h" |
9 #include "SkImageFilter.h" | 9 #include "SkImageFilter.h" |
10 #include "SkMaskFilter.h" | 10 #include "SkMaskFilter.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 default: | 526 default: |
527 this->didSetMatrix(this->getTotalMatrix()); | 527 this->didSetMatrix(this->getTotalMatrix()); |
528 return; | 528 return; |
529 } | 529 } |
530 fCommands.append(command); | 530 fCommands.append(command); |
531 } | 531 } |
532 | 532 |
533 void SkJSONCanvas::didSetMatrix(const SkMatrix& matrix) { | 533 void SkJSONCanvas::didSetMatrix(const SkMatrix& matrix) { |
534 Json::Value command(Json::objectValue); | 534 Json::Value command(Json::objectValue); |
535 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_MATRIX); | 535 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_MATRIX); |
536 command[SKJSONCANVAS_ATTRIBUTE_MATRIX] = this->makeMatrix(matrix); | 536 command[SKJSONCANVAS_ATTRIBUTE_MATRIX] = this->MakeMatrix(matrix); |
537 fCommands.append(command); | 537 fCommands.append(command); |
538 } | 538 } |
539 | 539 |
540 void SkJSONCanvas::onDrawPaint(const SkPaint& paint) { | 540 void SkJSONCanvas::onDrawPaint(const SkPaint& paint) { |
541 Json::Value command(Json::objectValue); | 541 Json::Value command(Json::objectValue); |
542 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_PAINT); | 542 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_PAINT); |
543 command[SKJSONCANVAS_ATTRIBUTE_PAINT] = this->makePaint(paint); | 543 command[SKJSONCANVAS_ATTRIBUTE_PAINT] = this->makePaint(paint); |
544 fCommands.append(command); | 544 fCommands.append(command); |
545 } | 545 } |
546 | 546 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 741 |
742 void SkJSONCanvas::onDrawTextOnPath(const void* text, size_t byteLength, | 742 void SkJSONCanvas::onDrawTextOnPath(const void* text, size_t byteLength, |
743 const SkPath& path, const SkMatrix* matrix, | 743 const SkPath& path, const SkMatrix* matrix, |
744 const SkPaint& paint) { | 744 const SkPaint& paint) { |
745 Json::Value command(Json::objectValue); | 745 Json::Value command(Json::objectValue); |
746 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_TEXTONPATH)
; | 746 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_TEXTONPATH)
; |
747 command[SKJSONCANVAS_ATTRIBUTE_TEXT] = Json::Value((const char*) text, | 747 command[SKJSONCANVAS_ATTRIBUTE_TEXT] = Json::Value((const char*) text, |
748 ((const char*) text) + by
teLength); | 748 ((const char*) text) + by
teLength); |
749 command[SKJSONCANVAS_ATTRIBUTE_PATH] = this->makePath(path); | 749 command[SKJSONCANVAS_ATTRIBUTE_PATH] = this->makePath(path); |
750 if (matrix != nullptr) { | 750 if (matrix != nullptr) { |
751 command[SKJSONCANVAS_ATTRIBUTE_MATRIX] = this->makeMatrix(*matrix); | 751 command[SKJSONCANVAS_ATTRIBUTE_MATRIX] = this->MakeMatrix(*matrix); |
752 } | 752 } |
753 command[SKJSONCANVAS_ATTRIBUTE_PAINT] = this->makePaint(paint); | 753 command[SKJSONCANVAS_ATTRIBUTE_PAINT] = this->makePaint(paint); |
754 fCommands.append(command); | 754 fCommands.append(command); |
755 } | 755 } |
756 | 756 |
757 void SkJSONCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y
, | 757 void SkJSONCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y
, |
758 const SkPaint& paint) { | 758 const SkPaint& paint) { |
759 SkDebugf("unsupported: drawTextBlob\n"); | 759 SkDebugf("unsupported: drawTextBlob\n"); |
760 Json::Value command(Json::objectValue); | 760 Json::Value command(Json::objectValue); |
761 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_TEXTBLOB); | 761 command[SKJSONCANVAS_COMMAND] = Json::Value(SKJSONCANVAS_COMMAND_TEXTBLOB); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 Json::Value backdrop; | 838 Json::Value backdrop; |
839 flatten(rec.fBackdrop, &backdrop, fSendBinaries); | 839 flatten(rec.fBackdrop, &backdrop, fSendBinaries); |
840 command[SKJSONCANVAS_ATTRIBUTE_BACKDROP] = backdrop; | 840 command[SKJSONCANVAS_ATTRIBUTE_BACKDROP] = backdrop; |
841 } | 841 } |
842 if (rec.fSaveLayerFlags != 0) { | 842 if (rec.fSaveLayerFlags != 0) { |
843 SkDebugf("unsupported: saveLayer flags\n"); | 843 SkDebugf("unsupported: saveLayer flags\n"); |
844 } | 844 } |
845 fCommands.append(command); | 845 fCommands.append(command); |
846 return this->INHERITED::getSaveLayerStrategy(rec); | 846 return this->INHERITED::getSaveLayerStrategy(rec); |
847 } | 847 } |
OLD | NEW |