feat/data-dnd e05cb15

orient.go RawHistoryFolder

1package vulkan
2
3import (
4	"image"
5
6	"github.com/bnema/neferwl/internal/ports"
7)
8
9// sceneSize is the size of a scene in scene-physical pixels: the target's,
10// swapped when the output transform t rotates by 90 or 270 degrees.
11func (r *Renderer) sceneSize(t ports.BufferTransform) (int, int) {
12	return t.Size(r.width, r.height)
13}
14
15// orient maps draws built in scene space to the target, in place and without
16// allocating: the target holds the scene transformed by t, like a client
17// buffer holds its surface under wl_surface.set_buffer_transform. Each rect
18// goes through t.RectToBuffer (integer rects stay integer under these eight
19// isometries, so the rounding is exact) and each source map is composed with
20// the affine target-to-scene map, the inverse transform. The vertex shader's
21// target size (misc[2:4]) stays the target's.
22//
23// Pixel centres map to pixel centres under these isometries, so a draw
24// flagged flagExact still reads texelFetch(floor(src)) on the right texel.
25//
26// It runs once per frame, after damage clipping, and before any consumer of
27// the target: HDR composition (hdrOwn is target-sized and recordHDR reads the
28// already-oriented target) and the capture and Pixels paths stay unchanged.
29func (r *Renderer) orient(ds []draw, t ports.BufferTransform) {
30	if t == 0 {
31		return
32	}
33	sw, sh := r.sceneSize(t)
34	inv := t.Invert()
35	tw, th := float64(r.width), float64(r.height)
36	// scene = f0 + x*fx + y*fy for a target point (x, y).
37	f0x, f0y := inv.ToBuffer(0, 0, tw, th)
38	fxx, fxy := inv.ToBuffer(1, 0, tw, th)
39	fyx, fyy := inv.ToBuffer(0, 1, tw, th)
40	fxx, fxy = fxx-f0x, fxy-f0y
41	fyx, fyy = fyx-f0x, fyy-f0y
42	for i := range ds {
43		pc := &ds[i].pc
44		rect := t.RectToBuffer(image.Rect(int(pc.rect[0]), int(pc.rect[1]), int(pc.rect[2]), int(pc.rect[3])), sw, sh)
45		pc.rect = [4]int32{int32(rect.Min.X), int32(rect.Min.Y), int32(rect.Max.X), int32(rect.Max.Y)}
46		if pc.misc[0] == modeSolid {
47			continue
48		}
49		m0x, m0y := float64(pc.mapv[0]), float64(pc.mapv[1])
50		mxx, mxy := float64(pc.mapv[2]), float64(pc.mapv[3])
51		myx, myy := float64(pc.mapy[0]), float64(pc.mapy[1])
52		pc.mapv = [4]float32{
53			float32(m0x + f0x*mxx + f0y*myx),
54			float32(m0y + f0x*mxy + f0y*myy),
55			float32(fxx*mxx + fxy*myx),
56			float32(fxx*mxy + fxy*myy),
57		}
58		pc.mapy[0] = float32(fyx*mxx + fyy*myx)
59		pc.mapy[1] = float32(fyx*mxy + fyy*myy)
60	}
61}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 25

Tags 10

↑↓ moveenter openesc close