Commit Graph

1147 Commits

Author SHA1 Message Date
Timm Bäder
8388791f87 GskTransform: Remove useless fmod check
All angles are in the [0; 360[ range
2020-02-07 13:16:32 -05:00
Timm Bäder
cbb05a3eab GskTransform: add assertions to make normalize_angle() intentions clear
360deg should be expressed as 0deg and no angle should ever be
negative.
2020-02-07 13:16:32 -05:00
Timm Bäder
75ef8d8a50 GskRoundedRect: Inline graphene_rect_contains_rect
Brings gsk_rounded_rect_contains_rect down from 0.54% to 0.14% when
rendering rounded backgrounds.
2020-02-07 13:16:32 -05:00
Benjamin Otte
7e8d8218b9 Revert "Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()"
We're not in the business of adding Cairo APIs. That's Cairo's job.

Also, we don't need this API anywhere like the original commit claimed,
so there's no need to make it available in any way.

This reverts commit afa6cc2369.
2020-02-04 16:43:59 +01:00
Alexander Larsson
afa6cc2369 Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()
This is useful in some parts of the icon theme APIs.
2020-01-29 19:06:16 +01:00
Timm Bäder
05b9a99661 gsk: Remove some unused defines
These are from the GVariant days of render nodes.
2020-01-26 18:21:07 +01:00
Timm Bäder
77e0d360ed Add pure and const annotations to various functions 2020-01-26 18:21:07 +01:00
Timm Bäder
f62535affc gl renderer: Avoid some work when rendering border nodes 2020-01-26 18:21:07 +01:00
Matthias Clasen
a297129685 Add a profiler mark around renderer realization
This takes time that is worth calling out.
2020-01-25 01:28:24 -05:00
Timm Bäder
f80a341b4f gl renderer: handle cross-fade nodes with invisible children 2020-01-24 06:19:16 +01:00
Timm Bäder
77f8245c0c gl renderer: Handle blur nodes with invisible children 2020-01-24 06:19:16 +01:00
Timm Bäder
8afdbd6ee3 gl renderer: Make render_rounded_clip_node clearer 2020-01-24 06:19:16 +01:00
Timm Bäder
ab0869ecbc gl renderer: Add builder offset correctly for non-affine modelviews 2020-01-24 06:19:16 +01:00
Timm Bäder
cff8304133 GskTransform: Add gsk_transform_transform_point()
Equivalent of gsk_transform_transform_bounds() and
graphene_matrix_transform_point() respectively.
2020-01-24 06:19:12 +01:00
Timm Bäder
962e38c5c9 gl renderer: Shorten shaders a bit 2020-01-24 06:08:39 +01:00
Timm Bäder
685288216f gl renderer: Move rect transformation to the vertex shader
No need to do this for every fragment.
2020-01-24 06:08:39 +01:00
Timm Bäder
c8fa1f19db gl renderer: Transform rounded rect on the GPU
Change the RoundedRect struct we use in our shaders so we can transform
it using (affine) matrices.
2020-01-24 06:08:39 +01:00
Matthias Clasen
1565f597c8 gl: Disambiguate profiler marks
"render" was used for both GL and widgets. Oops.
2020-01-22 16:37:48 -05:00
Timm Bäder
433c8307b2 gl renderer: Pull a local variable in the closest scope 2020-01-18 08:49:52 +01:00
Timm Bäder
dc8dedce07 gl renderer: Draw outset shadows white
and only apply the actual shadow color when we draw them from the
texture. This way we can reuse the cached shadows during color
transitions.
2020-01-18 08:49:52 +01:00
Timm Bäder
3091679ffa gl renderer: Render simple border nodes in a simple way
Roughly 80% of the border nodes are just one color and have the same
width on all sides, so we can draw them by uploading just one rect and
not four.
2020-01-18 08:49:52 +01:00
Timm Bäder
afa991752c gl renderer: Look at shadow color in the outset shadow cache
It would probably be better to not do this and always render the outline
in plain white, then later recolor it but do this for no, just for
correctness.
2020-01-18 08:49:51 +01:00
Chun-wei Fan
a9b1d4a389 build: Check for sincosf()
sincosf() is really a GCC-specific function that may more may not be
supported on non-GCC compilers, so we want to check for it, otherwise we
use a fallback implementation, not unlike the one in
demos/gtk-demo/gtkgears.c.
2020-01-08 17:15:29 +08:00
Timm Bäder
ea810f176b gl renderer: Handle repeat nodes with invisible children
We can handle this pretty easily by normally drawing the other
(visible) child node, if any.
2020-01-07 17:27:19 +01:00
Timm Bäder
7669e6e42e transform: Properly compare scale transforms
If the epsilon we use there is too much, we can run into rendering
errors because the GPU will use the actual scale value.
2020-01-07 17:27:19 +01:00
Timm Bäder
6ba6f361be gltextureatlas: Packing must succeed here 2020-01-07 17:27:18 +01:00
Timm Bäder
7a27122dab transform: Scale+translate bounds directyl
Make these two code paths look the same.
2020-01-07 17:27:18 +01:00
Timm Bäder
ca4ae81170 transform: Compare class before ->next 2020-01-07 17:27:18 +01:00
Timm Bäder
76795ffba9 gl renderer: Sprinkle some const around 2020-01-07 17:27:18 +01:00
Timm Bäder
eebe67cf0a gl renderer: Add util to load vertex data with texture region 2020-01-07 17:27:18 +01:00
Timm Bäder
b9726901a5 gl renderer: Fix inverted dy in inset shadows 2020-01-07 17:27:17 +01:00
Timm Bäder
8b1af398a0 gl renderer: Avoid another manual rounded rect transform
We have transform_rect() for this now.
2020-01-07 17:27:17 +01:00
Timm Bäder
b8d1c3ab55 gl renderer: Don't force repeat node child offscreen 2020-01-07 17:27:17 +01:00
Timm Bäder
054d69aaf9 gl renderer: Fix a misleading comment 2020-01-07 17:27:17 +01:00
Timm Bäder
1dea6d4fc7 gl renderer: Speed up bounds transformation
We started saving the scale of the current modelview directly in the
RenderOpBuilder, so we don't need to poke the modelview stack anymore.
2020-01-07 17:27:17 +01:00
Timm Bäder
022d19a4c6 gl renderer: Add debug code for color nodes 2020-01-07 17:27:17 +01:00
Timm Bäder
ef7276c398 gl renderer: Trivial variable reordering 2020-01-07 17:27:17 +01:00
Timm Bäder
0a8ca49b5e gl renderer: transform border outline like everything else 2020-01-07 17:27:17 +01:00
Timm Bäder
74f18f71d3 gl renderer: Move work to the blur vertex shader 2020-01-07 17:27:17 +01:00
Timm Bäder
c0d4a6fc81 gl renderer: Avoid copying a matrix 2020-01-07 17:27:17 +01:00
Timm Bäder
766d4dff76 GskTransform: Compute sin/deg of 90deg rotations manually
Otherwise we might end up with inaccuracies, e.g. when
gsk_transform_transform_bounds()'ing bounds.
2020-01-07 17:27:17 +01:00
Timm Bäder
e62f135c6a GskTransform: Normalize angles
Make sure all angles are in the [0..365) range
2020-01-07 17:27:17 +01:00
Timm Bäder
587bc82c37 gl renderer: Print debug node message 2020-01-07 17:27:17 +01:00
Timm Bäder
750dc8dbe2 gl driver: Inline function into only caller 2020-01-07 17:27:17 +01:00
Timm Bäder
cb2f523994 rendernodes: Use floats for everything 2020-01-07 17:27:16 +01:00
Timm Bäder
db91b6dc61 gl renderer: Load vertex data directly into vertices GArray 2020-01-07 17:27:16 +01:00
Timm Bäder
44ac2d5abb gl renderer: Pass linear gradient stops to shaders directly
No need to copy them into the render ops like this.
2020-01-07 17:27:16 +01:00
Timm Bäder
d7df56b6cb gsk: Make GskColorStop.offset a float
Doesn't make sense for this to be double if everything else is float.
Also makes it possible to 'easily' pass this to the GPU.
2020-01-07 17:27:16 +01:00
Timm Bäder
b8aa51d522 gl renderer: Move more work to the vertex shaders 2020-01-07 17:27:16 +01:00
Timm Bäder
f79c807645 gl renderer: Don't invert offset value twice 2020-01-07 17:27:16 +01:00