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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 SkScalar textSizes[] = { 11.0f, 11.0f*2.0f, 11.0f*5.0f, 11.0f*2.0f*5.0f
}; | 61 SkScalar textSizes[] = { 11.0f, 11.0f*2.0f, 11.0f*5.0f, 11.0f*2.0f*5.0f
}; |
62 #endif | 62 #endif |
63 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; | 63 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; |
64 | 64 |
65 // set up offscreen rendering with distance field text | 65 // set up offscreen rendering with distance field text |
66 #if SK_SUPPORT_GPU | 66 #if SK_SUPPORT_GPU |
67 GrContext* ctx = inputCanvas->getGrContext(); | 67 GrContext* ctx = inputCanvas->getGrContext(); |
68 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); | 68 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); |
69 SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag, | 69 SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag, |
70 SkSurfaceProps::kLegacyFontHost_InitType); | 70 SkSurfaceProps::kLegacyFontHost_InitType); |
71 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, info, 0,
&props)); | 71 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkSurfac
e::kNo_Budgeted, |
| 72 info, 0, &pro
ps)); |
72 SkCanvas* canvas = surface.get() ? surface->getCanvas() : inputCanvas; | 73 SkCanvas* canvas = surface.get() ? surface->getCanvas() : inputCanvas; |
73 // init our new canvas with the old canvas's matrix | 74 // init our new canvas with the old canvas's matrix |
74 canvas->setMatrix(inputCanvas->getTotalMatrix()); | 75 canvas->setMatrix(inputCanvas->getTotalMatrix()); |
75 #else | 76 #else |
76 SkCanvas* canvas = inputCanvas; | 77 SkCanvas* canvas = inputCanvas; |
77 #endif | 78 #endif |
78 // apply global scale to test glyph positioning | 79 // apply global scale to test glyph positioning |
79 canvas->scale(1.05f, 1.05f); | 80 canvas->scale(1.05f, 1.05f); |
80 canvas->clear(0xffffffff); | 81 canvas->clear(0xffffffff); |
81 | 82 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 #endif | 217 #endif |
217 } | 218 } |
218 | 219 |
219 private: | 220 private: |
220 SkTypeface* fTypeface; | 221 SkTypeface* fTypeface; |
221 | 222 |
222 typedef skiagm::GM INHERITED; | 223 typedef skiagm::GM INHERITED; |
223 }; | 224 }; |
224 | 225 |
225 DEF_GM( return SkNEW(DFTextGM); ) | 226 DEF_GM( return SkNEW(DFTextGM); ) |
OLD | NEW |