| 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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 for (int i = 0; i < count; i++) { | 93 for (int i = 0; i < count; i++) { |
| 94 SkPaint paint; | 94 SkPaint paint; |
| 95 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 95 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
| 96 paint.setTextSize(48); // draw big glyphs to really stress the atlas | 96 paint.setTextSize(48); // draw big glyphs to really stress the atlas |
| 97 | 97 |
| 98 SkString familyName; | 98 SkString familyName; |
| 99 fm->getFamilyName(i, &familyName); | 99 fm->getFamilyName(i, &familyName); |
| 100 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); | 100 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); |
| 101 for (int j = 0; j < set->count(); ++j) { | 101 for (int j = 0; j < set->count(); ++j) { |
| 102 SkFontStyle fs; | 102 SkFontStyle fs; |
| 103 set->getStyle(j, &fs, NULL); | 103 set->getStyle(j, &fs, nullptr); |
| 104 | 104 |
| 105 // We use a typeface which randomy returns unexpected mask formats t
o fuzz | 105 // We use a typeface which randomy returns unexpected mask formats t
o fuzz |
| 106 SkAutoTUnref<SkTypeface> orig(set->createTypeface(j)); | 106 SkAutoTUnref<SkTypeface> orig(set->createTypeface(j)); |
| 107 if (normal) { | 107 if (normal) { |
| 108 paint.setTypeface(orig); | 108 paint.setTypeface(orig); |
| 109 } else { | 109 } else { |
| 110 SkAutoTUnref<SkTypeface> typeface(new SkRandomTypeface(orig, pai
nt, true)); | 110 SkAutoTUnref<SkTypeface> typeface(new SkRandomTypeface(orig, pai
nt, true)); |
| 111 paint.setTypeface(typeface); | 111 paint.setTypeface(typeface); |
| 112 } | 112 } |
| 113 | 113 |
| 114 SkTextBlobBuilder builder; | 114 SkTextBlobBuilder builder; |
| 115 for (int aa = 0; aa < 2; aa++) { | 115 for (int aa = 0; aa < 2; aa++) { |
| 116 for (int subpixel = 0; subpixel < 2; subpixel++) { | 116 for (int subpixel = 0; subpixel < 2; subpixel++) { |
| 117 for (int lcd = 0; lcd < 2; lcd++) { | 117 for (int lcd = 0; lcd < 2; lcd++) { |
| 118 paint.setAntiAlias(SkToBool(aa)); | 118 paint.setAntiAlias(SkToBool(aa)); |
| 119 paint.setSubpixelText(SkToBool(subpixel)); | 119 paint.setSubpixelText(SkToBool(subpixel)); |
| 120 paint.setLCDRenderText(SkToBool(lcd)); | 120 paint.setLCDRenderText(SkToBool(lcd)); |
| 121 if (!SkToBool(lcd)) { | 121 if (!SkToBool(lcd)) { |
| 122 paint.setTextSize(160); | 122 paint.setTextSize(160); |
| 123 } | 123 } |
| 124 const SkTextBlobBuilder::RunBuffer& run = builder.allocR
un(paint, | 124 const SkTextBlobBuilder::RunBuffer& run = builder.allocR
un(paint, |
| 125
maxTotalText, | 125
maxTotalText, |
| 126
0, 0, | 126
0, 0, |
| 127
NULL); | 127
nullptr); |
| 128 memcpy(run.glyphs, text.get(), maxTotalText * sizeof(uin
t16_t)); | 128 memcpy(run.glyphs, text.get(), maxTotalText * sizeof(uin
t16_t)); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 SkNEW_APPEND_TO_TARRAY(&blobs, TextBlobWrapper, (builder.build())); | 132 SkNEW_APPEND_TO_TARRAY(&blobs, TextBlobWrapper, (builder.build())); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 // create surface where LCD is impossible | 136 // create surface where LCD is impossible |
| 137 info = SkImageInfo::MakeN32Premul(kWidth, kHeight); | 137 info = SkImageInfo::MakeN32Premul(kWidth, kHeight); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 DEF_GPUTEST(TextBlobAbnormal, reporter, factory) { | 171 DEF_GPUTEST(TextBlobAbnormal, reporter, factory) { |
| 172 text_blob_cache_inner(reporter, factory, 256, 256, 10, false, false); | 172 text_blob_cache_inner(reporter, factory, 256, 256, 10, false, false); |
| 173 } | 173 } |
| 174 | 174 |
| 175 DEF_GPUTEST(TextBlobStressAbnormal, reporter, factory) { | 175 DEF_GPUTEST(TextBlobStressAbnormal, reporter, factory) { |
| 176 text_blob_cache_inner(reporter, factory, 256, 256, 10, false, true); | 176 text_blob_cache_inner(reporter, factory, 256, 256, 10, false, true); |
| 177 } | 177 } |
| 178 #endif | 178 #endif |
| OLD | NEW |