Narrow GDI diff suppressions to gdi_skia for surprise passes

Tests that unexpectedly passed on win_xfa_gdi still fail image diff on
win_xfa_skia_gdi. Narrow their rendering column from gdi to gdi_skia.

This allows win_xfa_gdi to compare against expected images while keeping
the diff suppression in place for win_xfa_skia_gdi.

Differentiate the GDI rendering option into gdi_agg and gdi_skia based
on whether the SKIA feature is present. In column 4 of the suppression
files, gdi serves as an umbrella shorthand that matches both gdi_agg
and gdi_skia, mirroring how mac in column 1 matches both mac_arm and
mac_x86.

Specific subtypes gdi_agg and gdi_skia can now be used when a test
needs to be suppressed only on one GDI backend (e.g. win_xfa_gdi or
win_xfa_skia_gdi).

There should no longer be any surprise matches after this CL.

Change-Id: Ica14f73691b1fc08d74186eaf409269a7aa9c5a1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/158471
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 4d55a69..9ffcbd0 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -11,7 +11,7 @@
 # Column 1: platform: *, win, mac, mac_arm, mac_x86, linux
 # Column 2: v8 support: *, nov8, v8
 # Column 3: xfa support: *, noxfa, xfa
-# Column 4: rendering support: *, agg, gdi, skia
+# Column 4: rendering support: *, agg, gdi, gdi_agg, gdi_skia, skia
 # Column 5: font engine: *, freetype, fontations
 # Column 6: action, one of:
 #   diff  - the output differs in a way that no tolerance can bridge, so
@@ -30,8 +30,9 @@
 # lines to suppress more cases.  Within each column, any one of the
 # comma-separated values must match in order for the column to "match".
 # The filenames and keywords are case-sensitive.
-# One exception is the column 1, where "mac" is a shorthand that matches either
-# "mac_arm" or "mac_x86".
+# One exception is column 1, where "mac" is a shorthand that matches either
+# "mac_arm" or "mac_x86". Similarly, "gdi" in column 4 is a shorthand that
+# matches either "gdi_agg" or "gdi_skia".
 #
 # Try to keep the file alphabetized within each category of test.
 
@@ -490,7 +491,7 @@
 FRC_8.5_URI_IsMap.pdf * * * gdi * diff
 FRC_8.5_URI_IsMap.pdf * * * * * fuzzy
 FRC_8.5_URI_IsMap.pdf mac * * skia * fuzzy
-bug_691967.pdf * * * gdi * diff
+bug_691967.pdf * * * gdi_skia * diff
 bug_691967.pdf * * * * * fuzzy
 bug_691967.pdf mac * * skia * fuzzy
 bug_86459.pdf * * * gdi * diff
@@ -734,12 +735,12 @@
 widget_javascript.pdf * * * gdi * diff
 
 # TODO(crbug.com/42271068): Remove after associated bug is fixed
-1_10_watermark.pdf * * * gdi * diff
+1_10_watermark.pdf * * * gdi_skia * diff
 1_10_watermark.pdf * * * skia * fuzzy
 1_matrix.pdf * * * gdi * diff
 2_color_tiling.pdf * * * gdi * diff
-2_shading_type_6_00.pdf * * * gdi * diff
-2_shading_type_6_001.pdf * * * gdi * diff
+2_shading_type_6_00.pdf * * * gdi_skia * diff
+2_shading_type_6_001.pdf * * * gdi_skia * diff
 2_uncolor_tiling.pdf * * * gdi * diff
 FRC_11_8.2.4_View_edit.pdf * * * gdi * diff
 FRC_11_8.2.4_View_edit.pdf * * * * * fuzzy
@@ -785,7 +786,7 @@
 FRC_3_8.2.4_Type_8.6__edit_.pdf mac * * skia * fuzzy
 FRC_4.5.5_Pattern_shading.pdf * * * gdi * diff
 FRC_4.5.5_Pattern_shading.pdf mac * * skia * fuzzy
