OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkDrawCommand.h" | 10 #include "SkDrawCommand.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod
ing())); | 668 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod
ing())); |
669 fInfo.push(SkObjectParser::ScalarToString(xpos[0], "XPOS: ")); | 669 fInfo.push(SkObjectParser::ScalarToString(xpos[0], "XPOS: ")); |
670 fInfo.push(SkObjectParser::ScalarToString(constY, "SkScalar constY: ")); | 670 fInfo.push(SkObjectParser::ScalarToString(constY, "SkScalar constY: ")); |
671 fInfo.push(SkObjectParser::PaintToString(paint)); | 671 fInfo.push(SkObjectParser::PaintToString(paint)); |
672 } | 672 } |
673 | 673 |
674 void SkDrawPosTextHCommand::execute(SkCanvas* canvas) const { | 674 void SkDrawPosTextHCommand::execute(SkCanvas* canvas) const { |
675 canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint); | 675 canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint); |
676 } | 676 } |
677 | 677 |
| 678 static const char* gPositioningLabels[] = { |
| 679 "kDefault_Positioning", |
| 680 "kHorizontal_Positioning", |
| 681 "kFull_Positioning", |
| 682 }; |
| 683 |
678 SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x,
SkScalar y, | 684 SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x,
SkScalar y, |
679 const SkPaint& paint) | 685 const SkPaint& paint) |
680 : INHERITED(kDrawTextBlob_OpType) | 686 : INHERITED(kDrawTextBlob_OpType) |
681 , fBlob(SkRef(blob)) | 687 , fBlob(SkRef(blob)) |
682 , fXPos(x) | 688 , fXPos(x) |
683 , fYPos(y) | 689 , fYPos(y) |
684 , fPaint(paint) { | 690 , fPaint(paint) { |
685 | 691 |
686 SkAutoTDelete<SkString> runsStr(new SkString); | 692 SkAutoTDelete<SkString> runsStr(new SkString); |
687 fInfo.push(SkObjectParser::ScalarToString(x, "XPOS: ")); | 693 fInfo.push(SkObjectParser::ScalarToString(x, "XPOS: ")); |
688 fInfo.push(SkObjectParser::ScalarToString(y, "YPOS: ")); | 694 fInfo.push(SkObjectParser::ScalarToString(y, "YPOS: ")); |
689 fInfo.push(SkObjectParser::RectToString(fBlob->bounds(), "Bounds: ")); | 695 fInfo.push(SkObjectParser::RectToString(fBlob->bounds(), "Bounds: ")); |
690 fInfo.push(runsStr); | 696 fInfo.push(runsStr); |
691 fInfo.push(SkObjectParser::PaintToString(paint)); | 697 fInfo.push(SkObjectParser::PaintToString(paint)); |
692 | 698 |
693 unsigned runs = 0; | 699 unsigned runs = 0; |
694 SkPaint runPaint(paint); | 700 SkPaint runPaint(paint); |
695 SkTextBlobRunIterator iter(blob); | 701 SkTextBlobRunIterator iter(blob); |
696 while (!iter.done()) { | 702 while (!iter.done()) { |
697 SkAutoTDelete<SkString> label(new SkString); | 703 SkAutoTDelete<SkString> tmpStr(new SkString); |
698 label->printf("==== Run [%d] ====", runs++); | 704 tmpStr->printf("==== Run [%d] ====", runs++); |
699 fInfo.push(label.release()); | 705 fInfo.push(tmpStr.release()); |
700 | 706 |
701 fInfo.push(SkObjectParser::IntToString(iter.glyphCount(), "GlyphCount: "
)); | 707 fInfo.push(SkObjectParser::IntToString(iter.glyphCount(), "GlyphCount: "
)); |
| 708 tmpStr.reset(new SkString("GlyphPositioning: ")); |
| 709 tmpStr->append(gPositioningLabels[iter.positioning()]); |
| 710 fInfo.push(tmpStr.release()); |
| 711 |
702 iter.applyFontToPaint(&runPaint); | 712 iter.applyFontToPaint(&runPaint); |
703 fInfo.push(SkObjectParser::PaintToString(runPaint)); | 713 fInfo.push(SkObjectParser::PaintToString(runPaint)); |
704 | 714 |
705 iter.next(); | 715 iter.next(); |
706 } | 716 } |
707 | 717 |
708 runsStr->printf("Runs: %d", runs); | 718 runsStr->printf("Runs: %d", runs); |
709 // runStr is owned by fInfo at this point. | 719 // runStr is owned by fInfo at this point. |
710 runsStr.release(); | 720 runsStr.release(); |
711 } | 721 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 980 |
971 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { | 981 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { |
972 fUserMatrix = userMatrix; | 982 fUserMatrix = userMatrix; |
973 } | 983 } |
974 | 984 |
975 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { | 985 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { |
976 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); | 986 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); |
977 canvas->setMatrix(temp); | 987 canvas->setMatrix(temp); |
978 } | 988 } |
979 | 989 |
OLD | NEW |