Commit Graph

1264 Commits

Author SHA1 Message Date
Matthias Clasen
bab7092a69 Merge branch 'gl-linear' into 'master'
Gl: use linear interpolation

See merge request GNOME/gtk!2523
2020-09-07 21:27:09 +00:00
Matthias Clasen
d595c6ab12 gsk: Complain if we fail to realize a renderer
The only likely place where this is going to happen
is if a renderer was explicitly requested with the
GSK_RENDERER environment variable, and in that case,
it is misleading to silently use a different renderer.
2020-09-07 11:18:45 -04:00
Matthias Clasen
2738d5bc93 gsk: Mention gl as valid value for GSK_RENDERER 2020-09-07 11:18:45 -04:00
Matthias Clasen
e0cc7b5d86 Check for pixel-alignedness for interpolation
When rendering to an offscreen because of transforms,
check if transforming the bounds of the node results
in a non-axis-aligned quad. If it doesn't, we want
GL_NEAREST interpolation to get sharp edges. Otherwise,
we use GL_LINEAR to get better results for things
that are actually transformed.
2020-09-04 13:16:53 -04:00
Matthias Clasen
9843515736 gl: Reshuffle some code
Just rearrange the cases in this switch, no effective change.
2020-09-04 13:16:11 -04:00
Matthias Clasen
41497aeb8b Add gsk_matrix_transform_rect
This is a projecting version of the corresponding
graphene api. While we are at it, rewrite
gsk_matrix_transform_bounds() to use
gsk_matrix_transform_rect().
2020-09-04 13:15:21 -04:00
Matthias Clasen
e36b594867 Replace uses of graphene_matrix_transform_
Replace our uses of graphene_matrix_transform_point,
_point3d and _bounds by our own versions that handle
projective transforms correctly.

This fixes render node bounds being incorrect for widgets
involving projective transforms (e.g. testrevealer swing
transformations), and also fixes picking on such widgets.
2020-09-01 09:18:38 -04:00
Matthias Clasen
99a7a2188a gsk: Add some private transform apis
Some of the graphene_matrix_transform apis don't work
correctly with projective matrices, so add our own
variants.
2020-09-01 09:18:38 -04:00
Timm Bäder
51b398b960 rendernodes: Whitespace 2020-08-29 16:46:28 +02:00
Timm Bäder
c1c2205018 gl renderer: Adjust gaussian blur sigma
To look more like what browsers do.
2020-08-29 16:46:28 +02:00
Timm Bäder
2bff84ca6c gl: Adjust blur radius_multiplier
2.0 Looks much closer to what my browser does.

Fixes #2777
2020-08-29 16:46:25 +02:00
Timm Bäder
e970c69843 gsk: Fix border node diff implementation
This was showing up in the interactive constraint demo in gtk4-demo.
2020-08-29 11:11:29 +02:00
Alexander Larsson
d57e6b754f broadway: Prune fully clipped render nodes
If some node is fully outside the clip region we don't send it to the daemon.
This helps a lot in how much data we send for scrolling viewports.

However, sending partial trees makes node reuse a bit more tricky. We
can't save for reuse any node that could possibly clip different depending on
the clip region, as that could be different next frame. So, unless the
node is fully contained in the current clip (and we thus know it is not
parial) we don't allow reusing that next frame.

This fixes #3086
2020-08-26 18:08:00 +02:00
Alexander Larsson
4b1ea7c4a1 broadway: Track the clip region in the renderer
If we know what can't possibly be visible we may can later decide to
not expose a node.
2020-08-26 16:55:56 +02:00
Matthias Clasen
125ed52ccb Merge branch 'new-sysprof' into 'master'
Port profiling to sysprof-collector api

See merge request GNOME/gtk!2457
2020-08-21 23:58:09 +00:00
Matthias Clasen
d4e069a629 Port tracing to the sysprof collector api
Use the new sysprof collector api to do tracing.
2020-08-21 10:55:01 -04:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Matthias Clasen
9e5ddeaa8a gsk: Don't leak cairo nodes
Not chaining up in finalize is a leak, after all.
2020-08-06 18:35:41 -04:00
Rico Tzschichholz
7a58a6a097 gsk: Add annotations to improve GIR API 2020-07-31 20:56:36 +02:00
Matthias Clasen
6ab13a6303 gsk: Don't the always_inline function attribute
Visual C doesn't understand it, and the compiler
should know better, anyway.
2020-07-31 13:13:46 -04:00
Chun-wei Fan
d6955d4427 gskrenderer.c: Default to the GL renderer on Windows too
Since we have now made the Win32 GL contexts share the global context as
the other backends have, we are more ready to use the GL renderer by
default on Windows as well.

