This is the first part of a longer series of commits that can be found here: https://gitlab.winehq.org/madewokherd/wine/-/tree/getdc-wip?ref_type=heads
The eventual goal is to no longer store gdi32 handles, which are a limited resource, on gdiplus objects, except when absolutely necessary. In particular, Graphics objects created from an HWND do not need to store an HDC (GetDC/ReleaseDC theoretically caches those and works just fine), and Bitmap objects with a gdi32-compatible format shouldn't store an HBITMAP or HDC. These changes revealed some other bugs in bitmap and linecap code, which I've also fixed in order to keep the tests working.