-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhacks.go
44 lines (34 loc) · 838 Bytes
/
hacks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package gotrace
import (
"unsafe"
"github.com/gotranspile/cxgo/runtime/stdio"
)
const sizeofWord = unsafe.Sizeof(Word(0))
// Compression relies on C zlib, so we disable it.
func dummy_xship(f *stdio.File, filter int, s *byte, len_ int) int {
f.WriteN(s, 1, len_)
return len_
}
func pdf_xship(f *stdio.File, filter int, s *byte, len_ int) int {
return dummy_xship(f, filter, s, len_)
}
// C flips bitmaps by using negative bitmap strides, which we cannot represent in Go with slices.
func bm_flip(bm *Bitmap) {
dy := bm.Dy
if dy < 0 {
dy = -dy
}
// TODO: optimize
bm2 := NewBitmap(bm.W, bm.H)
for y := 0; y < bm.H; y++ {
for x := 0; x < bm.W; x++ {
bm2.Put(x, bm.H-1-y, bm.Get(x, y))
}
}
*bm = *bm2
}
func gm_flip(gm *Greymap) {
// TODO: implement
}
// unused in the code
type potrace_privstate_s struct{}