HWC2: refactor code to convert a Region to hwcRects

This code already appears twice, and
I991c8e1beca22075ec831f96dff218e6af3d9a08 will add a third use. Move it
into a common function so that it can be called by all three.

Bug: 212736475
Test: existing tests (no change in behavior)
Change-Id: Ibe7684b415c08b7bec01188dbab4655c91086372
1 file changed