Commit Graph

25 Commits

Author SHA1 Message Date
Matthias Clasen
d55da3fd44 Use GtkSnapshot getters
We can avoid direct struct access and gtksnapshotprivate.h
everywhere.
2018-03-11 00:31:44 -05:00
Timm Bäder
09750f9937 renderborder: Don't snapshot all-invisible borders
If all of the borders have an alpha of 0, we don't need to snapshot
anything.
2017-10-20 14:56:29 +02:00
Benjamin Otte
6055028c96 snapshot: Rename append APIs
Instead of having gtk_snapshot_append_foo_node(), just have
gtk_snapshot_append_foo(). Nobody needs to know that this internally
uses nodes.
2017-01-13 04:46:09 +01:00
Alexander Larsson
c00f8dce9f GtkSnapshot: Always use int for the translation
We already take ints when setting the translation, so it can't
currently take any other values. Additionally, I was seeing large
costs in int -> double -> int for the rects in
gtk_snapshot_clips_rect(), as all callers really are ints (widget
allocations) and the clip region is int-based.

This change completely cleared a 2% rectangle_init_from_graphene from
the profile and is likely to have nice performance effects elsewhere
too.
2017-01-11 16:14:03 +01:00
Alexander Larsson
65ad2541d7 Snapshot: Only record names if inspector is recording
Otherwise we do a lot of allocations and vprintf calls which are
not used.
2017-01-11 10:22:40 +01:00
Benjamin Otte
4d9eedafcd roundedbox: Add gtk_rounded_boxes_init_for_style()
Instead of making people intiialize a rectangle and then applying border
radius manually, provide a constructor that does it for them.
While doing that, also allow people to instead request the padding box
or the content box.

Refactor all relevant code to use this new constructor.
2016-12-20 18:01:12 +01:00
Benjamin Otte
95a2a5c54c gtk: Remove GtkJunctionSides 2016-12-20 18:01:12 +01:00
Benjamin Otte
75b76af221 gsk: Add GskBorderNode
The node draws a solid CSS border, which can be used to cover everything
but dashed and dotted borders (double, groove, inset, ...).

For different border styles, we overlay multiple nodes and set their
colors to transparent for sides with non-matching styles.
2016-12-20 18:01:11 +01:00
Benjamin Otte
9af468cdec gtk: Remove unused argument from function 2016-12-20 18:01:11 +01:00
Benjamin Otte
a9809e5d30 gsk: Add gsk_rounded_rect_shrink()
... and replace _gtk_rounded_box_grow() and _gtk_rounded_box_shrink()
with it.
2016-12-20 18:01:11 +01:00
Benjamin Otte
f96f16899d roundedbox: Remove _gtk_rounded_box_path()
Use gsk_rounded_rect_path() instead.

That's a private GSK function, be we can just include its header.
2016-12-20 18:01:10 +01:00
Benjamin Otte
e26f84fca0 gtk: Remove GtkRoundedBox struct
Use GskRoundedRect instead.
2016-12-20 18:01:10 +01:00
Emmanuele Bassi
4cbe079767 Use Graphene init macros for compound literals
The Graphene init macros can now be used for compound literals, which
means we need to update our mixed uses.
2016-11-21 16:21:38 +00:00
Benjamin Otte
79d2d0e40d snapshot: Add gtk_snapshot_render_background()
and gtk_snapshot_render_frame() to be direct replacements for the
old gtk_render_*() functions.

Use them to replace Cairo usage completely in gtk_window_snapshot().
2016-11-15 17:48:45 +01:00
Benjamin Otte
e4a485dca2 renderborder: Add API to query the outline clip
And use it in implementation of gadgets.
2016-02-21 01:02:51 +01:00
Benjamin Otte
e2d966eda5 cssnumbervalue: Remove gtk_css_number_value_get_unit()
This is in preparation for calc(), as calc(50% - 5px) is valid CSS
but has 2 units. Instead, add a function to query a value's dimension
(so we can differentiate lengths from numbers) and add a function to
query if the value contains percentages.
2016-02-13 04:49:07 +01:00
Matthias Clasen
0ddc1eed19 Fix rendering of unsymmetric borders
There was an errant path that threw off our clipping for
the top section of the border.

https://bugzilla.gnome.org/show_bug.cgi?id=722937
2016-01-09 23:44:43 -05:00
Matthias Clasen
caaf537f94 Avoid division by 0 in the border rendering code
We skip sides with 0 border width in render_border, but when
we collect sides with the same style, we may pass the 0 width
down to render_frame_stroke anyway. So skip width 0 sides
there as well.
2016-01-09 23:44:43 -05:00
Matthias Clasen
12bc8ddb93 Fix dobule border rendering
This is the same fix that was applied for ridge and groove
style in 9f27ee7f5a.
2016-01-09 14:37:04 -05:00
Benjamin Otte
42fdfb6af4 renderborder: Actually draw the path as one element
Avoids spurious lines that can sometimes be seen going towards the
center of the widget.
2015-12-16 05:15:04 +01:00
Cosimo Cecchi
9ba94849e8 GtkRenderBorder: make one function static 2015-11-21 14:55:13 -08:00
Benjamin Otte
9f27ee7f5a render: Fix ridge/groove border rendering
The typo strikes again!
2015-06-23 22:33:40 +02:00
Benjamin Otte
ba06066158 border: Don't special case according to border styles
This is now done (as it should) in the compute code.
2015-01-21 16:22:30 +01:00
Benjamin Otte
8b6d419e02 render: Move border rendering into its own file
gtkrenderborder.c now contains the implementation for
  gtk_css_style_render_border
  gtk_css_style_render_outline
2015-01-20 06:30:19 +01:00
Benjamin Otte
717877dff2 render: Rename gtkborderimage.[ch]
I want the gtkrender prefix for all filenames about rendering.
2015-01-20 06:30:18 +01:00