~eliasnaur/gio

ref: 054668372093804f555c23890480b49a54207041 gio/ui/text/label.go -rw-r--r-- 3.3 KiB
ui/text: add LayoutOptions

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/text: add Label.MaxLines

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: rename ops to have Op suffixed, not prefixed

Match Go's FooError name pattern.

While we're here, rename RedrawOp to InvalidateOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: build paths as ops

Instead of allocating and constructing a clip path, store path data
directly in op lists. Use separate op lists for cached text layout
paths.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: make OpPush and OpPop explicit

We're about to allow OpBlock for invoking ops from multiple (cached)
Ops containers. To allow for drawing state changes to stick after
invoking such a cached block, we can't let OpBlock perform an implicit
save and restore of drawing state.

Instead, introduce OpPush and OpPop for explicit drawing state stack
management.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: split OpImage into OpImage and OpDraw

In preparation for an OpColor (and future OpGradient and similar).

Label and Editor no longer take an explicit source image. They
draw with the current image.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui: switch to (more) explicit layout

The layout package switched from interfaces to functions for
composing layouts. The switch made sure that no garbage is
generated for transient layouts such as Align, Inset, Stack, Flex.

Unfortunately, that left the stateful widgets and layouts: as soon
as their layout methods are embedded in a transient layout, a
closure is generated that escapes to the heap.

To avoid garbage for both transient as well as stateful widgets,
replace the functional approach with explicit begin/end methods.

A begin method generally starts an op block and returns the adjusted
constraints. An end method takes computed dimensions, ends its op
block and returns adjusted dimensions.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
ui/layout,ui/text,ui/widget: shorten Widget function names to W

Signed-off-by: Elias Naur <mail@eliasnaur.com>
all: serialize ops

Pros:
- Much less per-frame garbage
- Allow future preprocessing of ops while building it
- Much fewer interface calls and pointer chasing
- Allow future serialization of ops for remote rendering

Cons:
- Slightly clumsier API

Signed-off-by: Elias Naur <mail@eliasnaur.com>
all: run goimports

gioui.org/ui was renamed from gioui.org/ui/ui before the release,
but the import order wasn't changed accordingly.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
all: initial import

Signed-off-by: Elias Naur <mail@eliasnaur.com>