While here, merge BeginFrame and EndFrame; the split was done for
performance reasons, yet never measured.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Modern graphics APIs have immutable objects, with mutable data. For example,
a texture's dimensions are immutable, while the texture contents is not.
Change the GPU API abstraction to match.
Clearing a Texture is convenient to do with a plain []byte. Generalize
Texture.Upload to take a plain byte slice and introduce a helper function for
uploading *image.RGBA data.
Add TextureFormatRGBA8, a format for the linear RGB colorspace.
Add OpenGL ES 3.1 functions for compute programs.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Modern graphics APIs have immutable objects, with mutable data. For example,
a texture's dimensions are immutable, while the texture contents is not.
Change the GPU API abstraction to match.
Clearing a Texture is convenient to do with a plain []byte. Generalize
Texture.Upload to take a plain byte slice and introduce a helper function for
uploading *image.RGBA data.
Add TextureFormatRGBA8 a format for the linear RGB colorspace.
Add OpenGL ES 3.1 functions for compute programs.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The size is unchanged, but a corner is no longer encoded as two
16-bit ints (2*2 bytes); it is encoded as a float32 (1*4 bytes).
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Before this change, the entire byte buffer would be passed to WebGL, even
though its size may be (much) larger than the source data.
Remakably, this hasn't resulted in any problems until the use of
glBufferSubData, which require the passed data fits the buffer size.
As a bonus, this fix should speed up the wasm port by virtue of passing
much less data across the wasm<->js barrier.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
NewBackend was recently changed to take a context, which must only
be specified on GOOS=js.
Fixes gio#189
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The new compute backend shares drawOps but not GPU.Collect. This
change moves the common path cache code to drawOps.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Currently, on iOS, the keyboard can block the content since it doesn't
trigger the "resize". Now, the `insets` will provide the size of the
keyboard (on iOS) and scrollbars. It's compatible with the Android (and
desktop), but Chrome automatic resizes the windows, so the `Inset` will
be 0.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
The Mesa software OpenGL implementation strays enough from the
reference values that tests fail. Relax the tests to make them
pass again.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The mesa surfaceless renderer doesn't support configs, but does
support EGL_KHR_no_config_context so no config is required. Don't
fail context creation in this setup.
With this change, the headless tests work on a headless linux with the
EGL_PLATFORM environment variable set to "surfaceless".
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Apparently, darwin/arm64 cgo doesn't match the types of YES and BOOL:
os_macos.go:235:40: cannot use _Ciconst_YES (type untyped int) as type _Ctype__Bool
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Remove padding from the sides of the Slider to align them with
other components.
However, since sliders still need to be used with fingers try to
enforce a minimum finger height, if there is sufficient room.
The sides don't need similar treatment since after grabbing it's
possible to move the finger beyond the touch area, without losing
interaction.
To not enforce finger size, the theme can be adjusted:
theme.FingerSize = unit.Px(0)
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
Similar to the Android, which includes all .jar files into the .apk.
Now, the `gogio -target js` will include all `*_js.js` files
into the resulting `wasm.js`.
That change make possible to adds custom wasm-imports, which might
be used in future versions of Gio.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Now, gogio can build the program for Windows, using the `-target
windows`.
It will build with `-H=windowsgui`, by default. Also, it can compile for
multiple platforms if specified using `-target` (e.g. `-target arm, 386,
amd64`), the executable will have the respective suffix (i.e.
`_386.exe`).
gogio will also attach (any) appicon.png as executable icon resource and
include some information about the file and supported operating system.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
Knowing whether a widget is being interacted with allows to implement
bi-directional updates without feedbacks.
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
Previously, the keyboard is open by default, even without any focus.
Now, the keyboard will remain closed, until `.focus()` is called. That
change also prevents the keyboard from reopening immediately after blur.
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
"provided under terms" is a better match to the UNLICENSE, which puts
the project in the public domain the fullest extent possible.
This is a wording update, not a change in licesing terms.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This CL introduces 2 new path builders:
- Outline which takes a PathSpec to be outlined
- Stroke which takes a PathSpec and a stroke style, to stroke a path.
typically, code like this:
var p clip.Path
...
p.Outline().Add(o)
should be replaced with:
var p clip.Path
...
clip.Outline{Path: p.End()}.Op().Add(o)
similarly, stroking should be modified from:
var p clip.Path
...
p.Stroke(width, clip.StrokeStyle{...}).Add(o)
to:
var p clip.Path
...
clip.Stroke{Path: p.End(), Style: clip.StrokeStyle{Width:...}}.Op().Add(o)
here are tentative 'rf' scripts (see rsc.io/rf for more details):
```
ex {
import "gioui.org/op";
import "gioui.org/op/clip";
var p clip.Path;
var o *op.Ops;
p.Outline().Add(o) -> clip.Outline{Path:p.End()}.Op().Add(o);
}
ex {
import "gioui.org/op";
import "gioui.org/op/clip";
var o *op.Ops;
var p clip.Path;
var sty clip.StrokeStyle;
var width float32;
p.Stroke(width, sty).Add(o) -> \
clip.Stroke{ \
Path:p.End(), \
Style: clip.StrokeStyle{ \
Width: width, \
}}.Op().Add(o);
}
```
Signed-off-by: Sebastien Binet <s@sbinet.org>