Note that currently we can only enable this when not running on
OpenGL/ES as the OpenGL/ES shaders are not ready at this point, and the
OpenGL/ES support that we have from libANGLE does not support full
desktop OpenGL operations.
2020-07-31 23:20:14 +08:00
Emmanuele Bassi
4fa891b55d Remove stray gtk-doc annotation
It confuses the g-i scanner, and gtk-doc.
2020-07-28 16:49:13 +01:00
Timm Bäder
ac1f242b6c gl renderer: Throw inset shadows with all !send values away 2020-07-28 05:34:12 +02:00
Timm Bäder
ebbb729aea gl renderer: Linear gradient state tracking 2020-07-28 05:34:12 +02:00
Timm Bäder
dded144313 gl renderer: Assert that we have program state
This is never a problem in reality, just for static analysis.
2020-07-28 05:34:12 +02:00
Timm Bäder
3f59566729 gl renderer: Repat node child bounds can't be NULL 2020-07-28 05:34:12 +02:00
Timm Bäder
e0420bae09 gl renderer: Remove dead code
We aren't using n_corners anyway
2020-07-28 05:34:12 +02:00
Timm Bäder
a3b452725b render nodes: Simplify diffing of uniform border nodes 2020-07-28 05:34:12 +02:00
Timm Bäder
9cdf9847c2 gl: Add a gdk_gl_context_has_debug accessor
Check if the label_object_ etc. functions are gonna do anything at all.
The g_type_name_from_instance calls keep poppoing up in profiles.
2020-07-28 05:34:12 +02:00
Timm Bäder
fa85ec5cf5 GskTransform: Restructure _to_affine and _to_translation
Make the simple cases more explicit.
2020-07-28 05:34:12 +02:00
Timm Bäder
0ce32cd4b5 gl renderer: Save rectilinearity in clip stack
So we don't have to repeatedly call it in pop_clip()
2020-07-28 05:34:12 +02:00
Timm Bäder
756b84033a GskTransform: Remove unused function from private header
We only use this in gsktransform.c
2020-07-28 05:34:12 +02:00
Timm Bäder
5a9b54df96 gl renderer: More color matrix state tracking 2020-07-28 05:34:12 +02:00
Timm Bäder
d7ba281c15 gl renderer: Add contains_rect helper 2020-07-28 05:34:12 +02:00
Timm Bäder
c6c87b97c2 gl renderer: Add own graphene_rect_intersects 2020-07-28 05:34:11 +02:00
Timm Bäder
2fa9dddea6 gsk: Remember border node uniformity
Lots of border nodes have all the same width and the same color.
Renderers might be able to simplifty that, so keep an extra bit per
border node.
2020-07-28 05:34:11 +02:00
Timm Bäder
72d4a83af8 gl renderer: Moar state tracking
Track what we really need to send for inset shadows, which are used
as a border replacement in many cases.

Fishbowl says I can draw around 200-300 more switches per frame like
this too.
2020-07-28 05:34:11 +02:00
Timm Bäder
fcf502a686 gl renderer: Fix scrolledwindow undershoot rendering 2020-07-28 05:34:11 +02:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Christian Hergert
9dbf99d91a macos: prototype new GDK backend for macOS
This is fairly substantial rewrite of the GDK backend for quartz and
renamed to macOS to allow for a greenfield implementation.

Many things have come across from the quartz implementation fairly
intact such as the eventloop integration design and discovery of
event windows from the NSEvent.

However much has been changed to fit in with the new GDK design and
how removal of child GdkWindow have been completely eliminated.
Furthermore, the new GdkPopup allows for regular NSWindow to be used
to provide popovers unlike the previous implementation.

The object design more closely follows the ideal for a GDK backend.

Views have been broken out into subclasses so that we can support
multiple GSK renderer paths such as GL and Cairo (and Metal in the
future). However mixed mode GL and Cairo will not be supported. Currently
only the Cairo renderer has been implemented.

A new frame clock implementation using CVDisplayLink provides more
accurate information about when to draw drawing the next frame. Some
testing will need to be done here to understand the power implications
of this.

This implementation has also gained edge snapping for CSD windows. Some
work was also done to ensure that CSD windows have opaque regions
registered with the display server.

     ** This is still very much a work-in-progress **

Some outstanding work that needs to be done:

 - Finish a GL context for macOS and alternate NSView for GL rendering
   (possibly using speciailized CALayer for OpenGL).
 - Input rework to ensure that we don't loose remapping of keys that was
   dropped from GDK during GTK 4 development.
 - Make sure input methods continue to work.
 - Drag-n-Drop is still very much a work in progress
 - High resolution input scrolling needs various work in GDK to land
   first before we can plumb that to NSEvent.
 - gtk/ has a number of things based on GDK_WINDOWING_QUARTZ that need
   to be updated to use the macOS backend.

But this is good enough to start playing with and breaking things which
is what I'd like to see.
2020-07-21 14:45:12 -07:00
Matthias Clasen
5df1356295 gsk: Remove an unused debug flag
GSK_DEBUG_DIFF was not used anywhere, so remove it.
2020-07-20 07:03:08 -04:00
Timm Bäder
37d7ab88dc gl renderer: Avoid 9-slicing things that can't be
The outline needs to be large enough so changing the size of the outline
does not affect the resulting blurred texture.

Fixes #2776
2020-07-17 05:49:11 +02:00
Timm Bäder
6cde64072d gl renderer: Remove outdated comment 2020-07-17 05:49:11 +02:00
Timm Bäder
6a60b0f591 gl renderer: Try to intersect rounded clips more often 2020-07-17 05:49:11 +02:00
Timm Bäder
339d9f05e4 gl renderer: Remove unused flag 2020-07-17 05:49:11 +02:00
Timm Bäder
34008e6aab gl renderer: Ignore rounded clip that only increase the clip
This fixes the widget factory rendering too much.

In the widget-factory, we generally have a pretty small update area (two
spinners and a progressbar). We take the extents of that as a update
area and inital clip.

However, the first clip node we see is from the toplevel window, which
essentially increases the clip again to almost the entire window.

Fix that by ignoring such cases.
2020-07-17 05:49:11 +02:00
Matthias Clasen
13b37b0ba4 gsk: Fix a transform leak
This was found by running our testsuite under asan.
2020-07-08 17:44:08 -04:00
Matthias Clasen
43b9fc6981 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2162
2020-07-01 01:35:56 +00:00