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 SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag, | 51 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, info, 0, |
52 SkSurfaceProps::kLegacyFontHost_InitType); | 52 SkSurface::kDistanceFiel
d_TextRenderMode)); |
53 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, info, 0,
&props)); | |
54 SkCanvas* canvas = surface->getCanvas(); | 53 SkCanvas* canvas = surface->getCanvas(); |
55 #else | 54 #else |
56 SkCanvas* canvas = inputCanvas; | 55 SkCanvas* canvas = inputCanvas; |
57 #endif | 56 #endif |
58 canvas->clear(0xffffffff); | 57 canvas->clear(0xffffffff); |
59 | 58 |
60 SkPaint paint; | 59 SkPaint paint; |
61 paint.setAntiAlias(true); | 60 paint.setAntiAlias(true); |
62 paint.setSubpixelText(true); | 61 paint.setSubpixelText(true); |
63 #if !SK_SUPPORT_GPU | 62 #if !SK_SUPPORT_GPU |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 private: | 156 private: |
158 typedef GM INHERITED; | 157 typedef GM INHERITED; |
159 }; | 158 }; |
160 | 159 |
161 ////////////////////////////////////////////////////////////////////////////// | 160 ////////////////////////////////////////////////////////////////////////////// |
162 | 161 |
163 static GM* MyFactory(void*) { return new DFTextGM; } | 162 static GM* MyFactory(void*) { return new DFTextGM; } |
164 static GMRegistry reg(MyFactory); | 163 static GMRegistry reg(MyFactory); |
165 | 164 |
166 } | 165 } |
OLD | NEW |