From ac633a86949fb2b61c323c2fc41fc067ab6b5f6c Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 12 Apr 2014 15:42:13 -0400 Subject: [PATCH] Removed the GDI+ dependency on Windows since we no longer use it. --- area_windows.go | 2 +- common_windows.go | 1 - init_windows.go | 29 ----------------------------- uitask_windows.go | 2 -- 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/area_windows.go b/area_windows.go index 3537a75..a2e8631 100644 --- a/area_windows.go +++ b/area_windows.go @@ -184,7 +184,7 @@ func paintArea(s *sysData) { // now we have to do TWO MORE things before we can finally do alpha blending // first, we need to load the bitmap memory, because Windows makes it for us - // the pixels are arranged in RGBA order, but GDI+ requires BGRA + // the pixels are arranged in RGBA order, but GDI requires BGRA // this turns out to be just ARGB in little endian; let's convert into this memory // the bitmap Windows gives us has a stride == width toARGB(i, ppvBits, i.Rect.Dx() * 4) diff --git a/common_windows.go b/common_windows.go index 0c9cf39..e02a976 100644 --- a/common_windows.go +++ b/common_windows.go @@ -12,7 +12,6 @@ var ( kernel32 = syscall.NewLazyDLL("kernel32.dll") gdi32 = syscall.NewLazyDLL("gdi32.dll") comctl32 *syscall.LazyDLL // comctl32 not defined here; see comctl_windows.go - gdiplus = syscall.NewLazyDLL("gdiplus.dll") msimg32 = syscall.NewLazyDLL("msimg32.dll") ) diff --git a/init_windows.go b/init_windows.go index bfc7649..9ccd5df 100644 --- a/init_windows.go +++ b/init_windows.go @@ -11,7 +11,6 @@ import ( var ( hInstance _HANDLE nCmdShow int - gdiplusToken uintptr ) // TODO is this trick documented in MSDN? @@ -57,26 +56,6 @@ func getWinMainnCmdShow() { } } -func initGDIPlus() (err error) { - var gdiplusInit struct { - GdiplusVersion uint32 - DebugEventCallback uintptr - SuppressBackgroundThread int32 // originally BOOL - SuppressExternalCodecs int32 // originally BOOL - } - - gdiplusInit.GdiplusVersion = 1 // required - // TODO suppress external codecs? - r1, _, err := gdiplus.NewProc("GdiplusStartup").Call( - uintptr(unsafe.Pointer(&gdiplusToken)), - uintptr(unsafe.Pointer(&gdiplusInit)), - uintptr(0)) // we use the GDI+ thread so no need for output info - if r1 != 0 { // failure - return fmt.Errorf("error initializing GDI+ (GDI+ error code %d; windows last error %v)", r1, err) - } - return nil -} - func doWindowsInit() (err error) { err = getWinMainhInstance() if err != nil { @@ -95,14 +74,6 @@ func doWindowsInit() (err error) { if err != nil { return fmt.Errorf("error initializing Common Controls (comctl32.dll): %v", err) } - err = initGDIPlus() - if err != nil { - return fmt.Errorf("error initializing GDI+ (gdiplus.dll): %v", err) - } // TODO others return nil // all ready to go } - -func doWindowsQuitStuff() { - gdiplus.NewProc("GdiplusShutdown").Call(gdiplusToken) // returns void according to MSDN -} diff --git a/uitask_windows.go b/uitask_windows.go index ccd411a..ad8404f 100644 --- a/uitask_windows.go +++ b/uitask_windows.go @@ -87,8 +87,6 @@ func ui(main func()) error { }() msgloop() - - doWindowsQuitStuff() return nil }