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