diff options
author | Alexander Neumann <alexander.neumann@picos-software.com> | 2020-09-03 16:50:03 +0200 |
---|---|---|
committer | Alexander Neumann <alexander.neumann@picos-software.com> | 2020-09-03 16:50:03 +0200 |
commit | 7790467d3cfcb37bded8b15cfdf7f1be2ad58a0c (patch) | |
tree | 9015bc6a760463594b45bfa013f5669873042ce2 | |
parent | ListBox/ListItemStyle: Allow override of TextColor (diff) | |
download | wireguard-windows-7790467d3cfcb37bded8b15cfdf7f1be2ad58a0c.tar.xz wireguard-windows-7790467d3cfcb37bded8b15cfdf7f1be2ad58a0c.zip |
Bitmap: Change withPixels to GlobalAlloc with GMEM_FIXED instead of GHND
-rw-r--r-- | bitmap.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -363,10 +363,10 @@ func (bmp *Bitmap) withPixels(f func(bi *win.BITMAPINFO, hdc win.HDC, pixels *[m return newError("GetDIBits #1") } - hPixels := win.GlobalAlloc(win.GHND, uintptr(bi.BmiHeader.BiSizeImage)) + hPixels := win.GlobalAlloc(win.GMEM_FIXED, uintptr(bi.BmiHeader.BiSizeImage)) defer win.GlobalFree(hPixels) - pixels := (*[maxPixels]bgraPixel)(win.GlobalLock(hPixels)) - defer win.GlobalUnlock(hPixels) + + pixels := (*[maxPixels]bgraPixel)(unsafe.Pointer(uintptr(hPixels))) bi.BmiHeader.BiCompression = win.BI_RGB if ret := win.GetDIBits(hdc, bmp.hBmp, 0, uint32(bi.BmiHeader.BiHeight), &pixels[0].B, &bi, win.DIB_RGB_COLORS); ret == 0 { |