| 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 #include "gm.h" | 7 #include "gm.h" |
| 8 #include "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkStream.h" | 10 #include "SkStream.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 canvas->drawText(text, textLen, 0, 0, paint); | 131 canvas->drawText(text, textLen, 0, 0, paint); |
| 132 y += paint.getFontMetrics(NULL)*scaleFactor; | 132 y += paint.getFontMetrics(NULL)*scaleFactor; |
| 133 } | 133 } |
| 134 | 134 |
| 135 // check pos text | 135 // check pos text |
| 136 { | 136 { |
| 137 SkAutoCanvasRestore acr(canvas, true); | 137 SkAutoCanvasRestore acr(canvas, true); |
| 138 | 138 |
| 139 canvas->scale(2.0f, 2.0f); | 139 canvas->scale(2.0f, 2.0f); |
| 140 | 140 |
| 141 SkAutoTArray<SkPoint> pos(textLen); | 141 SkAutoTArray<SkPoint> pos(SkToInt(textLen)); |
| 142 SkAutoTArray<SkScalar> widths(textLen); | 142 SkAutoTArray<SkScalar> widths(SkToInt(textLen)); |
| 143 paint.setTextSize(textSizes[0]); | 143 paint.setTextSize(textSizes[0]); |
| 144 | 144 |
| 145 paint.getTextWidths(text, textLen, &widths[0]); | 145 paint.getTextWidths(text, textLen, &widths[0]); |
| 146 | 146 |
| 147 SkScalar x = SkIntToScalar(340); | 147 SkScalar x = SkIntToScalar(340); |
| 148 SkScalar y = SkIntToScalar(75); | 148 SkScalar y = SkIntToScalar(75); |
| 149 for (unsigned int i = 0; i < textLen; ++i) { | 149 for (unsigned int i = 0; i < textLen; ++i) { |
| 150 pos[i].set(x, y); | 150 pos[i].set(x, y); |
| 151 x += widths[i]; | 151 x += widths[i]; |
| 152 } | 152 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 #endif | 216 #endif |
| 217 } | 217 } |
| 218 | 218 |
| 219 private: | 219 private: |
| 220 SkTypeface* fTypeface; | 220 SkTypeface* fTypeface; |
| 221 | 221 |
| 222 typedef skiagm::GM INHERITED; | 222 typedef skiagm::GM INHERITED; |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 DEF_GM( return SkNEW(DFTextGM); ) | 225 DEF_GM( return SkNEW(DFTextGM); ) |
| OLD | NEW |