Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: src/utils/debugger/SkDrawCommand.cpp

Issue 1559883002: [SkDebugger] Display run glyph positioning modes (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698