In this case, the last line will have elipsis on the last line
when no more line can be printed
Note that the behavior is different with the Qt backend
Glutin's desire to default to srgb mysteriously creates a black window
on Windows 10 under Vmware. I tested this with many glutin apps and examples,
they all exhibit the same: black window,
working when query for srgb is turned off.
This used to work, so I suspect some change underneath on the vmware svga
driver perhaps, or Windows.
This requires the image size query to be window independent and go
through the backend instead.
This implies minor changes for the Qt backend and bigger ones for the GL
backend:
* There exists now a thread-local IMAGE_CACHE, which is used by the
backend's image_size() function as well as by the renderer for
loading CPU side images.
* The image remain as decoded images in there (including SVG tree)
and the window now has a texture_cache, which holds CachedImage
with ImageData::Texture.
* Rendering an image item therefore fetches the CPU side image,
calls upload_to_gpu() on it, which creates a new Rc<CachedImage>
and that's stored in the texture_cache.
* The texture cache continues to be pruned when hiding the window.
Split the vertical and horizontal pass into different property cache
This will allow to implement "height for with"
This patch does not port the Rust or C++ binding yet
When a Text element has wrapping enabled, it should not have zero
minimum size. Otherwise the layout will give it a height of zero in the
layout in the test case and that'll make the text disappear. There are
different options but this patch goes for minimum height as if no
wrapping was enabled (so at least one line plus forced line breaks).
Fixes#246
By moving the image cache to the GraphicsWindow we can now decode images
first without a window and later upload to the GPU.
This also allows removing the window_map_pending property hack.
Decouple the Texture from the HTML image loading logic and introduce an
ImageData state that represents just the DOM element.
This will make it possible later to also load the images without a canvas.
Instead a "manual" refresh is needed (like mouse mover). This regressed
in commit 8d2554ff3b, which removed the
event loop proxy clone. For some reason that's not sending the event
from the DOM callback, but winit requires a clone of the proxy.
the must_resize was not set to true when the with and height are set to the prefered
size, but it must be set for the layout to apply.
Note that even with this patch, the window will be resized to the preferred
size when reloading. Because we have no way to know there if this is the first time
the window is shown, or not.
This issue is not quite specific to the gallery, a simpler test case is
this:
```
App := Window {
preferred-width: 500px;
preferred-height: 750px;
HorizontalLayout {
Rectangle {
background: blue;
}
}
}
```
As there is no fixed width/height set, the size is calculated by layout and
apply_window_properties() sets the inner size correctly on the winit window.
However the width/height properties on the root Window item are not set, remain
zero and thus lead to incorrect rendering. They are not set because they are
identical with what window.inner_size() reports - we assume no change and that
they are in sync.
The bug however is in the creation phase, when we decide on an initial size to
pass to the window_builder, we should also set those on the root item. This is
where window.inner_size() and the root item's width/height get out of sync.
Properly release GL resource when unmapping a window and detect stale
cache indices using a generation count. This fixes the disappearing
images (GL textures would be invalid and need to be re-created) as well
as the panics when an item's cache index ended up being re-used because
some other item was drawn first and allocated that indices. The latter
is fixed by using a generational counter on the cache that's bumped when
clearing, instead of a single "cache_ok" bool.
Move the item graphics cache into the GraphicsWindow and then, together
with the new femtovg::TextContext, we can provide the metrics and can
stop using the window_map_pending notifier for this query.
With wasm there is no current context (can alwasy render) but we own the
winit::Window. With glutin own the ContextWrapper and have to make it
current (and resize). This patch hides all that behind the OpenGLContext
type.
This is primarly search & replace for now, slightly simplifying function
signatures.
However this paves the way to a thread-local font cache that can share
fonts across windows (not glyph atlas) and also measure without a canvas.
When we calculate the initial layout without a mapped window early on,
we end up with zero text metrics with the GL backend due to an API
limitation of femtovg.
While working on that, this patch introduces a workaround to mark the callers of
image_size() and font_metrics() as dirty when the window is mapped.
Let's keep source compatibility and define `drop-shadow-blur` to be a radius.
The CSS spec says that the standard deviation is half of the radius.
We just need to scale again and increase the shadow rect to make sure that no borders are visible.
Commit bb7b301b10 pulled in a branch of femtovg, which
had a change to its shader that used a variable in the loop condition.
That is unfortunately not supported in WebGL 1.0 / GLES 2.0.
The pinned femtovg works around that limitation.
Fixes#230