[gtk/matthiasc/for-master: 8/11] cssfiltervalue: Implement drop-shadows




commit ea7185bdb1ba423495340a9b880e619a861064fd
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 5 21:37:14 2021 -0500

    cssfiltervalue: Implement drop-shadows
    
    We have all the pieces, so this is surprisingly easy.

 docs/reference/gtk/css-properties.md |  2 +-
 gtk/gtkcssfiltervalue.c              | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/docs/reference/gtk/css-properties.md b/docs/reference/gtk/css-properties.md
index 809669dd90..8fa9819fc7 100644
--- a/docs/reference/gtk/css-properties.md
+++ b/docs/reference/gtk/css-properties.md
@@ -129,7 +129,7 @@ done with
 |:-----------|:----------|:------|
 |color       | [CSS Color Level 3](https://www.w3.org/TR/css3-color/#foreground) | |
 |opacity     | [CSS Color Level 3](https://www.w3.org/TR/css3-color/#opacity) | |
-|filter      | [CSS Filter Effect Level 1](https://drafts.fxtf.org/filters/#FilterProperty) | CSS allows 
drop-shadow |
+|filter      | [CSS Filter Effect Level 1](https://drafts.fxtf.org/filters/#FilterProperty) | |
 |font-family | [CSS Fonts Level 3](https://www.w3.org/TR/css3-fonts/#font-family-prop) | defaults to 
gtk-font-name setting |
 |font-size   | [CSS Fonts Level 3](https://www.w3.org/TR/css3-fonts/#font-size-prop) | defaults to 
gtk-font-name setting |
 |font-style  | [CSS Fonts Level 3](https://www.w3.org/TR/css3-fonts/#font-style-prop) | |
diff --git a/gtk/gtkcssfiltervalue.c b/gtk/gtkcssfiltervalue.c
index b1d1359f52..ecc225a925 100644
--- a/gtk/gtkcssfiltervalue.c
+++ b/gtk/gtkcssfiltervalue.c
@@ -677,7 +677,7 @@ gtk_css_filter_print (const GtkCssFilter *filter,
       break;
 
     case GTK_CSS_FILTER_DROP_SHADOW:
-      g_string_append (string, "drop_shadow(");
+      g_string_append (string, "drop-shadow(");
       _gtk_css_value_print (filter->drop_shadow.value, string);
       g_string_append (string, ")");
       break;
@@ -797,7 +797,7 @@ gtk_css_filter_parse_shadow (GtkCssParser *parser,
 {
   GtkCssValue **values = data;
 
-  values[n] = _gtk_css_shadow_value_parse_filter (parser);
+  values[n] = gtk_css_shadow_value_parse_filter (parser);
   if (values[n] == NULL)
     return 0;
 
@@ -960,8 +960,7 @@ gtk_css_filter_value_push_snapshot (const GtkCssValue *filter,
             }
           else if (filter->filters[j].type == GTK_CSS_FILTER_DROP_SHADOW)
             {
-              if (!gtk_css_shadow_value_push_snapshot (filter->filters[j].drop_shadow.value, snapshot))
-                gtk_snapshot_push_debug (snapshot, "Shadow Filter omitted");
+              gtk_css_shadow_value_push_snapshot (filter->filters[j].drop_shadow.value, snapshot);
             }
           else
             g_warning ("Don't know how to handle filter type %d", filter->filters[j].type);
@@ -993,8 +992,10 @@ gtk_css_filter_value_pop_snapshot (const GtkCssValue *filter,
       if (i < j)
         gtk_snapshot_pop (snapshot);
 
-      if (j < filter->n_filters)
+      if (filter->filters[j].type == GTK_CSS_FILTER_BLUR)
         gtk_snapshot_pop (snapshot);
+      else if (filter->filters[j].type == GTK_CSS_FILTER_DROP_SHADOW)
+        gtk_css_shadow_value_pop_snapshot (filter->filters[j].drop_shadow.value, snapshot);
 
       i = j + 1;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]