зеркало из https://github.com/mozilla/moz-skia.git
add JSONP option to output of skpdiff
R=bsalomon@google.com Review URL: https://codereview.chromium.org/18648002 git-svn-id: http://skia.googlecode.com/svn/trunk@9907 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
293f01939c
Коммит
a95959c3fb
|
@ -147,9 +147,15 @@ void SkDiffContext::diffPatterns(const char baselinePattern[], const char testPa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkDiffContext::outputRecords(SkWStream& stream) {
|
void SkDiffContext::outputRecords(SkWStream& stream, bool useJSONP) {
|
||||||
DiffRecord* currentRecord = fRecords;
|
DiffRecord* currentRecord = fRecords;
|
||||||
|
if (useJSONP) {
|
||||||
|
stream.writeText("var SkPDiffRecords = {\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
stream.writeText("{\n");
|
stream.writeText("{\n");
|
||||||
|
}
|
||||||
stream.writeText(" \"records\": [\n");
|
stream.writeText(" \"records\": [\n");
|
||||||
while (NULL != currentRecord) {
|
while (NULL != currentRecord) {
|
||||||
stream.writeText(" {\n");
|
stream.writeText(" {\n");
|
||||||
|
@ -214,5 +220,11 @@ void SkDiffContext::outputRecords(SkWStream& stream) {
|
||||||
currentRecord = currentRecord->fNext;
|
currentRecord = currentRecord->fNext;
|
||||||
}
|
}
|
||||||
stream.writeText(" ]\n");
|
stream.writeText(" ]\n");
|
||||||
|
if (useJSONP) {
|
||||||
|
stream.writeText("};\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
stream.writeText("}\n");
|
stream.writeText("}\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,8 +86,9 @@ public:
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @param stream The stream to output the diff to
|
* @param stream The stream to output the diff to
|
||||||
|
* @param useJSONP True to adding padding to the JSON output to make it cross-site requestable.
|
||||||
*/
|
*/
|
||||||
void outputRecords(SkWStream& stream);
|
void outputRecords(SkWStream& stream, bool useJSONP);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct DiffData {
|
struct DiffData {
|
||||||
|
|
|
@ -29,6 +29,7 @@ DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b
|
||||||
DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names: <baseline folder> <test folder>");
|
DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names: <baseline folder> <test folder>");
|
||||||
DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline> <test>");
|
DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline> <test>");
|
||||||
DEFINE_string2(output, o, "skpdiff_output.json", "Writes the output of these diffs to output: <output>");
|
DEFINE_string2(output, o, "skpdiff_output.json", "Writes the output of these diffs to output: <output>");
|
||||||
|
DEFINE_bool(jsonp, true, "Output JSON with padding");
|
||||||
|
|
||||||
/// A callback for any OpenCL errors
|
/// A callback for any OpenCL errors
|
||||||
CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize, ::size_t cb, void* userData) {
|
CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize, ::size_t cb, void* userData) {
|
||||||
|
@ -181,7 +182,7 @@ int main(int argc, char** argv) {
|
||||||
// Output to the file specified
|
// Output to the file specified
|
||||||
if (!FLAGS_output.isEmpty()) {
|
if (!FLAGS_output.isEmpty()) {
|
||||||
SkFILEWStream outputStream(FLAGS_output[0]);
|
SkFILEWStream outputStream(FLAGS_output[0]);
|
||||||
ctx.outputRecords(outputStream);
|
ctx.outputRecords(outputStream, FLAGS_jsonp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче