SkQP: refatctor C++ bits.
* C++ code moved into tools/skqp/src/.
* State held with single SkQP class.
* gmkb functions moved to skqp_model.{h,cpp}
* model no longer knows about report format.
* skqp_main and skqp_lib no longer have globals
* jni code has fewer globals.
* skqp_main no longer uses googletest.
* AssetMng returns SkData, not a SkStream.
* Add jitter tool.
* dump GPU information into grdump.txt
* JUnit puts report in directory with timestamp.
* Document SkQP Render Test Algorithm.
* GPU driver correctness workarounds always off
* cut_release tool for assembling models
* make_rendertests_list.py to help cut_release
* make_gmkb.go emits a list of models
CQ_INCLUDE_TRYBOTS=skia.primary:Build-Debian9-Clang-x86-devrel-Android_SKQP
Change-Id: I7d4f0c24592b1f64be0088578a3f1a0bc366dd4d
Reviewed-on: https://skia-review.googlesource.com/c/110420
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/tools/skqp/src/skqp_model.h b/tools/skqp/src/skqp_model.h
new file mode 100644
index 0000000..d807cde
--- /dev/null
+++ b/tools/skqp/src/skqp_model.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef skqp_model_DEFINED
+#define skqp_model_DEFINED
+
+#include <cstdint>
+#include <string>
+
+#include "SkBitmap.h"
+
+#include "skqp.h"
+
+class SkQPAssetManager;
+class SkStreamAsset;
+
+namespace skqp {
+
+/** Prefered colortype for comparing test outcomes. */
+constexpr SkColorType kColorType = kRGBA_8888_SkColorType;
+
+/** Prefered alphatype for comparing test outcomes. */
+constexpr SkAlphaType kAlphaType = kUnpremul_SkAlphaType;
+
+/** Where to find the maximum and minimum of the model. */
+constexpr char kMaxPngPath[] = "max.png";
+constexpr char kMinPngPath[] = "min.png";
+
+struct ModelResult {
+ SkBitmap fErrors; // Correct pixels are white, failing pixels scale from black
+ // (1 value off) to red (255 off in some channel).
+ sk_sp<SkData> fMinPng; // original model data, PNG encoded image.
+ sk_sp<SkData> fMaxPng; // original model data, PNG encoded image.
+ SkQP::RenderOutcome fOutcome;
+ std::string fErrorString; // if non-empty, an error occured.
+};
+
+SkQP::RenderOutcome Check(const SkPixmap& minImg,
+ const SkPixmap& maxImg,
+ const SkPixmap& img,
+ unsigned tolerance,
+ SkBitmap* errorOut);
+
+/** Check if the given test image matches the expected results.
+
+ @param name the name of the rendering test that produced the image
+ @param image the image to be tested. Should be kRGBA_8888_SkColorType
+ and kUnpremul_SkAlphaType.
+ @param assetManager provides model data files
+*/
+
+ModelResult CheckAgainstModel(const char* name, const SkPixmap& image,
+ SkQPAssetManager* assetManager);
+}
+#endif // skqp_model_DEFINED