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.
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.
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.
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.
This replaces the box gradient with a new implementation that
behaves like the HTML Canvas element, by applying a gaussian
blur to the alpha of the rectangle to shadow.
The drop-shadow-blur property is changed to be now just a "level", like
the HTML Canvas shadowBlur property, which is defined to be half of the
standard deviation of the gaussian blur to be applied.
We don't need a property reference anymore, a plain image reference is fine AFAICS.
Dirtyness of the source is tracked on the caller side of layouting_info()
or in the draw_image_impl anyway.
Rendering tests/cases/examples/rectangle_clip.60 shows a border radius
for the clipped area that's not identical with the border radius of the
inner edge of the rectangle stroke.
It appears that the stroke's inner radius is not exactly the difference
of the line (border) width but rather scaled by kappa.
Fix issue in
https://github.com/sixtyfpsui/sixtyfps/issues/207#issuecomment-825780094
For the purpose of alignment, we need to use the font height, not the actual
text height, because otherwise it does not look visualy centered if the
text does not have letters that goes under the baseline
When rendering into a layer, we applied the y coordinate system flip
using a transform. That transform is incompatible with
Canvas::fill/stroke_text, which uses transform_point to transform the
glyph quads. That appears to not work, as opposed to the
y-flip in the main vertex shader.
Fortunately we can work around it by doing the flip when rendering the
layer image (as part of the fill).
Closes#199
As reported in issue #176 , there is a difference between the rendering
with Qt and femtovg. It appears that this is due to incorrect
assumptions about whether the rgb values in the intermediate buffer
image for colorization have the alpha-channel pre-multiplied or not.
When rendering into the image buffer, we would pre-multiply the alpha,
but when rendering the buffer itself, femtovg's fragment shader would
assume texture type 2 and multiply the alpha again. Therefore set the
image flag to avoid that.
For rendering itself as well as font_metrics() queries, store the result
in the item's rendering cache. This will be needed as the lookup is
about to become more expensive due to the need of calling OS functions
that do text analysis to determine a list of fallback fonts.
When text hasn't changed but we re-render items or re-do the layout, we
need that to be cached.
Pass everything needed for delayed evaluation for
`PlatformWindow::font_metrics()` to permit caching the font matching
result in the Text/TextInput's rendering cache.
We query text metrics frequently for text items, for example when in
layouts. This requires font resolution, which is about to become more
much more expensive due to analysis of the underlying text. To speed
this up, the objective is to use the item rendering cache. Making that
work in turn requires querying all related properties inside a property
tracker. That means we need to delay querying anything related to that,
including the font request needed for the `font_metrics()` function on
the PlatformWindow trait.