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