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

Side by Side Diff: gm/verttext.cpp

Issue 815883002: Cleanup: Another round of override fixes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: revert include changes Created 6 years 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 | « gm/tilemodes_scaled.cpp ('k') | gm/verttext2.cpp » ('j') | 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 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 8
9 #include "gm.h" 9 #include "gm.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 { 46 {
47 } 47 }
48 48
49 //SkAutoTUnref<SkTypeface> fFace; 49 //SkAutoTUnref<SkTypeface> fFace;
50 50
51 protected: 51 protected:
52 virtual uint32_t onGetFlags() const SK_OVERRIDE { 52 virtual uint32_t onGetFlags() const SK_OVERRIDE {
53 return kSkipTiled_Flag; 53 return kSkipTiled_Flag;
54 } 54 }
55 55
56 SkString onShortName() { 56 SkString onShortName() SK_OVERRIDE {
57 return SkString("verttext"); 57 return SkString("verttext");
58 } 58 }
59 59
60 SkISize onISize() { return SkISize::Make(640, 480); } 60 SkISize onISize() SK_OVERRIDE { return SkISize::Make(640, 480); }
61 61
62 static void drawBaseline(SkCanvas* canvas, const SkPaint& paint, 62 static void drawBaseline(SkCanvas* canvas, const SkPaint& paint,
63 SkScalar x, SkScalar y) { 63 SkScalar x, SkScalar y) {
64 SkScalar total = paint.measureText(gText, gLen); 64 SkScalar total = paint.measureText(gText, gLen);
65 65
66 SkPaint p; 66 SkPaint p;
67 p.setAntiAlias(true); 67 p.setAntiAlias(true);
68 p.setColor(0x80FF0000); 68 p.setColor(0x80FF0000);
69 canvas->drawLine(x, y, 69 canvas->drawLine(x, y,
70 paint.isVerticalText() ? x : x + total, 70 paint.isVerticalText() ? x : x + total,
71 paint.isVerticalText() ? y + total : y, 71 paint.isVerticalText() ? y + total : y,
72 p); 72 p);
73 73
74 p.setColor(0xFF0000FF); 74 p.setColor(0xFF0000FF);
75 SkScalar adv[gLen]; 75 SkScalar adv[gLen];
76 int numChars = paint.getTextWidths(gText, gLen, adv, NULL); 76 int numChars = paint.getTextWidths(gText, gLen, adv, NULL);
77 for (int i = 0; i < numChars; ++i) { 77 for (int i = 0; i < numChars; ++i) {
78 canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p); 78 canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p);
79 if (paint.isVerticalText()) { 79 if (paint.isVerticalText()) {
80 y += adv[i]; 80 y += adv[i];
81 } else { 81 } else {
82 x += adv[i]; 82 x += adv[i];
83 } 83 }
84 } 84 }
85 canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p); 85 canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p);
86 } 86 }
87 87
88 virtual void onDraw(SkCanvas* canvas) { 88 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
89 SkScalar x = SkIntToScalar(100); 89 SkScalar x = SkIntToScalar(100);
90 SkScalar y = SkIntToScalar(50); 90 SkScalar y = SkIntToScalar(50);
91 91
92 for (int i = 0; i < 4; ++i) { 92 for (int i = 0; i < 4; ++i) {
93 SkPaint paint; 93 SkPaint paint;
94 paint.setAntiAlias(true); 94 paint.setAntiAlias(true);
95 paint.setTextSize(SkIntToScalar(TEXT_SIZE)); 95 paint.setTextSize(SkIntToScalar(TEXT_SIZE));
96 //paint.setTypeface(fFace); 96 //paint.setTypeface(fFace);
97 //paint.setFakeBoldText(true); 97 //paint.setFakeBoldText(true);
98 98
(...skipping 15 matching lines...) Expand all
114 private: 114 private:
115 typedef GM INHERITED; 115 typedef GM INHERITED;
116 }; 116 };
117 117
118 /////////////////////////////////////////////////////////////////////////////// 118 ///////////////////////////////////////////////////////////////////////////////
119 119
120 static GM* MyFactory(void*) { return new VertTextGM; } 120 static GM* MyFactory(void*) { return new VertTextGM; }
121 static GMRegistry reg(MyFactory); 121 static GMRegistry reg(MyFactory);
122 122
123 } 123 }
OLDNEW
« no previous file with comments | « gm/tilemodes_scaled.cpp ('k') | gm/verttext2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698