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

Side by Side Diff: gm/dftext.cpp

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make compatible with chrome Created 5 years, 11 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
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 "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
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
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); )
OLDNEW
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | gm/discard.cpp » ('j') | gm/xfermodes3.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698