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 "SkSurface.h" | 8 #include "SkSurface.h" |
9 #include "SkTypeface.h" | 9 #include "SkTypeface.h" |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 virtual void onDraw(SkCanvas* inputCanvas) { | 43 virtual void onDraw(SkCanvas* inputCanvas) { |
44 SkScalar textSizes[] = { 11.0f, 11.0f*2.0f, 11.0f*5.0f, 11.0f*2.0f*5.0f
}; | 44 SkScalar textSizes[] = { 11.0f, 11.0f*2.0f, 11.0f*5.0f, 11.0f*2.0f*5.0f
}; |
45 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; | 45 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; |
46 | 46 |
47 // set up offscreen rendering with distance field text | 47 // set up offscreen rendering with distance field text |
48 #if SK_SUPPORT_GPU | 48 #if SK_SUPPORT_GPU |
49 GrContext* ctx = inputCanvas->getGrContext(); | 49 GrContext* ctx = inputCanvas->getGrContext(); |
50 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); | 50 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); |
51 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, info, 0, | 51 SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag, |
52 SkSurface::kDistanceFiel
d_TextRenderMode)); | 52 SkSurfaceProps::kLegacyFontHost_InitType); |
| 53 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, info, 0,
&props)); |
53 SkCanvas* canvas = surface->getCanvas(); | 54 SkCanvas* canvas = surface->getCanvas(); |
54 #else | 55 #else |
55 SkCanvas* canvas = inputCanvas; | 56 SkCanvas* canvas = inputCanvas; |
56 #endif | 57 #endif |
57 canvas->clear(0xffffffff); | 58 canvas->clear(0xffffffff); |
58 | 59 |
59 SkPaint paint; | 60 SkPaint paint; |
60 paint.setAntiAlias(true); | 61 paint.setAntiAlias(true); |
61 paint.setSubpixelText(true); | 62 paint.setSubpixelText(true); |
62 #if !SK_SUPPORT_GPU | 63 #if !SK_SUPPORT_GPU |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 private: | 157 private: |
157 typedef GM INHERITED; | 158 typedef GM INHERITED; |
158 }; | 159 }; |
159 | 160 |
160 ////////////////////////////////////////////////////////////////////////////// | 161 ////////////////////////////////////////////////////////////////////////////// |
161 | 162 |
162 static GM* MyFactory(void*) { return new DFTextGM; } | 163 static GM* MyFactory(void*) { return new DFTextGM; } |
163 static GMRegistry reg(MyFactory); | 164 static GMRegistry reg(MyFactory); |
164 | 165 |
165 } | 166 } |
OLD | NEW |