[PATCH v3 2/2] gdiplus: Move Flatten() tests into the same function