mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 06:10:21 +00:00
css: Replace custom blend modes with GskBlendMode
This commit is contained in:
parent
2118f394d2
commit
3e26fadb24
@ -137,26 +137,26 @@ static const GtkCssValueClass GTK_CSS_VALUE_BLEND_MODE = {
|
||||
};
|
||||
|
||||
static GtkCssValue blend_mode_values[] = {
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_COLOR_BURN, "color-burn" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_COLOR_DODGE, "color-dodge" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_COLOR, "color" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_DARKEN, "darken" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_DIFFERENCE, "difference" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_EXCLUSION, "exclusion" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_HARD_LIGHT, "hard-light" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_HUE, "hue" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_LIGHTEN, "lighten" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_LUMINOSITY, "luminosity" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_MULTIPLY, "multiply" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_NORMAL, "normal" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_OVERLAY, "overlay" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_SATURATE, "saturate" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_SCREEN, "screen" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GTK_CSS_BLEND_MODE_SOFT_LIGHT, "soft-light" }
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_DEFAULT, "normal" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_MULTIPLY, "multiply" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_SCREEN, "screen" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_OVERLAY, "overlay" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_DARKEN, "darken" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_LIGHTEN, "lighten" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_COLOR_DODGE, "color_dodge" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_COLOR_BURN, "color_burn" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_HARD_LIGHT, "hard_light" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_SOFT_LIGHT, "soft_light" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_DIFFERENCE, "difference" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_EXCLUSION, "exclusion" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_COLOR, "color" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_HUE, "hue" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_SATURATION, "saturation" },
|
||||
{ >K_CSS_VALUE_BLEND_MODE, 1, GSK_BLEND_MODE_LUMINOSITY, "luminosity" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_blend_mode_value_new (GtkCssBlendMode blend_mode)
|
||||
_gtk_css_blend_mode_value_new (GskBlendMode blend_mode)
|
||||
{
|
||||
g_return_val_if_fail (blend_mode < G_N_ELEMENTS (blend_mode_values), NULL);
|
||||
|
||||
@ -179,10 +179,10 @@ _gtk_css_blend_mode_value_try_parse (GtkCssParser *parser)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GtkCssBlendMode
|
||||
GskBlendMode
|
||||
_gtk_css_blend_mode_value_get (const GtkCssValue *value)
|
||||
{
|
||||
g_return_val_if_fail (value->class == >K_CSS_VALUE_BLEND_MODE, GTK_CSS_BLEND_MODE_NORMAL);
|
||||
g_return_val_if_fail (value->class == >K_CSS_VALUE_BLEND_MODE, GSK_BLEND_MODE_DEFAULT);
|
||||
|
||||
return value->value;
|
||||
}
|
||||
|
@ -27,9 +27,9 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * _gtk_css_blend_mode_value_new (GtkCssBlendMode blend_mode);
|
||||
GtkCssValue * _gtk_css_blend_mode_value_new (GskBlendMode blend_mode);
|
||||
GtkCssValue * _gtk_css_blend_mode_value_try_parse (GtkCssParser *parser);
|
||||
GtkCssBlendMode _gtk_css_blend_mode_value_get (const GtkCssValue *value);
|
||||
GskBlendMode _gtk_css_blend_mode_value_get (const GtkCssValue *value);
|
||||
|
||||
GtkCssValue * _gtk_css_border_style_value_new (GtkBorderStyle border_style);
|
||||
GtkCssValue * _gtk_css_border_style_value_try_parse (GtkCssParser *parser);
|
||||
|
@ -1378,7 +1378,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_CSS_AFFECTS_BACKGROUND,
|
||||
blend_mode_value_parse,
|
||||
NULL,
|
||||
_gtk_css_array_value_new (_gtk_css_blend_mode_value_new (GTK_CSS_BLEND_MODE_NORMAL)));
|
||||
_gtk_css_array_value_new (_gtk_css_blend_mode_value_new (GSK_BLEND_MODE_DEFAULT)));
|
||||
|
||||
gtk_css_style_property_register ("border-image-source",
|
||||
GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE,
|
||||
|
@ -23,40 +23,40 @@
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
cairo_operator_t
|
||||
_gtk_css_blend_mode_get_operator (GtkCssBlendMode mode)
|
||||
_gtk_css_blend_mode_get_operator (GskBlendMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case GTK_CSS_BLEND_MODE_COLOR:
|
||||
case GSK_BLEND_MODE_COLOR:
|
||||
return CAIRO_OPERATOR_HSL_COLOR;
|
||||
case GTK_CSS_BLEND_MODE_COLOR_BURN:
|
||||
case GSK_BLEND_MODE_COLOR_BURN:
|
||||
return CAIRO_OPERATOR_COLOR_BURN;
|
||||
case GTK_CSS_BLEND_MODE_COLOR_DODGE:
|
||||
case GSK_BLEND_MODE_COLOR_DODGE:
|
||||
return CAIRO_OPERATOR_COLOR_DODGE;
|
||||
case GTK_CSS_BLEND_MODE_DARKEN:
|
||||
case GSK_BLEND_MODE_DARKEN:
|
||||
return CAIRO_OPERATOR_DARKEN;
|
||||
case GTK_CSS_BLEND_MODE_DIFFERENCE:
|
||||
case GSK_BLEND_MODE_DIFFERENCE:
|
||||
return CAIRO_OPERATOR_DIFFERENCE;
|
||||
case GTK_CSS_BLEND_MODE_EXCLUSION:
|
||||
case GSK_BLEND_MODE_EXCLUSION:
|
||||
return CAIRO_OPERATOR_EXCLUSION;
|
||||
case GTK_CSS_BLEND_MODE_HARD_LIGHT:
|
||||
case GSK_BLEND_MODE_HARD_LIGHT:
|
||||
return CAIRO_OPERATOR_HARD_LIGHT;
|
||||
case GTK_CSS_BLEND_MODE_HUE:
|
||||
case GSK_BLEND_MODE_HUE:
|
||||
return CAIRO_OPERATOR_HSL_HUE;
|
||||
case GTK_CSS_BLEND_MODE_LIGHTEN:
|
||||
case GSK_BLEND_MODE_LIGHTEN:
|
||||
return CAIRO_OPERATOR_LIGHTEN;
|
||||
case GTK_CSS_BLEND_MODE_LUMINOSITY:
|
||||
case GSK_BLEND_MODE_LUMINOSITY:
|
||||
return CAIRO_OPERATOR_HSL_LUMINOSITY;
|
||||
case GTK_CSS_BLEND_MODE_MULTIPLY:
|
||||
case GSK_BLEND_MODE_MULTIPLY:
|
||||
return CAIRO_OPERATOR_MULTIPLY;
|
||||
case GTK_CSS_BLEND_MODE_OVERLAY:
|
||||
case GSK_BLEND_MODE_OVERLAY:
|
||||
return CAIRO_OPERATOR_OVERLAY;
|
||||
case GTK_CSS_BLEND_MODE_SATURATE:
|
||||
return CAIRO_OPERATOR_SATURATE;
|
||||
case GTK_CSS_BLEND_MODE_SCREEN:
|
||||
case GSK_BLEND_MODE_SATURATION:
|
||||
return CAIRO_OPERATOR_HSL_SATURATION;
|
||||
case GSK_BLEND_MODE_SCREEN:
|
||||
return CAIRO_OPERATOR_SCREEN;
|
||||
|
||||
case GTK_CSS_BLEND_MODE_NORMAL:
|
||||
case GSK_BLEND_MODE_DEFAULT:
|
||||
default:
|
||||
return CAIRO_OPERATOR_OVER;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define __GTK_CSS_TYPES_PRIVATE_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gsk/gsk.h>
|
||||
#include <gtk/gtkstylecontext.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -231,25 +232,6 @@ enum { /*< skip >*/
|
||||
GTK_CSS_PROPERTY_N_PROPERTIES
|
||||
};
|
||||
|
||||
typedef enum /*< skip >*/ {
|
||||
GTK_CSS_BLEND_MODE_COLOR,
|
||||
GTK_CSS_BLEND_MODE_COLOR_BURN,
|
||||
GTK_CSS_BLEND_MODE_COLOR_DODGE,
|
||||
GTK_CSS_BLEND_MODE_DARKEN,
|
||||
GTK_CSS_BLEND_MODE_DIFFERENCE,
|
||||
GTK_CSS_BLEND_MODE_EXCLUSION,
|
||||
GTK_CSS_BLEND_MODE_HARD_LIGHT,
|
||||
GTK_CSS_BLEND_MODE_HUE,
|
||||
GTK_CSS_BLEND_MODE_LIGHTEN,
|
||||
GTK_CSS_BLEND_MODE_LUMINOSITY,
|
||||
GTK_CSS_BLEND_MODE_MULTIPLY,
|
||||
GTK_CSS_BLEND_MODE_NORMAL,
|
||||
GTK_CSS_BLEND_MODE_OVERLAY,
|
||||
GTK_CSS_BLEND_MODE_SATURATE,
|
||||
GTK_CSS_BLEND_MODE_SCREEN,
|
||||
GTK_CSS_BLEND_MODE_SOFT_LIGHT
|
||||
} GtkCssBlendMode;
|
||||
|
||||
typedef enum /*< skip >*/ {
|
||||
GTK_CSS_IMAGE_BUILTIN_NONE,
|
||||
GTK_CSS_IMAGE_BUILTIN_CHECK,
|
||||
@ -377,7 +359,7 @@ typedef enum /*< skip >*/ {
|
||||
GTK_CSS_MS,
|
||||
} GtkCssUnit;
|
||||
|
||||
cairo_operator_t _gtk_css_blend_mode_get_operator (GtkCssBlendMode mode);
|
||||
cairo_operator_t _gtk_css_blend_mode_get_operator (GskBlendMode mode);
|
||||
|
||||
GtkCssChange _gtk_css_change_for_sibling (GtkCssChange match);
|
||||
GtkCssChange _gtk_css_change_for_child (GtkCssChange match);
|
||||
|
@ -123,11 +123,11 @@ _gtk_theming_background_needs_push_group (GtkCssStyle *style)
|
||||
*/
|
||||
for (i = _gtk_css_array_value_get_n_values (blend_modes); i > 0; i--)
|
||||
{
|
||||
GtkCssBlendMode blend_mode;
|
||||
GskBlendMode blend_mode;
|
||||
|
||||
blend_mode = _gtk_css_blend_mode_value_get (_gtk_css_array_value_get_nth (blend_modes, i - 1));
|
||||
|
||||
if (blend_mode != GTK_CSS_BLEND_MODE_NORMAL)
|
||||
if (blend_mode != GSK_BLEND_MODE_DEFAULT)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
|
||||
GtkCssRepeatStyle hrepeat, vrepeat;
|
||||
const GtkCssValue *pos, *repeat;
|
||||
GtkCssImage *image;
|
||||
GtkCssBlendMode blend_mode;
|
||||
GskBlendMode blend_mode;
|
||||
const GskRoundedRect *origin;
|
||||
double image_width, image_height;
|
||||
double width, height;
|
||||
|
Loading…
Reference in New Issue
Block a user