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 /* Tests text rendering with LCD and subpixel rendering turned on and off. | 9 /* Tests text rendering with LCD and subpixel rendering turned on and off. |
10 */ | 10 */ |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 paint.setTextSize(20); | 138 paint.setTextSize(20); |
139 | 139 |
140 canvas->drawText("Hamburgefons", 12, 30, 30, paint); | 140 canvas->drawText("Hamburgefons", 12, 30, 30, paint); |
141 | 141 |
142 const bool gPreserveLCDText[] = { false, true }; | 142 const bool gPreserveLCDText[] = { false, true }; |
143 | 143 |
144 canvas->translate(0, 20); | 144 canvas->translate(0, 20); |
145 for (auto preserve : gPreserveLCDText) { | 145 for (auto preserve : gPreserveLCDText) { |
146 preserve ? canvas->saveLayerPreserveLCDTextRequests(nullptr, nullptr) | 146 preserve ? canvas->saveLayerPreserveLCDTextRequests(nullptr, nullptr) |
147 : canvas->saveLayer(nullptr, nullptr); | 147 : canvas->saveLayer(nullptr, nullptr); |
148 canvas->drawText("Hamburgefons", 12, 30, 60, paint); | 148 if (preserve) { |
| 149 SkPaint noLCD = paint; |
| 150 noLCD.setLCDRenderText(false); |
| 151 canvas->drawText("LCD not supported", 17, 30, 60, noLCD); |
| 152 } else { |
| 153 canvas->drawText("Hamburgefons", 12, 30, 60, paint); |
| 154 } |
149 | 155 |
150 SkPaint p; | 156 SkPaint p; |
151 p.setColor(0xFFCCCCCC); | 157 p.setColor(0xFFCCCCCC); |
152 canvas->drawRect(SkRect::MakeLTRB(25, 70, 200, 100), p); | 158 canvas->drawRect(SkRect::MakeLTRB(25, 70, 200, 100), p); |
153 canvas->drawText("Hamburgefons", 12, 30, 90, paint); | 159 canvas->drawText("Hamburgefons", 12, 30, 90, paint); |
154 | 160 |
155 canvas->restore(); | 161 canvas->restore(); |
156 canvas->translate(0, 80); | 162 canvas->translate(0, 80); |
157 } | 163 } |
158 } | 164 } |
OLD | NEW |