From fc3e13a4e61d2ef0492c0452a42724c62a446077 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 8 Sep 2015 17:13:55 -0400 Subject: [PATCH] Fixed alpha-blending issues on Windows. --- winarea/draw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/winarea/draw.c b/winarea/draw.c index e1f53dd4..cc647a8f 100644 --- a/winarea/draw.c +++ b/winarea/draw.c @@ -183,6 +183,7 @@ static void startAlpha(uiDrawContext *c, struct alpha *a) BYTE *ops; HRGN region; BITMAPINFO bi; + POINT prevWindowOrigin; DWORD le; ZeroMemory(a, sizeof (struct alpha)); @@ -234,12 +235,17 @@ static void startAlpha(uiDrawContext *c, struct alpha *a) logLastError("error selecting bitmap into DC in startAlpha()"); // now we can finally copy the path like we were going to earlier + // we need to change the window origin so the path draws in the right place + if (SetWindowOrgEx(a->dc, a->r.left, a->r.top, &prevWindowOrigin) == 0) + logLastError("error setting window origin in startAlpha()"); if (BeginPath(a->dc) == 0) logLastError("error beginning path in startAlpha()"); if (PolyDraw(a->dc, points, ops, n) == 0) logLastError("error copying path in startAlpha()"); if (EndPath(a->dc) == 0) logLastError("error ending path in startAlpha()"); + if (SetWindowOrgEx(a->dc, prevWindowOrigin.x, prevWindowOrigin.y, NULL) == 0) + logLastError("error resetting window origin in startAlpha()"); free(points); free(ops); }