| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
When the css is validated we know the css size, so we can
create the paintable at that point, and we do so passing the
LOAD_IN_THREAD flag.
This causes us to load most icons early on, in parallel instead of
during the first snapshot.
|
|
|
|
|
| |
We now always return something from icon theme lookups, so no need to
do custom fallbacks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We had a pretty complex setup where we tried to avoid scaling up themes from dirs
that specified a size. However, not only was it very complex, but it didn't quite
work with window scales, because when using e.g. a size 32 directory for 16@2x
the dir size is wrong anyway. Additionally it turns out most code either picks
an existing icon size, or uses the FORCE_SIZE flags, so it doesn't seem
like a useful behaviour.
This change drops the FORCE_SIZE flags, and always scales
icons. Additionally it moves the scaling of the icon to rendering,
which seems more modern, and allows us to (later) share icons loaded
for different sizes that happened to use the same source file (at
different scales).
Note that this changes the behaviour of
gtk_icon_paintable_download_texture() is it now returns the unscaled
source icon. However, ignore thats, as I plan to remove this function
and replace it with a way to render a paintable to a cairo-surface
instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It never makes sense to paint a texture that needs recoloring. If
you call the regular snapshot on a symbolic texture we just use the
default recoloring colors.
To support this we also change gtk_css_style_snapshot_icon_paintable()
to call gtk_icon_paintable_snapshot_with_colors() for IconPaintables
so that we get the correct colors, and we make it not emit the color
matrix.
Since we now rely on the icon to do the recoloring we also drop the
recolor argument in gtk_icon_paintable_snapshot_with_colors() as its
not needed anymore.
|
| |
|
|
|
|
|
|
|
|
|
| |
Instead, rely on people passing fallbacks explicitly.
Alternatively, GThemedIcon provides the functionality to create
fallbacks, which is what GtkImage and the testsuite now use.
That method is slightly better, too, so the expected test results
have been updated accordingly.
|
|
|
|
| |
This way, we can remove gtk_icon_theme_choose_icon() completely.
|
|
|
|
| |
It's unused.
|
|
|
|
|
|
| |
Most users were just forgetting to set the proper flags.
And flags aren't the right way to set this anyway, it was just
acceptable as a workaround during GTK3 to not break API.
|
|
|
|
|
|
|
| |
Widgets would not use them properly. In fact, the only user was using
them wrong.
As icons are loaded async by default, this call isn't necessary.
|
|
|
|
|
|
|
|
|
| |
We look at whether a widget will be mapped (the actual state is not
yet set, so we can't rely on that at css validation time) and use
that to set the i/o priority of the async task.
This means that its likely that widgets that will be displayed soon
are loaded before those that are not yet going to be needed.
|
|
|
|
|
|
|
| |
This limits the amount of preloading we to, which can for instance
avoid trashing if the icon cache is full, and in general do less work
when its likely to be wasted such as when e.g. background-color for an
icon helper changes.
|
|
|
|
|
| |
This is set on the GTask and lower priority will be loaded before,
this can be used to prioritize some icons for preloading.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
At the end of GtkImage css validation (during style-updated) when the
css properties (like the icon size) are valid we call _gtk_icon_helper_preload
which does an async icon theme lookup and load. This will happen on a thread
in parallel with the rest of the css machinery, and hopefully by the
time we need the icon it will be ready. If not we will block when we need
it, but during that blocking all the other icons will be loaded.
Testing widget-factory this changes the time of snapshot() from 31 to
25 msec, but on the other hand we also load a few more icons that we
didn't before causing the css validation phase to be about 8 msec slower.
This is because we're preloading all the images in the window, not only
the ones that are visible.
Unfortunately we still load a bunch of icons in snapshot(), from
GtkCssImageIconTheme, and ideally we should try to preload those also.
|
|
|
|
|
| |
This was hitting every time we looked up an icon, and we already
log the actual load of the icon in the icon theme.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Replace uses of gtk_css_style_get_value with direct access,
throughout the tree. We don't replace all uses, just those
where we are dealing with a fixed property. Be careful to
handle the currentColor special case for color properties.
|
|
|
|
|
|
| |
We want to differentiate what requires recreating the
texture and what doesn't. In particular, the current
flags are not handling symbolic icons right.
|
|
|
|
|
| |
These mainly happen during the first frame, causing
it to be longer than 'normal' frames.
|
|
|
|
| |
It's the same as load_icon now.
|
|
|
|
| |
Loading an icon might fail.
|
|
|
|
|
|
| |
This is happening for me when snapshotting small thumbnails in the file
chooser. The GtkScaler will scale the 1px height/width by 2, resulting
in nothing being drawn at all.
|
|
|
|
|
| |
GtkImage already does something similar so we often end up with 0/0
here. Avoid the save()/restore() calls in GtkSnapshot in that case.
|
| |
|
|
|
|
|
| |
Empty helpers did try to draw a NULL paintable (not good) and in the
non-null case code used the wrong width/height.
|
| |
|
|
|
|
|
| |
It's always -gtk-icon-size in both directions, even for paintables.
There's no width-for-height happening.
|
|
|
|
|
| |
No more special casing for paintables. If you want the special case for
paintables, you should use GtkPicture.
|
| |
|
|
|
|
|
|
| |
This makes height-for-width actually work for GtkImage.
I'm kinda ashamed I didn't notice it not working before.
|
| |
|
|
|
|
|
|
| |
Instead of fiddling around with scale in the iconhelper (and getting it
wrong), create a GtkScaler around the paintable that takes care of the
scaling.
|
|
|
|
|
|
|
|
|
| |
That's kinda weird but allows us to delete the texture case from
GtkIconHelper and GTK_IMAGE_TEXTURE from the GtkImageType enum.
And it doesn't cause any other problems because the cell renderer
can't deal with paintables - otherwise it would mirror GtkImage and have
a "paintable" property instead.
|
|
|
|
|
|
|
|
| |
If set, the image will draw its contents while keeping their aspect
ratio. That means empty areas show up on the top/bottom or left/right.
Also move the special-case snapshotting code for icons to
GtkIconHelper. That's where it belongs.
|
|
|
|
|
|
|
|
| |
This only implements the vfuncs, but does not actually emit signals
yet.
It's also not useed for anything other than snapshot() so far, this
will come in later commits.
|
|
|
|
|
|
|
| |
Lots of special cases that are no longer needed because no code uses
surfaces.
Also remove the GdkCellRendererPixbuf:surface property.
|
|
|
|
|
|
|
|
|
|
| |
Instead of loading them into surfaces (which we want to get rid of), we
load into textures.
In fact, we introduce a new paintable subclass called a GtkScaler that
takes care of tracking scaling.
This also ideally gets rid of an extra conversion once renderers learn
to render textures directly.
|
|
|
|
| |
We will need that in the next commits.
|
| |
|
|
|
|
|
| |
GtkImage will now allow paintables to be rendered to the full image and
the image will be sized according to CSS rules for image sizing.
|
|
|
|
|
|
| |
There are no more icon sizes, this is now the default size we render at.
This naming change is kinda relevant because of CSS terminology.
|
|
|
|
|
|
| |
This includes adding support to GtkImageDefintion and GtkIconHelper.
Only GtkImage handles support for signals from the paintable.
|
|
|
|
|
|
|
|
|
|
| |
This is in preparation for accepting the image type paintable.
It's a bit incovenient because we need more code to track width/height
ourselves (as the paintable no longer does it for us), but it's not too
hard.
GtkIconHelper does not track invalidations on the paintable.
|
|
|
|
| |
We can just get the texture directly from the icontheme.
|
| |
|
|
|
|
|
|
|
|
| |
Instead of looking at the icon size, look at the CSS value for
-gtk-icon-size. Set style classes depending on icon size instead.
Trivially change Adwaita and HighContrast to report the same values as
before.
|