aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-01-24 11:22:57 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-24 20:47:59 +0000
commit9ef0989f4c7f4413d9a97f8ad67379d32debd8fd (patch)
tree68fc644f9fff4d92811133058ccdeeb0049a67db /tools
parent4a216956df00b59fbe297c451645f20a56f414ad (diff)
SkQP: add slack to model
Change-Id: Id14e5d4d6c5d517c29cd09b815ede1b52604d96a Reviewed-on: https://skia-review.googlesource.com/99322 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/skqp/make_gmkb.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/skqp/make_gmkb.go b/tools/skqp/make_gmkb.go
index 97e44e449e..e5dd06ca67 100644
--- a/tools/skqp/make_gmkb.go
+++ b/tools/skqp/make_gmkb.go
@@ -29,6 +29,17 @@ const (
max_png = "max.png"
)
+// `slack` is an amount to add to the max and subtract from the minimim channel
+// value for each pixel for the given test. By default, slack is 0.
+var slack = map[string]int{
+ "imagemagnifier": 1,
+ "xfermodes": 1,
+ "xfermodes2": 1,
+ "xfermodes3": 1,
+ "dashcircle": 1,
+ "encode-srgb-jpg": 1,
+}
+
type ExportTestRecordArray []search.ExportTestRecord
func (a ExportTestRecordArray) Len() int { return len(a) }
@@ -44,6 +55,15 @@ func in(v string, a []string) bool {
return false
}
+func clampU8(v int) uint8 {
+ if v < 0 {
+ return 0
+ } else if v > 255 {
+ return 255
+ }
+ return uint8(v)
+}
+
func processTest(testName string, imgUrls []string, output string) error {
if strings.ContainsRune(testName, '/') {
return nil
@@ -84,6 +104,15 @@ func processTest(testName string, imgUrls []string, output string) error {
if img_max.Rect.Max.X == 0 {
return nil
}
+ if delta, ok := slack[testName]; ok {
+ for i, v := range img_min.Pix {
+ img_min.Pix[i] = clampU8(int(v) - delta)
+ }
+ for i, v := range img_max.Pix {
+ img_max.Pix[i] = clampU8(int(v) + delta)
+ }
+ }
+
if err := os.Mkdir(output_directory, os.ModePerm); err != nil && !os.IsExist(err) {
return err
}