Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: gm/dftext.cpp

Issue 583773004: Revert of introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dm/DMGpuSupport.h ('k') | gm/image.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « dm/DMGpuSupport.h ('k') | gm/image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698