Generate platform specific fontmgr gm.

The gm output on different font platforms is so different
that comparing images in Gold has little value. Separate the
images by appending platform information to the gm name to
group somewhat similar images together.

Note that this does not attempt to make sure that all images
generated by Gold are nearly pixel identical; it only reduces
the number of nonsensical comparisons.

R=bungeman@google.com

Review URL: https://codereview.chromium.org/1245643002
This commit is contained in:
caryclark 2015-07-20 13:38:56 -07:00 committed by Commit bot
parent 973ae86a82
commit 6531c3619f
5 changed files with 32 additions and 1 deletions

View File

@ -65,6 +65,8 @@ public:
} else {
fFM.reset(SkFontMgr::RefDefault());
}
fName.append(sk_tool_utils::platform_os_name());
fName.append(sk_tool_utils::platform_extra_config("GDI"));
}
protected:
@ -131,7 +133,10 @@ public:
protected:
SkString onShortName() override {
return SkString("fontmgr_match");
SkString name("fontmgr_match");
name.append(sk_tool_utils::platform_os_name());
name.append(sk_tool_utils::platform_extra_config("GDI"));
return name;
}
SkISize onISize() override {
@ -218,6 +223,8 @@ public:
if (scale != 1 || skew != 0) {
fName.appendf("_%g_%g", scale, skew);
}
fName.append(sk_tool_utils::platform_os_name());
fName.append(sk_tool_utils::platform_extra_config("GDI"));
fFM.reset(SkFontMgr::RefDefault());
}

View File

@ -700,6 +700,7 @@ DEFINE_string(pictureDir, "", "Read pictures from here.");
DEFINE_string(picture, "", "Path to single picture.");
DEFINE_bool(sort, false, "Sort samples by title.");
DEFINE_bool(list, false, "List samples?");
DEFINE_string(key, "", ""); // dummy to enable gm tests that have platform-specific names
#ifdef SAMPLE_PDF_FILE_VIEWER
DEFINE_string(pdfPath, "", "Path to direcotry of pdf files.");
#endif

View File

@ -35,6 +35,7 @@ DEFINE_double(loopMs, 5, "Target loop time in millseconds.");
DEFINE_int32(msaa, 0, "Number of msaa samples.");
DEFINE_bool2(fullscreen, f, true, "Run fullscreen.");
DEFINE_bool2(verbose, v, false, "enable verbose output from the test driver.");
DEFINE_string(key, "", ""); // dummy to enable gm tests that have platform-specific names
static SkString humanize(double ms) {
if (FLAGS_verbose) {

View File

@ -10,6 +10,7 @@
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkCommonFlags.h"
#include "SkShader.h"
#include "SkTestScalerContext.h"
#include "SkTextBlob.h"
@ -19,6 +20,25 @@ DEFINE_bool(resourceFonts, false, "Use resource fonts");
namespace sk_tool_utils {
const char* platform_os_name() {
for (int index = 0; index < FLAGS_key.count(); index += 2) {
if (!strcmp("os", FLAGS_key[index])) {
return FLAGS_key[index + 1];
}
}
// when running SampleApp or dm without a --key pair, omit the platform name
return "";
}
const char* platform_extra_config(const char* config) {
for (int index = 0; index < FLAGS_key.count(); index += 2) {
if (!strcmp("extra_config", FLAGS_key[index]) && !strcmp(config, FLAGS_key[index + 1])) {
return config;
}
}
return "";
}
const char* colortype_name(SkColorType ct) {
switch (ct) {
case kUnknown_SkColorType: return "Unknown";

View File

@ -25,6 +25,8 @@ namespace sk_tool_utils {
const char* colortype_name(SkColorType);
SkColor color_to_565(SkColor color);
const char* platform_os_name();
const char* platform_extra_config(const char* config);
/**
* Sets the paint to use a platform-independent text renderer if FLAGS_portableFonts is set.