Commit Graph

8 Commits

Author SHA1 Message Date
Gordon Klaus 9d2a6c48d8 io/pointer: add InputOp.Types to specify which types of events to receive
Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com>
2020-06-03 15:29:12 +02:00
Elias Naur c19ed05342 op: change CallOp to be a return value from MacroOp.Stop
Converting

	macro := op.Record(ops)
	...
	macro.Stop()

	macro.Add()

to

	macro := op.Record(ops)
	...
	call := macro.Stop()

	call.Add(ops)

Which is more general (call.Add can take a different ops than the op.Record
that started it), and enforced the order between Stop and the subsequent Add.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-06-02 12:07:20 +02:00
Elias Naur 69dfd2e3a5 op/paint: add support for efficient ImageOp subimages
The new field ImageOp.Rect is initialized to cover the entire source
image, but can be modified to draw only a section of it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-02-13 13:15:32 +01:00
Elias Naur edc81ea0bb op: remove operation list argument from MacroOp.Add
The ability to invoke other operation lists belongs in the new CallOp.

While we're here, make MacroOp.Add use a pointer receiver to match the
other methods.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-12-12 00:45:36 +01:00
Elias Naur 06217c5320 op: introduce CallOp
We'd like to improve the API of Flex, Stack and similar layouts
that use MacroOps internall. Unfortunately, the

  func (m MacroOp) Add(o *Ops)

method causes the MacroOp to be allocated on the heap, ruining the
nice garbage-free property of layouts.

Fortunately, layouts don't need the feature that caused the heap
allocation: invoking operation lists different than the current.

CallOp separates the invoke-different-list semantic from MacroOp,
in preparation for removing the feature from MacroOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-12-12 00:45:36 +01:00
Elias Naur 97299dc2f9 op/paint: make every ImageOp unique
The gioui.org/commit/74407a50d598bfd27e8f8e48b6832cc5df04de77
added a NewImageOp constructor that always copies the supplied
image. It does that for two reasons:

First, the image.Image reference is used in the image=>texture
map of cached textures. Without a copy, we wouldn't detect a
modified image even if a new ImageOp was created.

Second, we don't want the program to touch the image while the GPU
is uploading it.

The second reason was removed in a previous change that blocks
FrameEvent.Frame until we're done with the operations, including
uploading images to the GPU.

The first reason is easily fixed by using a unique per ImageOp,
as pointed out by Alessandro Arzilli.

This change switches to using the unique key. Alessandro's patch
avoids the copy when possible.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-07 18:27:06 +01:00
Elias Naur 41eb3807f7 op: assume aux ops are always wrapped by a macro
Shaves off a length, and prepares for further simplification.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 20:02:14 +02:00
Elias Naur 22cd88df9f all: rename the gioui.org/ui module to gioui.org
The "ui" is redundant and stutters.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 12:37:06 +02:00