fmt
This commit is contained in:
parent
bb4ed43b8a
commit
9a1350aff2
4 changed files with 270 additions and 269 deletions
3
Makefile
3
Makefile
|
@ -17,3 +17,6 @@ nuke:
|
||||||
cd draw2d && make nuke
|
cd draw2d && make nuke
|
||||||
cd postscript && make nuke
|
cd postscript && make nuke
|
||||||
cd wingui && make nuke
|
cd wingui && make nuke
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
gofmt -w draw2d postscript wingui cmd
|
||||||
|
|
|
@ -71,7 +71,7 @@ func WndProc(hwnd, msg uint32, wparam, lparam int32) uintptr {
|
||||||
|
|
||||||
switch msg {
|
switch msg {
|
||||||
case wingui.WM_CREATE:
|
case wingui.WM_CREATE:
|
||||||
hdc := wingui.GetDC(hwnd);
|
hdc := wingui.GetDC(hwnd)
|
||||||
wndBufferHeader = wingui.CreateCompatibleBitmap(hdc, 600, 800)
|
wndBufferHeader = wingui.CreateCompatibleBitmap(hdc, 600, 800)
|
||||||
wingui.GetObject(wndBufferHeader, unsafe.Sizeof(wndBuffer), uintptr(unsafe.Pointer(&wndBuffer)))
|
wingui.GetObject(wndBufferHeader, unsafe.Sizeof(wndBuffer), uintptr(unsafe.Pointer(&wndBuffer)))
|
||||||
hdcWndBuffer = wingui.CreateCompatibleDC(hdc)
|
hdcWndBuffer = wingui.CreateCompatibleDC(hdc)
|
||||||
|
@ -123,7 +123,7 @@ func WndProc(hwnd, msg uint32, wparam, lparam int32) uintptr {
|
||||||
reader := strings.NewReader(postscriptContent)
|
reader := strings.NewReader(postscriptContent)
|
||||||
interpreter.Execute(reader)
|
interpreter.Execute(reader)
|
||||||
gc.Restore()
|
gc.Restore()
|
||||||
wingui.BitBlt(hdc, 0, 0 , int(wndBuffer.Width), int(wndBuffer.Height), hdcWndBuffer, 0, 0, wingui.SRCCOPY);
|
wingui.BitBlt(hdc, 0, 0, int(wndBuffer.Width), int(wndBuffer.Height), hdcWndBuffer, 0, 0, wingui.SRCCOPY)
|
||||||
wingui.EndPaint(hwnd, &ps)
|
wingui.EndPaint(hwnd, &ps)
|
||||||
rc = wingui.DefWindowProc(hwnd, msg, wparam, lparam)
|
rc = wingui.DefWindowProc(hwnd, msg, wparam, lparam)
|
||||||
case wingui.WM_CLOSE:
|
case wingui.WM_CLOSE:
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
||||||
WM_PAINT = 15
|
WM_PAINT = 15
|
||||||
|
|
||||||
BI_RGB = 0
|
BI_RGB = 0
|
||||||
|
@ -81,7 +80,6 @@ var (
|
||||||
procCreateCompatibleBitmap = getSysProcAddr(modgdi32, "CreateCompatibleBitmap")
|
procCreateCompatibleBitmap = getSysProcAddr(modgdi32, "CreateCompatibleBitmap")
|
||||||
procCreateDIBSection = getSysProcAddr(modgdi32, "CreateDIBSection")
|
procCreateDIBSection = getSysProcAddr(modgdi32, "CreateDIBSection")
|
||||||
procBitBlt = getSysProcAddr(modgdi32, "BitBlt")
|
procBitBlt = getSysProcAddr(modgdi32, "BitBlt")
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetDC(hwnd uint32) (hdc uint32) {
|
func GetDC(hwnd uint32) (hdc uint32) {
|
||||||
|
@ -102,7 +100,7 @@ func GetObject(hgdiobj uint32, cbBuffer int, object uintptr) (size uint32) {
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
func SelectObject(hdc uint32, hgdiobj uint32) (uint32) {
|
func SelectObject(hdc uint32, hgdiobj uint32) uint32 {
|
||||||
r0, _, _ := syscall.Syscall(procSelectObject, 2, uintptr(hdc), uintptr(hgdiobj), 0)
|
r0, _, _ := syscall.Syscall(procSelectObject, 2, uintptr(hdc), uintptr(hgdiobj), 0)
|
||||||
return uint32(r0)
|
return uint32(r0)
|
||||||
}
|
}
|
||||||
|
@ -128,7 +126,7 @@ func CreateDIBSection(hdc uint32, pbmi *BITMAPINFO , iUsage uint, ppvBits uintpt
|
||||||
return uint32(r0)
|
return uint32(r0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func BitBlt(hdc uint32, nXDest, nYDest, nWidth, nHeight int, hdcSrc uint32, nXSrc, nYSrc int, dwRop uint32) ( bool) {
|
func BitBlt(hdc uint32, nXDest, nYDest, nWidth, nHeight int, hdcSrc uint32, nXSrc, nYSrc int, dwRop uint32) bool {
|
||||||
r0, _, _ := syscall.Syscall9(procBitBlt, 9, uintptr(hdc), uintptr(nXDest), uintptr(nYDest), uintptr(nWidth), uintptr(nHeight), uintptr(hdcSrc), uintptr(nXSrc), uintptr(nYSrc), uintptr(dwRop))
|
r0, _, _ := syscall.Syscall9(procBitBlt, 9, uintptr(hdc), uintptr(nXDest), uintptr(nYDest), uintptr(nWidth), uintptr(nHeight), uintptr(hdcSrc), uintptr(nXSrc), uintptr(nYSrc), uintptr(dwRop))
|
||||||
return r0 != 0
|
return r0 != 0
|
||||||
}
|
}
|
Loading…
Reference in a new issue