Index: bench/nanobench.cpp |
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp |
index 31b69fa6e2bbc4e672ea0a5f99cc8d19a615a37e..09bd0ce3da7b7b161cb1faa74675017d9e73e1e8 100644 |
--- a/bench/nanobench.cpp |
+++ b/bench/nanobench.cpp |
@@ -277,8 +277,10 @@ struct Config { |
int samples; |
#if SK_SUPPORT_GPU |
GrContextFactory::GLContextType ctxType; |
+ bool useDFText; |
#else |
int bogusInt; |
+ bool bogusBool; |
#endif |
}; |
@@ -321,10 +323,11 @@ static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT |
// Append all configs that are enabled and supported. |
static void create_configs(SkTDArray<Config>* configs) { |
- #define CPU_CONFIG(name, backend, color, alpha) \ |
- if (is_cpu_config_allowed(#name)) { \ |
- Config config = { #name, Benchmark::backend, color, alpha, 0, kBogusGLContextType }; \ |
- configs->push(config); \ |
+ #define CPU_CONFIG(name, backend, color, alpha) \ |
+ if (is_cpu_config_allowed(#name)) { \ |
+ Config config = { #name, Benchmark::backend, color, alpha, 0, \ |
+ kBogusGLContextType, false }; \ |
+ configs->push(config); \ |
} |
if (FLAGS_cpu) { |
@@ -334,7 +337,7 @@ static void create_configs(SkTDArray<Config>* configs) { |
} |
#if SK_SUPPORT_GPU |
- #define GPU_CONFIG(name, ctxType, samples) \ |
+ #define GPU_CONFIG(name, ctxType, samples, useDFText) \ |
if (is_gpu_config_allowed(#name, GrContextFactory::ctxType, samples)) { \ |
Config config = { \ |
#name, \ |
@@ -342,20 +345,22 @@ static void create_configs(SkTDArray<Config>* configs) { |
kN32_SkColorType, \ |
kPremul_SkAlphaType, \ |
samples, \ |
- GrContextFactory::ctxType }; \ |
+ GrContextFactory::ctxType, \ |
+ useDFText }; \ |
configs->push(config); \ |
} |
if (FLAGS_gpu) { |
- GPU_CONFIG(gpu, kNative_GLContextType, 0) |
- GPU_CONFIG(msaa4, kNative_GLContextType, 4) |
- GPU_CONFIG(msaa16, kNative_GLContextType, 16) |
- GPU_CONFIG(nvprmsaa4, kNVPR_GLContextType, 4) |
- GPU_CONFIG(nvprmsaa16, kNVPR_GLContextType, 16) |
- GPU_CONFIG(debug, kDebug_GLContextType, 0) |
- GPU_CONFIG(nullgpu, kNull_GLContextType, 0) |
+ GPU_CONFIG(gpu, kNative_GLContextType, 0, false) |
+ GPU_CONFIG(msaa4, kNative_GLContextType, 4, false) |
+ GPU_CONFIG(msaa16, kNative_GLContextType, 16, false) |
+ GPU_CONFIG(nvprmsaa4, kNVPR_GLContextType, 4, false) |
+ GPU_CONFIG(nvprmsaa16, kNVPR_GLContextType, 16, false) |
+ GPU_CONFIG(gpudft, kNative_GLContextType, 0, true) |
+ GPU_CONFIG(debug, kDebug_GLContextType, 0, false) |
+ GPU_CONFIG(nullgpu, kNull_GLContextType, 0, false) |
#ifdef SK_ANGLE |
- GPU_CONFIG(angle, kANGLE_GLContextType, 0) |
+ GPU_CONFIG(angle, kANGLE_GLContextType, 0, false) |
#endif |
} |
#endif |
@@ -377,8 +382,10 @@ static Target* is_enabled(Benchmark* bench, const Config& config) { |
} |
#if SK_SUPPORT_GPU |
else if (Benchmark::kGPU_Backend == config.backend) { |
+ uint32_t flags = config.useDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0; |
+ SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
target->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(config.ctxType), info, |
- config.samples)); |
+ config.samples, &props)); |
target->gl = gGrFactory->getGLContext(config.ctxType); |
} |
#endif |