-FRC_4.5.5_Pattern_tiling.pdf * * * gdi * diff
+FRC_4.5.5_Pattern_tiling.pdf * * * gdi_skia * diff
 FRC_4_8.2.4_Schema_8.6__remove_all.pdf * * * gdi * diff
 FRC_4_8.2.4_Schema_8.6__remove_all.pdf * * * * * fuzzy
 FRC_4_8.2.4_Schema_8.6__remove_all.pdf mac * * skia * fuzzy
@@ -804,31 +805,31 @@
 FRC_9_8.2.4_View_T.pdf * * * gdi * diff
 FRC_9_8.2.4_View_T.pdf * * * * * fuzzy
 FRC_9_8.2.4_View_T.pdf mac * * skia * fuzzy
-annotation_circle_fill_opacity.pdf * * * gdi * diff
+annotation_circle_fill_opacity.pdf * * * gdi_skia * diff
 annotation_circle_fill_opacity.pdf mac * * skia * fuzzy
-annotation_square_fill_opacity.pdf * * * gdi * diff
+annotation_square_fill_opacity.pdf * * * gdi_skia * diff
 annotation_square_fill_opacity.pdf mac * * skia * fuzzy
-annotation_square_fill_opacity_dash.pdf * * * gdi * diff
+annotation_square_fill_opacity_dash.pdf * * * gdi_skia * diff
 annotation_square_fill_opacity_dash.pdf mac * * skia * fuzzy
 bug_0_length_line.pdf * * * gdi * diff
-bug_883026.pdf * * * gdi * diff
+bug_883026.pdf * * * gdi_skia * diff
 clipping_text.pdf * * * gdi * diff
-en_fqa.pdf * * * gdi * diff
-en_introduce.pdf * * * gdi * diff
+en_fqa.pdf * * * gdi_skia * diff
+en_introduce.pdf * * * gdi_skia * diff
 en_system.pdf * * * gdi * diff
 en_system.pdf mac * * skia * fuzzy
 example_012.pdf * * * gdi * diff
 gradient_many_stops.pdf * * * gdi * diff
 group_xobject.pdf * * * gdi * diff
-image_gif.pdf * * * gdi * diff
+image_gif.pdf * * * gdi_skia * diff
 image_gif.pdf mac * * skia * fuzzy
-image_ico.pdf * * * gdi * diff
-new_pdfsign1.pdf * * * gdi * diff
-new_pdfsign2.pdf * * * gdi * diff
-new_pdfsign3.pdf * * * gdi * diff
+image_ico.pdf * * * gdi_skia * diff
+new_pdfsign1.pdf * * * gdi_skia * diff
+new_pdfsign2.pdf * * * gdi_skia * diff
+new_pdfsign3.pdf * * * gdi_skia * diff
 new_pdfsign3.pdf * * * * * fuzzy
-new_pdfsign4.pdf * * * gdi * diff
-new_stamp3.pdf * * * gdi * diff
+new_pdfsign4.pdf * * * gdi_skia * diff
+new_stamp3.pdf * * * gdi_skia * diff
 new_stamp3.pdf * * * * * fuzzy
 new_stamp3.pdf mac * * skia * fuzzy
 path_10_jd.pdf * * * gdi * diff
@@ -836,10 +837,10 @@
 path_7.pdf * * * gdi * diff
 path_9.pdf * * * gdi * diff
 transformation.pdf * * * gdi * diff
-transparent1.pdf * * * gdi * diff
-xfermodes.pdf * * * gdi * diff
+transparent1.pdf * * * gdi_skia * diff
+xfermodes.pdf * * * gdi_skia * diff
 xfermodes2.pdf * * * gdi * diff
-xfermodes3.pdf * * * gdi * diff
+xfermodes3.pdf * * * gdi_skia * diff
 
 #
 # JavaScript tests
