| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "gm.h" | 8 #include "gm.h" |
| 9 | 9 |
| 10 #include "Resources.h" | 10 #include "Resources.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 SkAutoTUnref<SkTypeface> typeface(GetResourceAsTypeface("/fonts/HangingS
.ttf")); | 30 SkAutoTUnref<SkTypeface> typeface(GetResourceAsTypeface("/fonts/HangingS
.ttf")); |
| 31 SkTextBlobBuilder builder; | 31 SkTextBlobBuilder builder; |
| 32 | 32 |
| 33 // make textblob. To stress distance fields, we choose sizes appropriat
ely | 33 // make textblob. To stress distance fields, we choose sizes appropriat
ely |
| 34 SkPaint paint; | 34 SkPaint paint; |
| 35 paint.setAntiAlias(true); | 35 paint.setAntiAlias(true); |
| 36 paint.setSubpixelText(true); | 36 paint.setSubpixelText(true); |
| 37 paint.setLCDRenderText(true); | 37 paint.setLCDRenderText(true); |
| 38 paint.setTypeface(typeface); | 38 paint.setTypeface(typeface); |
| 39 | 39 |
| 40 const char* text = "Sk"; | 40 const char* text = "Skia"; |
| 41 | 41 |
| 42 // extra large | 42 // extra large |
| 43 paint.setTextSize(262); | 43 paint.setTextSize(262); |
| 44 | 44 |
| 45 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0); | 45 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0); |
| 46 | 46 |
| 47 // large | 47 // large |
| 48 SkRect bounds; | 48 SkRect bounds; |
| 49 paint.measureText(text, strlen(text), &bounds); | 49 paint.measureText(text, strlen(text), &bounds); |
| 50 SkScalar yOffset = bounds.height(); | 50 SkScalar yOffset = bounds.height(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 typedef GM INHERITED; | 182 typedef GM INHERITED; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 ////////////////////////////////////////////////////////////////////////////// | 185 ////////////////////////////////////////////////////////////////////////////// |
| 186 | 186 |
| 187 DEF_GM( return new TextBlobMixedSizes(false); ) | 187 DEF_GM( return new TextBlobMixedSizes(false); ) |
| 188 #if SK_SUPPORT_GPU | 188 #if SK_SUPPORT_GPU |
| 189 DEF_GM( return new TextBlobMixedSizes(true); ) | 189 DEF_GM( return new TextBlobMixedSizes(true); ) |
| 190 #endif | 190 #endif |
| 191 } | 191 } |
| OLD | NEW |