# HG changeset patch # User Thinker K.F. Li # Date 1217011988 -28800 # Node ID 569f3168ba53c569cd6631dee3e3129917b69d9a # Parent 772511b8b9be237d7a64c0900382b84e4cd91fed Clear background & tranform relative pos into absolute ones diff -r 772511b8b9be -r 569f3168ba53 src/X_main.c --- a/src/X_main.c Sat Jul 26 02:41:00 2008 +0800 +++ b/src/X_main.c Sat Jul 26 02:53:08 2008 +0800 @@ -15,8 +15,9 @@ memset(coord.aggr_matrix, 0, sizeof(co_aix) * 6); coord.aggr_matrix[0] = 1; coord.aggr_matrix[1] = 0.5; + coord.aggr_matrix[2] = -30; coord.aggr_matrix[4] = 1; - coord.aggr_matrix[5] = 0; + coord.aggr_matrix[5] = -20; sh_path_transform(path, &coord); sh_path_draw(path, cr); } @@ -25,6 +26,8 @@ cairo_t *cr; cr = cairo_create(surface); + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_paint(cr); cairo_set_source_rgb(cr, 0.9, 0.1, 0.1); draw_path(cr, w, h); cairo_set_source_rgb(cr, 0.5, 0.9, 0.8); diff -r 772511b8b9be -r 569f3168ba53 src/shape_path.c --- a/src/shape_path.c Sat Jul 26 02:41:00 2008 +0800 +++ b/src/shape_path.c Sat Jul 26 02:53:08 2008 +0800 @@ -178,6 +178,7 @@ static int sh_path_cmd_arg_fill(char *data, sh_path_t *path) { char *p, *old; char *cmds; + char cmd; co_aix *args; cmds = path->user_data; @@ -186,9 +187,9 @@ while(*p) { SKIP_SPACE(p); - /* TODO: transform all relative to absolute, */ - *cmds++ = *p; - switch(*p++) { + /* Transform all relative to absolute, */ + *cmds++ = toupper(*p); + switch((cmd = *p++)) { case 'c': case 'C': while(*p) { @@ -198,41 +199,41 @@ SKIP_NUM(p); if(p == old) break; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); } break; case 's': @@ -246,28 +247,28 @@ SKIP_NUM(p); if(p == old) break; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); } break; case 'm': @@ -283,14 +284,14 @@ SKIP_NUM(p); if(p == old) break; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = atof(old); + *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); } break; case 'h':