Debian Codegraph @

gtk/gtkcsscornervalue.c

raw symbols SCIP
1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2011 Red Hat, Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "config.h"cxx . . $ `<file>/build/config.h`/
19
20 #include "gtkcsscornervalueprivate.h"cxx . . $ `<file>/gtk/gtkcsscornervalueprivate.h`/
21 #include "gtkcssnumbervalueprivate.h"cxx . . $ `<file>/gtk/gtkcssnumbervalueprivate.h`/
22 #include "gtkcssdimensionvalueprivate.h"cxx . . $ `<file>/gtk/gtkcssdimensionvalueprivate.h`/
23
24 struct _GtkCssValuecxx . . $ _GtkCssValue# {
25 GTK_CSS_VALUE_BASEcxx . . $ `gtk/gtkcssvalueprivate.h:38:9`!
26 GtkCssValuecxx . . $ GtkCssValue# *xcxx . . $ _GtkCssValue#x.;
27 GtkCssValuecxx . . $ GtkCssValue# *ycxx . . $ _GtkCssValue#y.;
28 };
29
30 static void
31 gtk_css_value_corner_freecxx . . $ gtk_css_value_corner_free(eca506aa56b70245). (GtkCssValuecxx . . $ GtkCssValue# *value)
32 {
33 gtk_css_value_unrefcxx . . $ `gtk/gtkcssvalueprivate.h:134:9`! (value->x);
34 gtk_css_value_unrefcxx . . $ `gtk/gtkcssvalueprivate.h:134:9`! (value->y);
35
36 g_freecxx . . $ g_free(5d22bdacc48458e8). (value);
37 }
38
39 static GtkCssValuecxx . . $ GtkCssValue# *
40 gtk_css_value_corner_computecxx . . $ gtk_css_value_corner_compute(cbde7e31d878f1be). (GtkCssValuecxx . . $ GtkCssValue# *corner,
41 guintcxx . . $ guint# property_id,
42 GtkCssComputeContextcxx . . $ GtkCssComputeContext# *context)
43 {
44 GtkCssValuecxx . . $ GtkCssValue# *x, *y;
45
46 x = gtk_css_value_computecxx . . $ gtk_css_value_compute(cbde7e31d878f1be). (corner->xcxx . . $ _GtkCssValue#x., property_id, context);
47 y = gtk_css_value_computecxx . . $ gtk_css_value_compute(cbde7e31d878f1be). (corner->ycxx . . $ _GtkCssValue#y., property_id, context);
48 if (x == corner->xcxx . . $ _GtkCssValue#x. && y == corner->ycxx . . $ _GtkCssValue#y.)
49 {
50 gtk_css_value_unrefcxx . . $ `gtk/gtkcssvalueprivate.h:134:9`! (x);
51 gtk_css_value_unrefcxx . . $ `gtk/gtkcssvalueprivate.h:134:9`! (y);
52 return gtk_css_value_refcxx . . $ `gtk/gtkcssvalueprivate.h:133:9`! (corner);
53 }
54
55 return _gtk_css_corner_value_newcxx . . $ _gtk_css_corner_value_new(dadd23ece33079fb). (x, y);
56 }
57
58 static gbooleancxx . . $ gboolean#
59 gtk_css_value_corner_equalcxx . . $ gtk_css_value_corner_equal(9e96a8b1dd095d1c). (const GtkCssValuecxx . . $ GtkCssValue# *corner1,
60 const GtkCssValuecxx . . $ GtkCssValue# *corner2)
61 {
62 return gtk_css_value_equalcxx . . $ gtk_css_value_equal(9e96a8b1dd095d1c). (corner1->xcxx . . $ _GtkCssValue#x., corner2->xcxx . . $ _GtkCssValue#x.)
63 && gtk_css_value_equalcxx . . $ gtk_css_value_equal(9e96a8b1dd095d1c). (corner1->ycxx . . $ _GtkCssValue#y., corner2->ycxx . . $ _GtkCssValue#y.);
64 }
65
66 static GtkCssValuecxx . . $ GtkCssValue# *
67 gtk_css_value_corner_transitioncxx . . $ gtk_css_value_corner_transition(f8a3466892fba181). (GtkCssValuecxx . . $ GtkCssValue# *start,
68 GtkCssValuecxx . . $ GtkCssValue# *end,
69 guintcxx . . $ guint# property_id,
70 double progress)
71 {
72 GtkCssValuecxx . . $ GtkCssValue# *x, *y;
73
74 x = gtk_css_value_transitioncxx . . $ gtk_css_value_transition(f8a3466892fba181). (start->xcxx . . $ _GtkCssValue#x., end->xcxx . . $ _GtkCssValue#x., property_id, progress);
75 if (x == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
76 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
77 y = gtk_css_value_transitioncxx . . $ gtk_css_value_transition(f8a3466892fba181). (start->ycxx . . $ _GtkCssValue#y., end->ycxx . . $ _GtkCssValue#y., property_id, progress);
78 if (y == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
79 {
80 gtk_css_value_unrefcxx . . $ `gtk/gtkcssvalueprivate.h:134:9`! (x);
81 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
82 }
83
84 return _gtk_css_corner_value_newcxx . . $ _gtk_css_corner_value_new(dadd23ece33079fb). (x, y);
85 }
86
87 static void
88 gtk_css_value_corner_printcxx . . $ gtk_css_value_corner_print(36b72f8115f1fefa). (const GtkCssValuecxx . . $ GtkCssValue# *corner,
89 GStringcxx . . $ GString# *string)
90 {
91 gtk_css_value_printcxx . . $ gtk_css_value_print(36b72f8115f1fefa). (corner->xcxx . . $ _GtkCssValue#x., string);
92 if (!gtk_css_value_equalcxx . . $ gtk_css_value_equal(9e96a8b1dd095d1c). (corner->xcxx . . $ _GtkCssValue#x., corner->ycxx . . $ _GtkCssValue#y.))
93 {
94 g_string_append_ccxx . . $ `<external>/2906017559248664336/gstring.h:215:9`! (string, ' ');
95 gtk_css_value_printcxx . . $ gtk_css_value_print(36b72f8115f1fefa). (corner->ycxx . . $ _GtkCssValue#y., string);
96 }
97 }
98
99 static const GtkCssValueClasscxx . . $ GtkCssValueClass# GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER. = {
100 "GtkCssCornerValue",
101 gtk_css_value_corner_freecxx . . $ gtk_css_value_corner_free(eca506aa56b70245).,
102 gtk_css_value_corner_computecxx . . $ gtk_css_value_corner_compute(cbde7e31d878f1be).,
103 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
104 gtk_css_value_corner_equalcxx . . $ gtk_css_value_corner_equal(9e96a8b1dd095d1c).,
105 gtk_css_value_corner_transitioncxx . . $ gtk_css_value_corner_transition(f8a3466892fba181).,
106 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
107 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
108 gtk_css_value_corner_printcxx . . $ gtk_css_value_corner_print(36b72f8115f1fefa).
109 };
110
111 static GtkCssValuecxx . . $ GtkCssValue# corner_singletonscxx . . $ corner_singletons.[] = {
112 { &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER., 1, 1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
113 { &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER., 1, 1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
114 { &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER., 1, 1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
115 { &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER., 1, 1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
116 { &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER., 1, 1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
117 { &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER., 1, 1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
118 { &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER., 1, 1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
119 { &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER., 1, 1, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! },
120 };
121
122 static inline void
123 initialize_corner_singletonscxx . . $ initialize_corner_singletons(49f6e7a06ebc5aa8). (void)
124 {
125 static gbooleancxx . . $ gboolean# initialized = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
126
127 if (initialized)
128 return;
129
130 for (unsigned int i = 0; i < G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (corner_singletons); i++)
131 {
132 corner_singletonscxx . . $ corner_singletons.[i].xcxx . . $ _GtkCssValue#x. = gtk_css_dimension_value_newcxx . . $ gtk_css_dimension_value_new(bee9a27a92b863c4). (i, GTK_CSS_PXcxx . . $ GTK_CSS_PX.);
133 corner_singletonscxx . . $ corner_singletons.[i].ycxx . . $ _GtkCssValue#y. = gtk_css_value_refcxx . . $ `gtk/gtkcssvalueprivate.h:133:9`! (corner_singletons[i].x);
134 }
135
136 initialized = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
137 }
138
139 GtkCssValuecxx . . $ GtkCssValue# *
140 _gtk_css_corner_value_newcxx . . $ _gtk_css_corner_value_new(dadd23ece33079fb). (GtkCssValuecxx . . $ GtkCssValue# *x,
141 GtkCssValuecxx . . $ GtkCssValue# *y)
142 {
143 GtkCssValuecxx . . $ GtkCssValue# *result;
144
145 if (x == y &&
146 gtk_css_number_value_get_dimensioncxx . . $ gtk_css_number_value_get_dimension(d68c1baf7189d523). (x) == GTK_CSS_DIMENSION_LENGTHcxx . . $ GTK_CSS_DIMENSION_LENGTH.)
147 {
148 initialize_corner_singletonscxx . . $ initialize_corner_singletons(49f6e7a06ebc5aa8). ();
149
150 for (unsigned int i = 0; i < G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (corner_singletons); i++)
151 {
152 if (corner_singletonscxx . . $ corner_singletons.[i].xcxx . . $ _GtkCssValue#x. == x)
153 {
154 gtk_css_value_unrefcxx . . $ `gtk/gtkcssvalueprivate.h:134:9`! (x);
155 gtk_css_value_unrefcxx . . $ `gtk/gtkcssvalueprivate.h:134:9`! (y);
156
157 return gtk_css_value_refcxx . . $ `gtk/gtkcssvalueprivate.h:133:9`! (&corner_singletons[i]);
158 }
159 }
160 }
161
162 result = gtk_css_value_newcxx . . $ `gtk/gtkcssvalueprivate.h:80:9`! (GtkCssValue, &GTK_CSS_VALUE_CORNER);
163 result->xcxx . . $ _GtkCssValue#x. = x;
164 result->ycxx . . $ _GtkCssValue#y. = y;
165
166 return result;
167 }
168
169 GtkCssValuecxx . . $ GtkCssValue# *
170 _gtk_css_corner_value_parsecxx . . $ _gtk_css_corner_value_parse(66d8ac11734e4f87). (GtkCssParsercxx . . $ GtkCssParser# *parser)
171 {
172 GtkCssValuecxx . . $ GtkCssValue# *x, *y;
173
174 x = gtk_css_number_value_parsecxx . . $ gtk_css_number_value_parse(f3430beb2a3a84d9). (parser,
175 GTK_CSS_POSITIVE_ONLYcxx . . $ GTK_CSS_POSITIVE_ONLY.
176 | GTK_CSS_PARSE_PERCENTcxx . . $ GTK_CSS_PARSE_PERCENT.
177 | GTK_CSS_PARSE_LENGTHcxx . . $ GTK_CSS_PARSE_LENGTH.);
178 if (x == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
179 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
180
181 if (!gtk_css_number_value_can_parsecxx . . $ gtk_css_number_value_can_parse(1218f77d161081c9). (parser))
182 y = gtk_css_value_refcxx . . $ `gtk/gtkcssvalueprivate.h:133:9`! (x);
183 else
184 {
185 y = gtk_css_number_value_parsecxx . . $ gtk_css_number_value_parse(f3430beb2a3a84d9). (parser,
186 GTK_CSS_POSITIVE_ONLYcxx . . $ GTK_CSS_POSITIVE_ONLY.
187 | GTK_CSS_PARSE_PERCENTcxx . . $ GTK_CSS_PARSE_PERCENT.
188 | GTK_CSS_PARSE_LENGTHcxx . . $ GTK_CSS_PARSE_LENGTH.);
189 if (y == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
190 {
191 gtk_css_value_unrefcxx . . $ `gtk/gtkcssvalueprivate.h:134:9`! (x);
192 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
193 }
194 }
195
196 return _gtk_css_corner_value_newcxx . . $ _gtk_css_corner_value_new(dadd23ece33079fb). (x, y);
197 }
198
199 double
200 _gtk_css_corner_value_get_xcxx . . $ _gtk_css_corner_value_get_x(aaf4d8e9bc9f0cb0). (const GtkCssValuecxx . . $ GtkCssValue# *corner,
201 double one_hundred_percent)
202 {
203 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (corner != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0.0);
204 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (corner->class == &GTK_CSS_VALUE_CORNER, 0.0);
205
206 return gtk_css_number_value_getcxx . . $ gtk_css_number_value_get(aaf4d8e9bc9f0cb0). (corner->xcxx . . $ _GtkCssValue#x., one_hundred_percent);
207 }
208
209 double
210 _gtk_css_corner_value_get_ycxx . . $ _gtk_css_corner_value_get_y(aaf4d8e9bc9f0cb0). (const GtkCssValuecxx . . $ GtkCssValue# *corner,
211 double one_hundred_percent)
212 {
213 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (corner != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0.0);
214 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (corner->class == &GTK_CSS_VALUE_CORNER, 0.0);
215
216 return gtk_css_number_value_getcxx . . $ gtk_css_number_value_get(aaf4d8e9bc9f0cb0). (corner->ycxx . . $ _GtkCssValue#y., one_hundred_percent);
217 }
218
219 gbooleancxx . . $ gboolean#
220 gtk_css_corner_value_is_zerocxx . . $ gtk_css_corner_value_is_zero(8222c132d23033c0). (const GtkCssValuecxx . . $ GtkCssValue# *corner)
221 {
222 if (corner->classcxx . . $ _GtkCssValue#class. != &GTK_CSS_VALUE_CORNERcxx . . $ GTK_CSS_VALUE_CORNER.)
223 return gtk_css_dimension_value_is_zerocxx . . $ gtk_css_dimension_value_is_zero(8222c132d23033c0). (corner);
224
225 return gtk_css_dimension_value_is_zerocxx . . $ gtk_css_dimension_value_is_zero(8222c132d23033c0). (corner->xcxx . . $ _GtkCssValue#x.) &&
226 gtk_css_dimension_value_is_zerocxx . . $ gtk_css_dimension_value_is_zero(8222c132d23033c0). (corner->ycxx . . $ _GtkCssValue#y.);
227 }
228