diff options
author | jvanverth <jvanverth@google.com> | 2014-11-06 13:38:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-06 13:38:52 -0800 |
commit | 06ba179838ba4fe187cf290750aeeb4a02a2960b (patch) | |
tree | 1e77099a7fe0905ee476d5934ab57d1e71a76f73 /tools | |
parent | 2c93efeb6f2dd652eb2575c04124d82952f020c7 (diff) |
Get gpudft support working in dm, gm, nanobench and bench_pictures
Adds a new config to test distance field text.
Clean up some flags and #defines to read "distance field text",
not "distance field fonts" to be consistent with Chromium
NOTREECHECKS=true
Review URL: https://codereview.chromium.org/699453005
Diffstat (limited to 'tools')
-rw-r--r-- | tools/PictureRenderer.cpp | 4 | ||||
-rw-r--r-- | tools/PictureRenderer.h | 10 | ||||
-rw-r--r-- | tools/PictureRenderingFlags.cpp | 8 | ||||
-rw-r--r-- | tools/flags/SkCommonFlags.cpp | 2 |
4 files changed, 21 insertions, 3 deletions
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp index e4a69986db..1c31e6865a 100644 --- a/tools/PictureRenderer.cpp +++ b/tools/PictureRenderer.cpp @@ -161,8 +161,10 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) { return NULL; } + uint32_t flags = fUseDFText ? SkGpuDevice::kDFText_Flag : 0; SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(target, - SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType))); + SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType), + flags)); canvas = SkNEW_ARGS(SkCanvas, (device.get())); break; } diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h index e82eb7fb8a..c8462d9f03 100644 --- a/tools/PictureRenderer.h +++ b/tools/PictureRenderer.h @@ -220,6 +220,10 @@ public: void setSampleCount(int sampleCount) { fSampleCount = sampleCount; } + + void setUseDFText(bool useDFText) { + fUseDFText = useDFText; + } #endif void setDrawFilters(DrawFilterFlags const * const filters, const SkString& configName) { @@ -274,6 +278,8 @@ public: case kGPU_DeviceType: if (fSampleCount) { config.appendf("_msaa%d", fSampleCount); + } else if (fUseDFText) { + config.append("_gpudft"); } else { config.append("_gpu"); } @@ -325,6 +331,8 @@ public: tmp = "msaa"; tmp.appendS32(fSampleCount); result["config"] = tmp.c_str(); + } else if (fUseDFText) { + result["config"] = "gpudft"; } else { result["config"] = "gpu"; } @@ -428,6 +436,7 @@ public: , fGrContextFactory(opts) , fGrContext(NULL) , fSampleCount(0) + , fUseDFText(false) #endif { fGridInfo.fMargin.setEmpty(); @@ -495,6 +504,7 @@ private: GrContextFactory fGrContextFactory; GrContext* fGrContext; int fSampleCount; + bool fUseDFText; #endif virtual SkString getConfigNameInternal() = 0; diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp index d78229acce..ac72cad4c2 100644 --- a/tools/PictureRenderingFlags.cpp +++ b/tools/PictureRenderingFlags.cpp @@ -28,7 +28,7 @@ DEFINE_string(bbh, "none", "bbhType [width height]: Set the bounding box hierarc #if SK_SUPPORT_GPU static const char kGpuAPINameGL[] = "gl"; static const char kGpuAPINameGLES[] = "gles"; -#define GPU_CONFIG_STRING "|gpu|msaa4|msaa16|nvprmsaa4|nvprmsaa16" +#define GPU_CONFIG_STRING "|gpu|msaa4|msaa16|nvprmsaa4|nvprmsaa16|gpudft" #else #define GPU_CONFIG_STRING "" #endif @@ -286,6 +286,7 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { } int sampleCount = 0; + bool useDFText = false; #endif if (FLAGS_config.count() > 0) { if (0 == strcmp(FLAGS_config[0], "8888")) { @@ -311,6 +312,10 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; sampleCount = 16; } + else if (0 == strcmp(FLAGS_config[0], "gpudft")) { + deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; + useDFText = true; + } #if SK_ANGLE else if (0 == strcmp(FLAGS_config[0], "angle")) { deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; @@ -336,6 +341,7 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { } #if SK_SUPPORT_GPU renderer->setSampleCount(sampleCount); + renderer->setUseDFText(useDFText); #endif } diff --git a/tools/flags/SkCommonFlags.cpp b/tools/flags/SkCommonFlags.cpp index 4d329c5f30..c7fc17f047 100644 --- a/tools/flags/SkCommonFlags.cpp +++ b/tools/flags/SkCommonFlags.cpp @@ -9,7 +9,7 @@ DEFINE_string(config, "565 8888 pdf gpu nonrendering angle nvprmsaa4", "Options: 565 8888 pdf gpu nonrendering msaa4 msaa16 nvprmsaa4 nvprmsaa16 " - "gpunull gpudebug angle mesa"); + "gpudft gpunull gpudebug angle mesa"); DEFINE_bool(cpu, true, "master switch for running CPU-bound work."); |