| OLD | NEW |
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 SkPaint p; | 63 SkPaint p; |
| 64 p.setAntiAlias(true); | 64 p.setAntiAlias(true); |
| 65 p.setColor(0x80FF0000); | 65 p.setColor(0x80FF0000); |
| 66 canvas->drawLine(x, y, | 66 canvas->drawLine(x, y, |
| 67 paint.isVerticalText() ? x : x + total, | 67 paint.isVerticalText() ? x : x + total, |
| 68 paint.isVerticalText() ? y + total : y, | 68 paint.isVerticalText() ? y + total : y, |
| 69 p); | 69 p); |
| 70 | 70 |
| 71 p.setColor(0xFF0000FF); | 71 p.setColor(0xFF0000FF); |
| 72 SkScalar adv[gLen]; | 72 SkScalar adv[gLen]; |
| 73 int numChars = paint.getTextWidths(gText, gLen, adv, NULL); | 73 int numChars = paint.getTextWidths(gText, gLen, adv, nullptr); |
| 74 for (int i = 0; i < numChars; ++i) { | 74 for (int i = 0; i < numChars; ++i) { |
| 75 canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p); | 75 canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p); |
| 76 if (paint.isVerticalText()) { | 76 if (paint.isVerticalText()) { |
| 77 y += adv[i]; | 77 y += adv[i]; |
| 78 } else { | 78 } else { |
| 79 x += adv[i]; | 79 x += adv[i]; |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p); | 82 canvas->drawCircle(x, y, SK_Scalar1 * 3 / 2, p); |
| 83 } | 83 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 111 private: | 111 private: |
| 112 typedef GM INHERITED; | 112 typedef GM INHERITED; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 /////////////////////////////////////////////////////////////////////////////// | 115 /////////////////////////////////////////////////////////////////////////////// |
| 116 | 116 |
| 117 static GM* MyFactory(void*) { return new VertTextGM; } | 117 static GM* MyFactory(void*) { return new VertTextGM; } |
| 118 static GMRegistry reg(MyFactory); | 118 static GMRegistry reg(MyFactory); |
| 119 | 119 |
| 120 } | 120 } |
| OLD | NEW |