gtk-css-engine r111 - in trunk: . libccd/ccd
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r111 - in trunk: . libccd/ccd
- Date: Tue, 16 Sep 2008 12:45:54 +0000 (UTC)
Author: robsta
Date: Tue Sep 16 12:45:53 2008
New Revision: 111
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=111&view=rev
Log:
* configure.in: actually build debug code when configured to to so.
* libccd/ccd/ccd-border.c:
* libccd/ccd/ccd-border.h:
* libccd/ccd/ccd-selector.c:
* libccd/ccd/ccd-style.c:
Use property spec to determine whether properties are set and make
the flags private to the border implementation.
Modified:
trunk/ (props changed)
trunk/ChangeLog
trunk/configure.in
trunk/libccd/ccd/ccd-border.c
trunk/libccd/ccd/ccd-border.h
trunk/libccd/ccd/ccd-selector.c
trunk/libccd/ccd/ccd-style.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Tue Sep 16 12:45:53 2008
@@ -57,14 +57,18 @@
AM_CONDITIONAL([CCD_STANDALONE], test "$enable_libccd" == "yes")
-enable_debug="no"
+AC_MSG_CHECKING([whether to built debug code])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [enable debug code])],
[
enable_debug="$enableval"
+],[
+ enable_debug="no"
])
+AC_MSG_RESULT([$enable_debug])
if test "$enable_debug" == "yes"; then
AC_DEFINE([CCD_DEBUG], [1], [enable debug code])
+ CFLAGS="-g -O0 ${CFLAGS}"
fi
AM_CONDITIONAL([CCD_DEBUG], test "$enable_debug" == "yes")
Modified: trunk/libccd/ccd/ccd-border.c
==============================================================================
--- trunk/libccd/ccd/ccd-border.c (original)
+++ trunk/libccd/ccd/ccd-border.c Tue Sep 16 12:45:53 2008
@@ -22,6 +22,32 @@
#include <string.h>
#include "ccd-border.h"
+/*
+ * Remember which properties were set explicitely, e.g. using "border-top",
+ * so it's not overwritten by a subsequent "border" property.
+ */
+enum {
+ CCD_BORDER_FLAGS_COMMON_WIDTH = 1 << 0,
+ CCD_BORDER_FLAGS_SPECIFIC_WIDTH = 1 << 1,
+ CCD_BORDER_FLAGS_WIDTH_MASK = CCD_BORDER_FLAGS_COMMON_WIDTH |
+ CCD_BORDER_FLAGS_SPECIFIC_WIDTH,
+
+ CCD_BORDER_FLAGS_COMMON_STYLE = 1 << 2,
+ CCD_BORDER_FLAGS_SPECIFIC_STYLE = 1 << 3,
+ CCD_BORDER_FLAGS_STYLE_MASK = CCD_BORDER_FLAGS_COMMON_STYLE |
+ CCD_BORDER_FLAGS_SPECIFIC_STYLE,
+
+ CCD_BORDER_FLAGS_COMMON_COLOR = 1 << 4,
+ CCD_BORDER_FLAGS_SPECIFIC_COLOR = 1 << 5,
+ CCD_BORDER_FLAGS_COLOR_MASK = CCD_BORDER_FLAGS_COMMON_COLOR |
+ CCD_BORDER_FLAGS_SPECIFIC_COLOR,
+
+ CCD_BORDER_FLAGS_COMMON_RADIUS = 1 << 6,
+ CCD_BORDER_FLAGS_SPECIFIC_RADIUS = 1 << 7,
+ CCD_BORDER_FLAGS_RADIUS_MASK = CCD_BORDER_FLAGS_COMMON_RADIUS |
+ CCD_BORDER_FLAGS_SPECIFIC_RADIUS
+};
+
#define SET_COMMON_WIDTH(spec_, border_, val_) \
if (CCD_PROPERTY_SPEC_SET == spec_ && \
!(CCD_BORDER_FLAGS_SPECIFIC_WIDTH & (border_).flags)) { \
@@ -908,17 +934,27 @@
#ifdef CCD_DEBUG
void
+ccd_border_join_dump (ccd_border_join_t const *self)
+{
+ if (self->radius_spec != CCD_PROPERTY_SPEC_UNSET) {
+ printf ("%.1f ", self->radius);
+ }
+
+ printf (";\n");
+}
+
+void
ccd_border_stroke_dump (ccd_border_stroke_t const *self)
{
- if (self->flags & CCD_BORDER_FLAGS_WIDTH_MASK) {
+ if (self->width_spec != CCD_PROPERTY_SPEC_UNSET) {
printf ("%.1f ", self->width);
}
- if (self->flags & CCD_BORDER_FLAGS_STYLE_MASK) {
+ if (self->style_spec != CCD_PROPERTY_SPEC_UNSET) {
printf ("%s ", lookup_name (self->style));
}
- if (self->flags & CCD_BORDER_FLAGS_COLOR_MASK) {
+ if (self->color_spec != CCD_PROPERTY_SPEC_UNSET) {
ccd_color_dump (&self->color);
}
@@ -928,25 +964,45 @@
void
ccd_border_dump (ccd_border_t const *self)
{
- if (self->left.flags) {
+ if (CCD_BORDER_STROKE_IS_SET (self->left)) {
printf (CCD_PROPERTY_DUMP_PREFIX "border-left: ");
ccd_border_stroke_dump (&self->left);
}
- if (self->top.flags) {
+ if (CCD_BORDER_JOIN_IS_SET (self->left_top)) {
+ printf (CCD_PROPERTY_DUMP_PREFIX "border-top-left-radius: ");
+ ccd_border_join_dump (&self->left_top);
+ }
+
+ if (CCD_BORDER_STROKE_IS_SET (self->top)) {
printf (CCD_PROPERTY_DUMP_PREFIX "border-top: ");
ccd_border_stroke_dump (&self->top);
}
- if (self->right.flags) {
+ if (CCD_BORDER_JOIN_IS_SET (self->top_right)) {
+ printf (CCD_PROPERTY_DUMP_PREFIX "border-top-right-radius: ");
+ ccd_border_join_dump (&self->top_right);
+ }
+
+ if (CCD_BORDER_STROKE_IS_SET (self->right)) {
printf (CCD_PROPERTY_DUMP_PREFIX "border-right: ");
ccd_border_stroke_dump (&self->right);
}
- if (self->bottom.flags) {
+ if (CCD_BORDER_JOIN_IS_SET (self->right_bottom)) {
+ printf (CCD_PROPERTY_DUMP_PREFIX "border-bottom-right-radius: ");
+ ccd_border_join_dump (&self->right_bottom);
+ }
+
+ if (CCD_BORDER_STROKE_IS_SET (self->bottom)) {
printf (CCD_PROPERTY_DUMP_PREFIX "border-bottom: ");
ccd_border_stroke_dump (&self->bottom);
}
+
+ if (CCD_BORDER_JOIN_IS_SET (self->bottom_left)) {
+ printf (CCD_PROPERTY_DUMP_PREFIX "border-bottom-left-radius: ");
+ ccd_border_join_dump (&self->bottom_left);
+ }
}
#endif /* CCD_DEBUG */
Modified: trunk/libccd/ccd/ccd-border.h
==============================================================================
--- trunk/libccd/ccd/ccd-border.h (original)
+++ trunk/libccd/ccd/ccd-border.h Tue Sep 16 12:45:53 2008
@@ -56,40 +56,19 @@
CCD_BORDER_ROUNDING_UNRESTRICTED = 1 << 8
} ccd_border_drawing_flags_t;
-/*
- * Remember which properties were set explicitely, e.g. using "border-top",
- * so it's not overwritten by a subsequent "border" property.
- */
-typedef enum {
- CCD_BORDER_FLAGS_COMMON_WIDTH = 1 << 0,
- CCD_BORDER_FLAGS_SPECIFIC_WIDTH = 1 << 1,
- CCD_BORDER_FLAGS_WIDTH_MASK = CCD_BORDER_FLAGS_COMMON_WIDTH |
- CCD_BORDER_FLAGS_SPECIFIC_WIDTH,
-
- CCD_BORDER_FLAGS_COMMON_STYLE = 1 << 2,
- CCD_BORDER_FLAGS_SPECIFIC_STYLE = 1 << 3,
- CCD_BORDER_FLAGS_STYLE_MASK = CCD_BORDER_FLAGS_COMMON_STYLE |
- CCD_BORDER_FLAGS_SPECIFIC_STYLE,
-
- CCD_BORDER_FLAGS_COMMON_COLOR = 1 << 4,
- CCD_BORDER_FLAGS_SPECIFIC_COLOR = 1 << 5,
- CCD_BORDER_FLAGS_COLOR_MASK = CCD_BORDER_FLAGS_COMMON_COLOR |
- CCD_BORDER_FLAGS_SPECIFIC_COLOR,
-
- CCD_BORDER_FLAGS_COMMON_RADIUS = 1 << 6,
- CCD_BORDER_FLAGS_SPECIFIC_RADIUS = 1 << 7,
- CCD_BORDER_FLAGS_RADIUS_MASK = CCD_BORDER_FLAGS_COMMON_RADIUS |
- CCD_BORDER_FLAGS_SPECIFIC_RADIUS
-} ccd_border_priority_flags_t;
-
-#define CCD_BORDER_STROKE_ASSIGN(lhs_, rhs_) { \
- lhs_.width = rhs_.width; \
- lhs_.width_spec = rhs_.width_spec; \
- lhs_.style = rhs_.style; \
- lhs_.style_spec = rhs_.style_spec; \
- lhs_.color = rhs_.color; \
- lhs_.color_spec = rhs_.color_spec; \
- lhs_.flags = rhs_.flags; \
+#define CCD_BORDER_STROKE_IS_SET(stroke_) \
+ ((stroke_).width_spec != CCD_PROPERTY_SPEC_UNSET && \
+ (stroke_).style_spec != CCD_PROPERTY_SPEC_UNSET && \
+ (stroke_).color_spec != CCD_PROPERTY_SPEC_UNSET)
+
+#define CCD_BORDER_STROKE_ASSIGN(lhs_, rhs_) { \
+ (lhs_).width = (rhs_).width; \
+ (lhs_).width_spec = (rhs_).width_spec; \
+ (lhs_).style = (rhs_).style; \
+ (lhs_).style_spec = (rhs_).style_spec; \
+ (lhs_).color = (rhs_).color; \
+ (lhs_).color_spec = (rhs_).color_spec; \
+ (lhs_).flags = (rhs_).flags; \
}
typedef struct {
@@ -102,10 +81,13 @@
unsigned int flags;
} ccd_border_stroke_t;
+#define CCD_BORDER_JOIN_IS_SET(join_) \
+ ((join_).radius_spec != CCD_PROPERTY_SPEC_UNSET)
+
#define CCD_BORDER_JOIN_ASSIGN(lhs_, rhs_) { \
- lhs_.radius = rhs_.radius; \
- lhs_.radius_spec = rhs_.radius_spec; \
- lhs_.flags = rhs_.flags; \
+ (lhs_).radius = (rhs_).radius; \
+ (lhs_).radius_spec = (rhs_).radius_spec; \
+ (lhs_).flags = (rhs_).flags; \
}
/* TODO just call it "spec"? */
@@ -160,6 +142,7 @@
#ifdef CCD_DEBUG
void ccd_border_dump (ccd_border_t const *self);
+void ccd_border_join_dump (ccd_border_join_t const *self);
void ccd_border_stroke_dump (ccd_border_stroke_t const *self);
#endif
Modified: trunk/libccd/ccd/ccd-selector.c
==============================================================================
--- trunk/libccd/ccd/ccd-selector.c (original)
+++ trunk/libccd/ccd/ccd-selector.c Tue Sep 16 12:45:53 2008
@@ -925,22 +925,21 @@
break;
}
- /* TODO use spec instead of flags? */
- if (self->block->border.left.flags)
+ if (CCD_BORDER_STROKE_IS_SET (self->block->border.left))
CCD_BORDER_STROKE_ASSIGN (style->left, self->block->border.left);
- if (self->block->border.left_top.flags)
+ if (CCD_BORDER_JOIN_IS_SET (self->block->border.left_top))
CCD_BORDER_JOIN_ASSIGN (style->left_top, self->block->border.left_top);
- if (self->block->border.top.flags)
+ if (CCD_BORDER_STROKE_IS_SET (self->block->border.top))
CCD_BORDER_STROKE_ASSIGN (style->top, self->block->border.top);
- if (self->block->border.top_right.flags)
+ if (CCD_BORDER_JOIN_IS_SET (self->block->border.top_right))
CCD_BORDER_JOIN_ASSIGN (style->top_right, self->block->border.top_right);
- if (self->block->border.right.flags)
+ if (CCD_BORDER_STROKE_IS_SET (self->block->border.right))
CCD_BORDER_STROKE_ASSIGN (style->right, self->block->border.right);
- if (self->block->border.right_bottom.flags)
+ if (CCD_BORDER_JOIN_IS_SET (self->block->border.right_bottom))
CCD_BORDER_JOIN_ASSIGN (style->right_bottom, self->block->border.right_bottom);
- if (self->block->border.bottom.flags)
+ if (CCD_BORDER_STROKE_IS_SET (self->block->border.bottom))
CCD_BORDER_STROKE_ASSIGN (style->bottom, self->block->border.bottom);
- if (self->block->border.bottom_left.flags)
+ if (CCD_BORDER_JOIN_IS_SET (self->block->border.bottom_left))
CCD_BORDER_JOIN_ASSIGN (style->bottom_left, self->block->border.bottom_left);
switch (self->block->color_spec) {
Modified: trunk/libccd/ccd/ccd-style.c
==============================================================================
--- trunk/libccd/ccd/ccd-style.c (original)
+++ trunk/libccd/ccd/ccd-style.c Tue Sep 16 12:45:53 2008
@@ -57,7 +57,7 @@
if (y1 == y2) {
/* Horizontal: try to use top, then bottom border.
* Fallback based on flags is flawed, however. */
- stroke = self->top.flags ? &self->top : &self->bottom;
+ stroke = CCD_BORDER_STROKE_IS_SET (self->top) ? &self->top : &self->bottom;
if (stroke) {
/* Unlike borders, lines are not drawn inside the box,
* account for that. */
@@ -71,7 +71,7 @@
} else {
/* Vertical: try to use left, then right border.
* Fallback based on flags is flawed, however. */
- stroke = self->left.flags ? &self->left : &self->right;
+ stroke = CCD_BORDER_STROKE_IS_SET (self->left) ? &self->left : &self->right;
if (stroke) {
/* Unlike borders, lines are not drawn inside the box,
* account for that. */
@@ -167,14 +167,10 @@
ccd_background_color_dump (self->bg_color);
if (self->bg_image)
ccd_background_image_dump (self->bg_image);
- if (self->left.flags)
- ccd_border_stroke_dump (&self->left);
- if (self->top.flags)
- ccd_border_stroke_dump (&self->top);
- if (self->right.flags)
- ccd_border_stroke_dump (&self->right);
- if (self->bottom.flags)
- ccd_border_stroke_dump (&self->bottom);
+ ccd_border_stroke_dump (&self->left);
+ ccd_border_stroke_dump (&self->top);
+ ccd_border_stroke_dump (&self->right);
+ ccd_border_stroke_dump (&self->bottom);
}
#endif /* CCD_DEBUG */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]