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 { } else {
fFM.reset(SkFontMgr::RefDefault()); fFM.reset(SkFontMgr::RefDefault());
} }
fName.append(sk_tool_utils::platform_os_name());
fName.append(sk_tool_utils::platform_extra_config("GDI"));
} }
protected: protected:
@ -131,7 +133,10 @@ public:
protected: protected:
SkString onShortName() override { 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 { SkISize onISize() override {
@ -218,6 +223,8 @@ public:
if (scale != 1 || skew != 0) { if (scale != 1 || skew != 0) {
fName.appendf("_%g_%g", scale, skew); 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()); 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_string(picture, "", "Path to single picture.");
DEFINE_bool(sort, false, "Sort samples by title."); DEFINE_bool(sort, false, "Sort samples by title.");
DEFINE_bool(list, false, "List samples?"); DEFINE_bool(list, false, "List samples?");
DEFINE_string(key, "", ""); // dummy to enable gm tests that have platform-specific names
#ifdef SAMPLE_PDF_FILE_VIEWER #ifdef SAMPLE_PDF_FILE_VIEWER
DEFINE_string(pdfPath, "", "Path to direcotry of pdf files."); DEFINE_string(pdfPath, "", "Path to direcotry of pdf files.");
#endif #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_int32(msaa, 0, "Number of msaa samples.");
DEFINE_bool2(fullscreen, f, true, "Run fullscreen."); DEFINE_bool2(fullscreen, f, true, "Run fullscreen.");
DEFINE_bool2(verbose, v, false, "enable verbose output from the test driver."); 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) { static SkString humanize(double ms) {
if (FLAGS_verbose) { if (FLAGS_verbose) {

View File

@ -10,6 +10,7 @@
#include "SkBitmap.h" #include "SkBitmap.h"
#include "SkCanvas.h" #include "SkCanvas.h"
#include "SkCommonFlags.h"
#include "SkShader.h" #include "SkShader.h"
#include "SkTestScalerContext.h" #include "SkTestScalerContext.h"
#include "SkTextBlob.h" #include "SkTextBlob.h"
@ -19,6 +20,25 @@ DEFINE_bool(resourceFonts, false, "Use resource fonts");
namespace sk_tool_utils { 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) { const char* colortype_name(SkColorType ct) {
switch (ct) { switch (ct) {
case kUnknown_SkColorType: return "Unknown"; case kUnknown_SkColorType: return "Unknown";

View File

@ -25,6 +25,8 @@ namespace sk_tool_utils {
const char* colortype_name(SkColorType); const char* colortype_name(SkColorType);
SkColor color_to_565(SkColor color); 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. * Sets the paint to use a platform-independent text renderer if FLAGS_portableFonts is set.