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