gtk-css-engine r101 - in trunk: . libccd/ccd themes/gtk-css-test/gtk-2.0
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r101 - in trunk: . libccd/ccd themes/gtk-css-test/gtk-2.0
- Date: Thu, 11 Sep 2008 11:39:09 +0000 (UTC)
Author: robsta
Date: Thu Sep 11 11:39:09 2008
New Revision: 101
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=101&view=rev
Log:
* libccd/ccd/ccd-background.c:
* libccd/ccd/ccd-border.c:
* libccd/ccd/ccd-border.h:
* libccd/ccd/ccd-style.c:
Fix background clipping with rounded corners.
themes/gtk-css-test/gtk-2.0/styles.css:
Test background clipping with rounded corners.
Modified:
trunk/ (props changed)
trunk/libccd/ccd/ccd-background.c
trunk/libccd/ccd/ccd-border.c
trunk/libccd/ccd/ccd-border.h
trunk/libccd/ccd/ccd-style.c
trunk/themes/gtk-css-test/gtk-2.0/styles.css
Modified: trunk/libccd/ccd/ccd-background.c
==============================================================================
--- trunk/libccd/ccd/ccd-background.c (original)
+++ trunk/libccd/ccd/ccd-background.c Thu Sep 11 11:39:09 2008
@@ -104,7 +104,7 @@
cairo_set_source_rgb (cr, bg_color->color.red,
bg_color->color.green,
bg_color->color.blue);
- cairo_rectangle (cr, x, y, width, height);
+/* cairo_rectangle (cr, x, y, width, height);*/
cairo_fill (cr);
}
@@ -124,7 +124,7 @@
pattern = cairo_get_source (cr);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
- cairo_rectangle (cr, x / dx, y / dy, width / dx, height / dy);
+/* cairo_rectangle (cr, x / dx, y / dy, width / dx, height / dy);*/
cairo_fill (cr);
}
Modified: trunk/libccd/ccd/ccd-border.c
==============================================================================
--- trunk/libccd/ccd/ccd-border.c (original)
+++ trunk/libccd/ccd/ccd-border.c Thu Sep 11 11:39:09 2008
@@ -277,7 +277,6 @@
SET_SPECIFIC_COLOR (spec, *stroke, color);
} else {
- g_assert_not_reached ();
return false;
}
@@ -364,38 +363,55 @@
/* Test for specific properties first. */
if (0 == strncmp ("border-left-", property,
sizeof ("border-left-") - 1)) {
-
- return parse_stroke_property (&self->left,
+ bool ret;
+ ret = parse_stroke_property (&self->left,
property + sizeof ("border-left-") - 1,
values);
+ if (!ret)
+ g_warning ("Unknown property `%s'", property);
+ return ret;
} else if (0 == strncmp ("border-top-", property,
sizeof ("border-top-") - 1)) {
-
- return parse_stroke_property (&self->top,
+ bool ret;
+ ret = parse_stroke_property (&self->top,
property + sizeof ("border-top-") - 1,
values);
+ if (!ret)
+ g_warning ("Unknown property `%s'", property);
+ return ret;
} else if (0 == strncmp ("border-right-", property,
sizeof ("border-right-") - 1)) {
-
- return parse_stroke_property (&self->right,
+ bool ret;
+ ret = parse_stroke_property (&self->right,
property + sizeof ("border-right-") - 1,
values);
+ if (!ret)
+ g_warning ("Unknown property `%s'", property);
+ return ret;
} else if (0 == strncmp ("border-bottom-", property,
sizeof ("border-bottom-") - 1)) {
-
- return parse_stroke_property (&self->bottom,
+ bool ret;
+ ret = parse_stroke_property (&self->bottom,
property + sizeof ("border-bottom-") - 1,
values);
+ if (!ret)
+ g_warning ("Unknown property `%s'", property);
+ return ret;
}
/* Now try to parse multi-value properties. */
iter = values;
width_spec = parse_width (&iter, &width);
- style_spec = parse_style (&iter, &style);
- color_spec = parse_color (&iter, &color);
+ if (CCD_PROPERTY_SPEC_NONE == width_spec && !iter) {
+ style_spec = CCD_PROPERTY_SPEC_NONE;
+ color_spec = CCD_PROPERTY_SPEC_NONE;
+ } else {
+ style_spec = parse_style (&iter, &style);
+ color_spec = parse_color (&iter, &color);
+ }
if (0 == strcmp ("border", property)) {
@@ -453,7 +469,6 @@
double x2,
double y2)
{
- /* cairo_move_to (cr, x1, y1); */
cairo_line_to (cr, x2, y2);
}
@@ -527,6 +542,7 @@
{
cairo_save (cr);
+ cairo_move_to (cr, x1, y1);
line (stroke, cr, x1, y1, x2, y2);
cairo_set_line_width (cr, stroke->width);
@@ -548,7 +564,8 @@
return line;
}
- if (CCD_PROPERTY_SPEC_NONE == stroke->style_spec) {
+ if (CCD_PROPERTY_SPEC_UNSET == stroke->style_spec ||
+ CCD_PROPERTY_SPEC_NONE == stroke->style_spec) {
return draw_none_line;
}
@@ -664,10 +681,7 @@
double x1, x2, y1, y2;
double xc, yc;
- /* TODO also clip when no border. */
- /* TODO pass on `path_only' to `line_func' and cairo_move_to() if false. */
-
- if (left && left->flags) {
+ if (left) {
line_func = get_line_draw_func (left, path_only);
xoff = left->width / 2.;
yoff = bottom_left && bottom_left->radius_spec ? bottom_left->radius : 0;
@@ -680,7 +694,7 @@
line_func (left, cr, x1, y1, x2, y2);
}
- if (left_top && left_top->flags) {
+ if (left_top) {
join_func = get_join_draw_func (left, top, path_only);
xoff = left->width / 2.;
yoff = top->width / 2.;
@@ -690,7 +704,7 @@
left_top->radius, _PI, 3 * _PI / 2);
}
- if (top && top->flags) {
+ if (top) {
line_func = get_line_draw_func (top, path_only);
xoff = left_top && left_top->radius_spec ? left_top->radius : 0;
yoff = top->width / 2.;
@@ -702,7 +716,7 @@
line_func (top, cr, x1, y1, x2, y2);
}
- if (top_right && top_right->flags) {
+ if (top_right) {
join_func = get_join_draw_func (top, right, path_only);
xoff = right->width / 2.;
yoff = top->width / 2.;
@@ -712,7 +726,7 @@
top_right->radius, 3 * _PI / 2., 0);
}
- if (right && right->flags) {
+ if (right) {
line_func = get_line_draw_func (right, path_only);
xoff = right->width / 2.;
yoff = top_right && top_right->radius_spec ? top_right->radius : 0;
@@ -724,7 +738,7 @@
line_func (right, cr, x1, y1, x2, y2);
}
- if (right_bottom && right_bottom->flags) {
+ if (right_bottom) {
join_func = get_join_draw_func (right, bottom, path_only);
xoff = right->width / 2.;
yoff = bottom->width / 2.;
@@ -734,7 +748,7 @@
right_bottom->radius, 0, _PI / 2.);
}
- if (bottom && bottom->flags) {
+ if (bottom) {
line_func = get_line_draw_func (bottom, path_only);
xoff = right_bottom && right_bottom->radius_spec ? right_bottom->radius : 0;
yoff = bottom->width / 2.;
@@ -745,7 +759,7 @@
line_func (bottom, cr, x1, y1, x2, y2);
}
- if (bottom_left && bottom_left->flags) {
+ if (bottom_left) {
join_func = get_join_draw_func (bottom, left, path_only);
xoff = left->width / 2.;
yoff = bottom->width / 2.;
@@ -757,7 +771,7 @@
}
void
-ccd_border_clip (ccd_border_stroke_t const *left,
+ccd_border_path (ccd_border_stroke_t const *left,
ccd_border_join_t const *left_top,
ccd_border_stroke_t const *top,
ccd_border_join_t const *top_right,
@@ -776,7 +790,6 @@
cr, x, y, width, height, true);
cairo_close_path (cr);
- cairo_clip (cr);
}
void
Modified: trunk/libccd/ccd/ccd-border.h
==============================================================================
--- trunk/libccd/ccd/ccd-border.h (original)
+++ trunk/libccd/ccd/ccd-border.h Thu Sep 11 11:39:09 2008
@@ -118,7 +118,7 @@
bool ccd_border_parse (ccd_border_t *self, char const *property,
CRTerm const *values);
-void ccd_border_clip (ccd_border_stroke_t const *left,
+void ccd_border_path (ccd_border_stroke_t const *left,
ccd_border_join_t const *left_top,
ccd_border_stroke_t const *top,
ccd_border_join_t const *top_right,
Modified: trunk/libccd/ccd/ccd-style.c
==============================================================================
--- trunk/libccd/ccd/ccd-style.c (original)
+++ trunk/libccd/ccd/ccd-style.c Thu Sep 11 11:39:09 2008
@@ -131,7 +131,7 @@
{
cairo_save (cr);
- ccd_border_clip (&self->left, &self->left_top,
+ ccd_border_path (&self->left, &self->left_top,
&self->top, &self->top_right,
&self->right, &self->right_bottom,
&self->bottom, &self->bottom_left,
Modified: trunk/themes/gtk-css-test/gtk-2.0/styles.css
==============================================================================
--- trunk/themes/gtk-css-test/gtk-2.0/styles.css (original)
+++ trunk/themes/gtk-css-test/gtk-2.0/styles.css Thu Sep 11 11:39:09 2008
@@ -104,7 +104,9 @@
*/
box {
- background: blue;
+ background: khaki;
border: 1px solid black;
- border-radius: 5;
+ border-top: none;
+ border-top-left-radius: 2;
+ border-bottom-right-radius: 5;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]