gtk-css-engine r104 - in trunk: . libccd/ccd
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r104 - in trunk: . libccd/ccd
- Date: Fri, 12 Sep 2008 16:40:22 +0000 (UTC)
Author: robsta
Date: Fri Sep 12 16:40:22 2008
New Revision: 104
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=104&view=rev
Log:
* libccd/ccd/ccd-border.c:
* libccd/ccd/ccd-gtk-style.c:
Restrict rounded corners' radius to half of the relevant object extent.
Modified:
trunk/ (props changed)
trunk/ChangeLog
trunk/libccd/ccd/ccd-border.c
trunk/libccd/ccd/ccd-gtk-style.c
Modified: trunk/libccd/ccd/ccd-border.c
==============================================================================
--- trunk/libccd/ccd/ccd-border.c (original)
+++ trunk/libccd/ccd/ccd-border.c Fri Sep 12 16:40:22 2008
@@ -688,105 +688,162 @@
double xoff, yoff;
double x1, x2, y1, y2;
double xc, yc;
+ double rlt, rtr, rrb, rbl;
+ bool have_segment;
- /* TODO this can be simplified by just using x2,y2.
- * However, the initial cairo_move_to() still has to be calculated somehow. */
+ /* Clamp radii to 50% of length. */
+ rlt = left_top && left_top->radius_spec ? left_top->radius : 0;
+ if (height > 0 && rlt > height / 2.) rlt = height / 2.;
+ if (width > 0 && rlt > width / 2.) rlt = width / 2.;
+
+ rtr = top_right && top_right->radius_spec ? top_right->radius : 0;
+ if (height > 0 && rtr > height / 2.) rtr = height / 2.;
+ if (width > 0 && rtr > width / 2.) rtr = width / 2.;
+
+ rrb = right_bottom && right_bottom->radius_spec ? right_bottom->radius : 0;
+ if (height > 0 && rrb > height / 2.) rrb = height / 2.;
+ if (width > 0 && rrb > width / 2.) rrb = width / 2.;
+
+ rbl = bottom_left && bottom_left->radius_spec ? bottom_left->radius : 0;
+ if (height > 0 && rbl > height / 2.) rbl = height / 2.;
+ if (width > 0 && rbl > width / 2.) rbl = width / 2.;
+
+ have_segment = false;
if (left) {
line_func = get_line_draw_func (left, path_only);
xoff = left ? left->width / 2. : 0;
- yoff = bottom_left && bottom_left->radius_spec ? bottom_left->radius : 0;
+ yoff = rbl;
x1 = x + xoff;
y1 = y + height - yoff;
x2 = x1;
- y2 = y + (left_top && left_top->radius_spec ? left_top->radius : 0);
-
- cairo_move_to (cr, x1, y1);
+ y2 = y + rlt;
- if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_LEFT & visibility_flags))
+ if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_LEFT & visibility_flags)) {
+ if (!have_segment)
+ cairo_move_to (cr, x1, y1);
line_func (left, cr, x1, y1, x2, y2);
+ have_segment = true;
+ }
}
if (left_top) {
join_func = get_join_draw_func (left, top, path_only);
xoff = left ? left->width / 2. : 0;
yoff = top ? top->width / 2. : 0;
- xc = x + left_top->radius + xoff;
- yc = y + left_top->radius + yoff;
- if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_LEFT_TOP & visibility_flags))
- join_func (left, top, cr, xc, yc,
- left_top->radius, _PI, 3 * _PI / 2);
+ x1 = x + xoff;
+ y1 = y + rlt + yoff;
+ xc = x1 + rlt;
+ yc = y1;
+
+ if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_LEFT_TOP & visibility_flags)) {
+ if (!have_segment)
+ cairo_move_to (cr, x1, y1);
+ join_func (left, top, cr, xc, yc, rlt, _PI, 3 * _PI / 2);
+ have_segment = true;
+ }
}
if (top) {
line_func = get_line_draw_func (top, path_only);
- xoff = left_top && left_top->radius_spec ? left_top->radius : 0;
+ xoff = rlt;
yoff = top ? top->width / 2. : 0;
x1 = x + xoff;
y1 = y + yoff;
- x2 = x + width - (top_right && top_right->radius_spec ?
- top_right->radius : 0);
+ x2 = x + width - rtr;
y2 = y1;
- if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_TOP & visibility_flags))
+
+ if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_TOP & visibility_flags)) {
+ if (!have_segment)
+ cairo_move_to (cr, x1, y1);
line_func (top, cr, x1, y1, x2, y2);
+ have_segment = true;
+ }
}
if (top_right) {
join_func = get_join_draw_func (top, right, path_only);
xoff = right ? right->width / 2. : 0;
yoff = top ? top->width / 2. : 0;
- xc = x + width - top_right->radius - xoff;
- yc = y + top_right->radius + yoff;
- if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_TOP_RIGHT & visibility_flags))
- join_func (top, right, cr, xc, yc,
- top_right->radius, 3 * _PI / 2., 0);
+ x1 = x + width - xoff;
+ y1 = y + yoff;
+ xc = x1 - rtr;
+ yc = y1 + rtr;
+
+ if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_TOP_RIGHT & visibility_flags)) {
+ if (!have_segment)
+ cairo_move_to (cr, x1, y1);
+ join_func (top, right, cr, xc, yc, rtr, 3 * _PI / 2., 0);
+ have_segment = true;
+ }
}
if (right) {
line_func = get_line_draw_func (right, path_only);
xoff = right ? right->width / 2. : 0;
- yoff = top_right && top_right->radius_spec ? top_right->radius : 0;
+ yoff = rtr;
x1 = x + width - xoff;
y1 = y + yoff;
x2 = x1;
- y2 = y + height - (right_bottom && right_bottom->radius_spec ?
- right_bottom->radius : 0);
- if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_RIGHT & visibility_flags))
+ y2 = y + height - rrb;
+
+ if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_RIGHT & visibility_flags)) {
+ if (!have_segment)
+ cairo_move_to (cr, x1, y1);
line_func (right, cr, x1, y1, x2, y2);
+ have_segment = true;
+ }
}
if (right_bottom) {
join_func = get_join_draw_func (right, bottom, path_only);
xoff = right ? right->width / 2. : 0;
yoff = bottom ? bottom->width / 2. : 0;
- xc = x + width - right_bottom->radius - xoff;
- yc = y + height - right_bottom->radius - yoff;
- if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_RIGHT_BOTTOM & visibility_flags))
- join_func (right, bottom, cr, xc, yc,
- right_bottom->radius, 0, _PI / 2.);
+ x1 = x + width - xoff;
+ y1 = y + height - yoff;
+ xc = x1 - rrb;
+ yc = y1 - rrb;
+
+ if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_RIGHT_BOTTOM & visibility_flags)) {
+ if (!have_segment)
+ cairo_move_to (cr, x1, y1);
+ join_func (right, bottom, cr, xc, yc, rrb, 0, _PI / 2.);
+ have_segment = true;
+ }
}
if (bottom) {
line_func = get_line_draw_func (bottom, path_only);
- xoff = right_bottom && right_bottom->radius_spec ? right_bottom->radius : 0;
+ xoff = rrb;
yoff = bottom ? bottom->width / 2. : 0;
x1 = x + width - xoff;
y1 = y + height - yoff;
- x2 = x + (bottom_left && bottom_left->radius_spec ? bottom_left->radius : 0);
+ x2 = x + rbl;
y2 = y1;
- if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_BOTTOM & visibility_flags))
+
+ if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_BOTTOM & visibility_flags)) {
+ if (!have_segment)
+ cairo_move_to (cr, x1, y1);
line_func (bottom, cr, x1, y1, x2, y2);
+ have_segment = true;
+ }
}
if (bottom_left) {
join_func = get_join_draw_func (bottom, left, path_only);
xoff = left ? left->width / 2. : 0;
yoff = bottom ? bottom->width / 2. : 0;
- xc = x + bottom_left->radius + xoff;
- yc = y + height - bottom_left->radius - yoff;
- if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_BOTTOM_LEFT & visibility_flags))
- join_func (bottom, left, cr, xc, yc,
- bottom_left->radius, _PI / 2., _PI);
+ x1 = x + xoff;
+ y1 = y + height - yoff;
+ xc = x1 + rbl;
+ yc = y1 - rbl;
+
+ if (path_only || !(CCD_BORDER_VISIBILITY_HIDE_BOTTOM_LEFT & visibility_flags)) {
+ if (!have_segment)
+ cairo_move_to (cr, x1, y1);
+ join_func (bottom, left, cr, xc, yc, rbl, _PI / 2., _PI);
+ have_segment = true;
+ }
}
}
Modified: trunk/libccd/ccd/ccd-gtk-style.c
==============================================================================
--- trunk/libccd/ccd/ccd-gtk-style.c (original)
+++ trunk/libccd/ccd/ccd-gtk-style.c Fri Sep 12 16:40:22 2008
@@ -119,11 +119,11 @@
CCD_BORDER_VISIBILITY_HIDE_LEFT_TOP,
cr, x, y, 0, gap_start);
}
- ccd_border_draw (NULL, &left_top,
+ ccd_border_draw (&self->left, &left_top,
&self->top, &top_right,
&self->right, &right_bottom,
&self->bottom, &bottom_left,
- CCD_BORDER_VISIBILITY_SHOW_ALL,
+ CCD_BORDER_VISIBILITY_HIDE_LEFT,
cr, x, y, width, height);
break;
case GTK_POS_TOP:
@@ -143,10 +143,10 @@
}
}
ccd_border_draw (&self->left, &left_top,
- NULL, &top_right,
+ &self->top, &top_right,
&self->right, &right_bottom,
&self->bottom, &bottom_left,
- CCD_BORDER_VISIBILITY_SHOW_ALL,
+ CCD_BORDER_VISIBILITY_HIDE_TOP,
cr, x, y, width, height);
break;
case GTK_POS_RIGHT:
@@ -167,9 +167,9 @@
}
ccd_border_draw (&self->left, &left_top,
&self->top, &top_right,
- NULL, &right_bottom,
+ &self->right, &right_bottom,
&self->bottom, &bottom_left,
- CCD_BORDER_VISIBILITY_SHOW_ALL,
+ CCD_BORDER_VISIBILITY_HIDE_RIGHT,
cr, x, y, width, height);
break;
case GTK_POS_BOTTOM:
@@ -191,8 +191,8 @@
ccd_border_draw (&self->left, &left_top,
&self->top, &top_right,
&self->right, &right_bottom,
- NULL, &bottom_left,
- CCD_BORDER_VISIBILITY_SHOW_ALL,
+ &self->bottom, &bottom_left,
+ CCD_BORDER_VISIBILITY_HIDE_BOTTOM,
cr, x, y, width, height);
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]