| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 /* Tests text rendering with LCD and subpixel rendering turned on and off. | 10 /* Tests text rendering with LCD and subpixel rendering turned on and off. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 drawText(canvas, SkString("TEXT: SubpixelFalse LCDRenderFalse"), | 42 drawText(canvas, SkString("TEXT: SubpixelFalse LCDRenderFalse"), |
| 43 false, false); | 43 false, false); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void drawText(SkCanvas* canvas, const SkString& string, | 46 void drawText(SkCanvas* canvas, const SkString& string, |
| 47 bool subpixelTextEnabled, bool lcdRenderTextEnabled) { | 47 bool subpixelTextEnabled, bool lcdRenderTextEnabled) { |
| 48 SkPaint paint; | 48 SkPaint paint; |
| 49 paint.setColor(SK_ColorBLACK); | 49 paint.setColor(SK_ColorBLACK); |
| 50 paint.setDither(true); | 50 paint.setDither(true); |
| 51 paint.setAntiAlias(true); | 51 paint.setAntiAlias(true); |
| 52 sk_tool_utils::set_portable_typeface(&paint); |
| 52 paint.setSubpixelText(subpixelTextEnabled); | 53 paint.setSubpixelText(subpixelTextEnabled); |
| 53 paint.setLCDRenderText(lcdRenderTextEnabled); | 54 paint.setLCDRenderText(lcdRenderTextEnabled); |
| 54 paint.setTextSize(textHeight); | 55 paint.setTextSize(textHeight); |
| 55 | 56 |
| 56 canvas->drawText(string.c_str(), string.size(), 0, y, paint); | 57 canvas->drawText(string.c_str(), string.size(), 0, y, paint); |
| 57 y += textHeight; | 58 y += textHeight; |
| 58 } | 59 } |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 typedef GM INHERITED; | 62 typedef GM INHERITED; |
| 62 SkScalar y, textHeight; | 63 SkScalar y, textHeight; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 /////////////////////////////////////////////////////////////////////////////// | 66 /////////////////////////////////////////////////////////////////////////////// |
| 66 | 67 |
| 67 static GM* MyFactory(void*) { return new LcdTextGM; } | 68 static GM* MyFactory(void*) { return new LcdTextGM; } |
| 68 static GMRegistry reg(MyFactory); | 69 static GMRegistry reg(MyFactory); |
| 69 | 70 |
| 70 } | 71 } |
| OLD | NEW |