PDF: allow gdiplus_device's transparency group detection heuristic to work more reliably (fixes issue 2540)