Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
gtk
Commits
161d5175
Commit
161d5175
authored
Oct 20, 2010
by
Carlos Garnacho
Browse files
GtkThemingEngine: Honor border-radius in render_background().
parent
f7dd4238
Changes
1
Hide whitespace changes
Inline
Side-by-side
gtk/gtkthemingengine.c
View file @
161d5175
...
...
@@ -1138,6 +1138,29 @@ color_shade (const GdkColor *color,
color_return
->
blue
=
CLAMP
(
color
->
blue
*
factor
,
0
,
65535
);
}
static
void
_cairo_round_rectangle
(
cairo_t
*
cr
,
gdouble
radius
,
gdouble
x
,
gdouble
y
,
gdouble
width
,
gdouble
height
)
{
radius
=
CLAMP
(
radius
,
0
,
MIN
(
width
/
2
,
height
/
2
));
if
(
radius
==
0
)
cairo_rectangle
(
cr
,
x
,
y
,
width
,
height
);
else
{
cairo_new_sub_path
(
cr
);
cairo_arc
(
cr
,
x
+
width
-
radius
,
y
+
radius
,
radius
,
-
G_PI
/
2
,
0
);
cairo_arc
(
cr
,
x
+
width
-
radius
,
y
+
height
-
radius
,
radius
,
0
,
G_PI
/
2
);
cairo_arc
(
cr
,
x
+
radius
,
y
+
height
-
radius
,
radius
,
G_PI
/
2
,
G_PI
);
cairo_arc
(
cr
,
x
+
radius
,
y
+
radius
,
radius
,
G_PI
,
3
*
(
G_PI
/
2
));
cairo_close_path
(
cr
);
}
}
static
void
gtk_theming_engine_render_background
(
GtkThemingEngine
*
engine
,
cairo_t
*
cr
,
...
...
@@ -1151,6 +1174,7 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
GtkStateFlags
flags
;
gboolean
running
;
gdouble
progress
,
alpha
=
1
;
gint
radius
;
flags
=
gtk_theming_engine_get_state
(
engine
);
cairo_save
(
cr
);
...
...
@@ -1168,10 +1192,14 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
"background-image"
,
&
pattern
,
"background-color"
,
&
bg_color
,
"base-color"
,
&
base_color
,
"border-radius"
,
&
radius
,
NULL
);
running
=
gtk_theming_engine_state_is_running
(
engine
,
GTK_STATE_PRELIGHT
,
&
progress
);
_cairo_round_rectangle
(
cr
,
(
gdouble
)
radius
,
x
,
y
,
width
,
height
);
cairo_clip
(
cr
);
cairo_translate
(
cr
,
x
,
y
);
cairo_scale
(
cr
,
width
,
height
);
...
...
@@ -1268,7 +1296,7 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
*/
cairo_rectangle
(
cr
,
0
,
0
,
1
,
1
);
cairo_set_source
(
cr
,
other_pattern
);
cairo_fill
(
cr
);
cairo_fill
_preserve
(
cr
);
/* Set alpha for posterior drawing
* of the target pattern
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment