Commit Graph

26 Commits

Author SHA1 Message Date
Benjamin Otte
598f86eaf3 cssvalue: Convert shadows to GtkCssColorValue 2012-11-08 23:34:29 +01:00
Cosimo Cecchi
17760bd2eb cssshadow: plug a cairo_surface_t leak
We were never destroying the cairo surface we use for blurring, which
would lead to a huge leak.

https://bugzilla.gnome.org/show_bug.cgi?id=686209
2012-10-16 13:07:51 -04:00
Benjamin Otte
1454ba15ba css: Huge refactoring to avoid computing wrong values
Here's the shortest description of the bug I can come up with:
When computing values, we have 3 kinds of dependencies:
(1) other properties ("currentColor" or em values)
(2) inherited properties ("inherit")
(3) generic things from the theme (@keyframes or @define-color)
Previously, we passed the GtkStyleContext as an argument, because it
provided these 3 things using:
(1) _gtk_style_context_peek_property()
(2) _gtk_style_context_peek_property(gtk_style_context_get_parent())
(3) context->priv->cascade

However, this makes it impossible to lookup values other than the ones
accessible via _gtk_style_context_peek_property(). And this is exactly
what we are doing in gtk_style_context_update_cache(). So when the cache
updates encountered case (1), they were looking up the values from the
wrong style data.

So this large patch essentially does nothing but replace the
context argument in all compute functions with new arguments for the 3
cases above:
(1) values
(2) parent_values
(3) provider

We apparently have a lot of computing code.
2012-09-28 18:27:49 +02:00
Benjamin Otte
cca8cd2b21 Revert "blur: Use recording surface for capturing things to blur"
This reverts commit f2cb8f1270.

The patch actually didn't work for at least text. I currently have no
clue why, but I suspect it requires investigating Cairo code and
recording surfaces, and I'll not do that right now.
2012-09-21 18:51:46 +02:00
Benjamin Otte
f2cb8f1270 blur: Use recording surface for capturing things to blur
This gets around clipping issues quite nicely and provides us with a
(mostly theoretical) performance boost.
2012-09-20 02:45:42 +02:00
Andrea Cimitan
3377271ef0 shadow: add blur to icon-shadow (spinner) 2012-09-20 02:45:42 +02:00
Andrea Cimitan
10e2684870 shadow: add blur to icon-shadow (icon) 2012-09-20 02:45:42 +02:00
Andrea Cimitan
7c3864ba79 shadow: add blur to box-shadow 2012-09-20 02:45:42 +02:00
Andrea Cimitan
59eb3ef30e shadow: add blur to text-shadow 2012-09-20 02:45:41 +02:00
Cosimo Cecchi
b609686133 shadow: add code to render blurred shadows
Split out the blurred shadow rendering in three steps:
- creation of a surface of the appropriate size - we use the clip
  rectangle as a good measurement for the size, since we won't render
  out of it anyway
- painting the unblurred shape on the surface - this is responsibility
  of the single shadow implementations
- blur the surface and compose the result back on the original cairo_t

This means we can share code between the implementations for the first
and third steps; it also makes the code independent of the rendered
size, so we can avoid passing down a cairo_rectangle_t with e.g. the
icon coordinates.
2012-09-20 02:45:41 +02:00
Benjamin Otte
e3fc081c5d cssvalue: Pass property ID to transition function
This is to allow animating arrays properly. I'm not really thrilled
about this solution (we leak propertys into the values again...), but
it's the best I can come up with - I prefer it to having N different
array types...
2012-09-03 12:54:14 +02:00
Matthias Clasen
27fd3fdf81 css: Handle some more simple cases of dependencies 2012-08-28 15:42:24 +02:00
Benjamin Otte
0e2f35ed88 css: Introduce dependencies for value computations
When values are computed, they might depend on various other values and
we need to track this so we can update the values when those other
values change. This is the first step in making that happen.

This patch does not do any dependency tracking at all, instead it uses
GTK_CSS_DEPENDS_ON_EVERYTHING as a sort of FIXME.
2012-08-28 15:42:23 +02:00
Benjamin Otte
09f9fd42b4 css: Fold color value computation into gtksymboliccolor.c
This gets rid of the public function
_gtk_css_rgba_value_compute_from_symbolic().
The fallback is now handled using a switch statement instead of letting
the caller pass the function.
2012-08-28 15:40:56 +02:00
Benjamin Otte
9b4ed66218 css: Pass property_id to compute function
This is a reorganization of how value computing should be done.
Previously the GtkCssStyleProperty.compute vfunc was supposed to take
care of special cases when it needed those for computation. However,
this proved to be very complicated in cases where values were nested and
only the last value (of a common type) needed to be special cased.

A common example for this was the fallback handling for unresolvable
colors.

Now, we pass the property's ID along with all compute functions so we
can do the special casing where it's necessary.
Note that no actual changes happen in this commit. This will happen in
follow-ups.
2012-08-28 15:40:56 +02:00
Benjamin Otte
9b953829fb css: Introduce _gtk_css_value_compute()
This commit is essentially a large reorganization. Instead of all value
subtypes having their own compute function, there is the general
_gtk_css_value_compute() function that then calls a vfunc on the
subtype.
2012-08-28 15:40:56 +02:00
Cosimo Cecchi
fd549e432f cssshadow: plug a memory leak 2012-05-01 15:03:47 -04:00
Benjamin Otte
333a5b4307 cssshadow: Default fallback color is transparent
... not the current color. Fixes unresolvable.ui test.
2012-05-01 03:13:02 +02:00
Benjamin Otte
0111b9d507 symboliccolor: Treat it as a CssValue
.. now that it is one.
2012-04-17 08:59:20 +02:00
Benjamin Otte
51da8cb263 symboliccolor: Parse 'currentColor' everywhere 2012-04-17 08:59:20 +02:00
Benjamin Otte
c366b5b8b7 shadow: Add equal and transition support
... and enable transitions for the shadow properties.
2012-04-17 08:59:18 +02:00
Benjamin Otte
b8ccda4140 shadow: Rewrite to store contents as values 2012-04-17 08:59:17 +02:00
Benjamin Otte
7bdcba189e shadow: Make color a GtkCssValue 2012-04-17 08:59:17 +02:00
Benjamin Otte
ca17270187 cssvalue: Make GtkCssShadowValue only hold one shadow
All the properties now are a GtkCssArrayValue of GtkCssSadowValue.
GtkCssArrayValue already does everything we want, so no need to
duplicate its funtionality.
2012-04-17 08:59:17 +02:00
Benjamin Otte
1a9dfab825 cssvalue: Add _gtk_css_value_transition()
Returns a value that transitions between start and end or %NULL if the
values cannot be transitioned.

So far, all implementations but numbers and rgba return NULL.
2012-04-17 08:59:15 +02:00
Benjamin Otte
645309e98b shadow: Also rename files 2012-04-17 08:59:14 +02:00