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 }