@@ -1008,23 +1009,23 @@
 bug_1015233.in * * * gdi * diff
 bug_1099446.in * * * gdi * diff
 bug_1161.in * * * gdi * diff
-bug_1236.in * * * gdi * diff
-bug_1288_1.in * * * gdi * diff
+bug_1236.in * * * gdi_skia * diff
+bug_1288_1.in * * * gdi_skia * diff
 bug_1330.in * * * gdi * diff
-bug_1395648.in * * * gdi * diff
-bug_1396266.in * * * gdi * diff
-bug_1430333.in * * * gdi * diff
+bug_1395648.in * * * gdi_skia * diff
+bug_1396266.in * * * gdi_skia * diff
+bug_1430333.in * * * gdi_skia * diff
 bug_1822.in * * * gdi * diff
-bug_1847.in * * * gdi * diff
-bug_1949.in * * * gdi * diff
-bug_1995.in * * * gdi * diff
+bug_1847.in * * * gdi_skia * diff
+bug_1949.in * * * gdi_skia * diff
+bug_1995.in * * * gdi_skia * diff
 bug_41153500.in * * * gdi * diff
 bug_42270979_1.in * * * gdi * diff
 bug_42270979_3.in * * * gdi * diff
 bug_632.in * * * gdi * diff
 bug_660850.in * * * gdi * diff
 long_dashed_line.in * * * gdi * diff
-matte.in * * * gdi * diff
+matte.in * * * gdi_skia * diff
 
 # TODO(crbug.com/361002664): Remove after associated bug is fixed
 smask_blend.in * * * gdi * diff
diff --git a/testing/tools/suppressor.py b/testing/tools/suppressor.py
index fcdf8ec..e1be53c 100755
--- a/testing/tools/suppressor.py
+++ b/testing/tools/suppressor.py
@@ -41,7 +41,7 @@
     1: {'*', 'win', 'mac', 'mac_arm', 'mac_x86', 'linux'},
     2: {'*', 'nov8', 'v8'},
     3: {'*', 'noxfa', 'xfa'},
-    4: {'*', 'agg', 'gdi', 'skia'},
+    4: {'*', 'agg', 'gdi', 'gdi_agg', 'gdi_skia', 'skia'},
     5: {'*', 'freetype', 'fontations'},
 }
 
@@ -72,7 +72,10 @@
                rendering_option, font_engine):
     self.has_v8 = not js_disabled and 'V8' in features
     self.has_xfa = not js_disabled and not xfa_disabled and 'XFA' in features
-    self.rendering_option = rendering_option
+    if rendering_option == 'gdi':
+      self.rendering_option = 'gdi_skia' if 'SKIA' in features else 'gdi_agg'
+    else:
+      self.rendering_option = rendering_option
     self.font_engine = font_engine
     self.suppression_set = set()
     self.execution_suppression_set = set()
@@ -121,6 +124,15 @@
       return f'{os_name}_{mac_platform}' in os_column
     return False
 
+  @staticmethod
+  def _MatchRenderer(rendering_option, rendering_option_column):
+    if ('*' in rendering_option_column or
+        rendering_option in rendering_option_column):
+      return True
+    if rendering_option.startswith('gdi_'):
+      return 'gdi' in rendering_option_column
+    return False
+
   def _MatchSuppression(self, item, os_name, mac_platform, js, xfa,
                         rendering_option, font_engine):
     os_column = item[1].split(",")
@@ -131,8 +143,8 @@
     return (Suppressor._MatchOs(os_name, mac_platform, os_column) and
             ('*' in js_column or js in js_column) and
             ('*' in xfa_column or xfa in xfa_column) and
-            ('*' in rendering_option_column or
-             rendering_option in rendering_option_column) and
+            Suppressor._MatchRenderer(rendering_option,
+                                      rendering_option_column) and
             ('*' in font_engine_column or font_engine in font_engine_column))
 
   def IsResultSuppressed(self, input_filename):