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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 #else | 189 #else |
190 paint.setTextSize(SkIntToScalar(22)); | 190 paint.setTextSize(SkIntToScalar(22)); |
191 #endif | 191 #endif |
192 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { | 192 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { |
193 paint.setColor(fg[i]); | 193 paint.setColor(fg[i]); |
194 | 194 |
195 canvas->drawText(text, textLen, x, y, paint); | 195 canvas->drawText(text, textLen, x, y, paint); |
196 y += paint.getFontMetrics(NULL); | 196 y += paint.getFontMetrics(NULL); |
197 } | 197 } |
198 | 198 |
| 199 // check skew |
| 200 { |
| 201 paint.setLCDRenderText(false); |
| 202 SkAutoCanvasRestore acr(canvas, true); |
| 203 canvas->skew(0.0f, 0.151515f); |
| 204 paint.setTextSize(32); |
| 205 canvas->drawText(text, textLen, 745, 70, paint); |
| 206 } |
| 207 { |
| 208 paint.setLCDRenderText(true); |
| 209 SkAutoCanvasRestore acr(canvas, true); |
| 210 canvas->skew(0.5f, 0.0f); |
| 211 paint.setTextSize(32); |
| 212 canvas->drawText(text, textLen, 580, 230, paint); |
| 213 } |
| 214 |
199 // check color emoji | 215 // check color emoji |
200 paint.setTypeface(fTypeface); | 216 paint.setTypeface(fTypeface); |
201 canvas->drawText(text, textLen, 670, 100, paint); | 217 canvas->drawText(text, textLen, 670, 100, paint); |
202 | 218 |
203 #if SK_SUPPORT_GPU | 219 #if SK_SUPPORT_GPU |
204 // render offscreen buffer | 220 // render offscreen buffer |
205 if (surface) { | 221 if (surface) { |
206 SkAutoCanvasRestore acr(inputCanvas, true); | 222 SkAutoCanvasRestore acr(inputCanvas, true); |
207 // since we prepended this matrix already, we blit using identity | 223 // since we prepended this matrix already, we blit using identity |
208 inputCanvas->resetMatrix(); | 224 inputCanvas->resetMatrix(); |
209 SkImage* image = surface->newImageSnapshot(); | 225 SkImage* image = surface->newImageSnapshot(); |
210 inputCanvas->drawImage(image, 0, 0, NULL); | 226 inputCanvas->drawImage(image, 0, 0, NULL); |
211 image->unref(); | 227 image->unref(); |
212 } | 228 } |
213 #endif | 229 #endif |
214 } | 230 } |
215 | 231 |
216 private: | 232 private: |
217 SkTypeface* fTypeface; | 233 SkTypeface* fTypeface; |
218 | 234 |
219 typedef skiagm::GM INHERITED; | 235 typedef skiagm::GM INHERITED; |
220 }; | 236 }; |
221 | 237 |
222 DEF_GM( return SkNEW(DFTextGM); ) | 238 DEF_GM( return SkNEW(DFTextGM); ) |
OLD | NEW |