[cairo-commit] 2 commits - src/cairo-path-fixed.c src/cairo-tor-scan-converter.c
Chris Wilson
ickle at kemper.freedesktop.org
Wed Aug 10 02:51:37 PDT 2011
src/cairo-path-fixed.c | 8 ++++----
src/cairo-tor-scan-converter.c | 24 ++++++++++--------------
2 files changed, 14 insertions(+), 18 deletions(-)
New commits:
commit 34ce4680d12aecc5565e09fcc6a6a9103e1c752d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Aug 9 23:39:07 2011 +0100
fixed: Allow the implicit close of the last fill path to complete a fill-box
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index 7af45f8..a562e5b 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -1375,13 +1375,13 @@ _cairo_path_fixed_iter_is_fill_box (cairo_path_fixed_iter_t *_iter,
if (iter.buf->op[iter.n_op] != CAIRO_PATH_OP_LINE_TO)
return FALSE;
points[3] = iter.buf->points[iter.n_point++];
- if (! _cairo_path_fixed_iter_next_op (&iter))
- return FALSE;
/* Now, there are choices. The rectangle might end with a LINE_TO
* (to the original point), but this isn't required. If it
* doesn't, then it must end with a CLOSE_PATH (which may be implicit). */
- if (iter.buf->op[iter.n_op] == CAIRO_PATH_OP_LINE_TO) {
+ if (! _cairo_path_fixed_iter_next_op (&iter)) {
+ /* implicit close due to fill */
+ } else if (iter.buf->op[iter.n_op] == CAIRO_PATH_OP_LINE_TO) {
points[4] = iter.buf->points[iter.n_point++];
if (points[4].x != points[0].x || points[4].y != points[0].y)
return FALSE;
@@ -1389,7 +1389,7 @@ _cairo_path_fixed_iter_is_fill_box (cairo_path_fixed_iter_t *_iter,
} else if (iter.buf->op[iter.n_op] == CAIRO_PATH_OP_CLOSE_PATH) {
_cairo_path_fixed_iter_next_op (&iter);
} else if (iter.buf->op[iter.n_op] == CAIRO_PATH_OP_MOVE_TO) {
- /* implicit close-path */
+ /* implicit close-path due to new-sub-path */
} else {
return FALSE;
}
commit f8a30380084ae3d6ac4aa7b18d738d6e6980cb05
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Aug 9 22:21:33 2011 +0100
tor: update is-vertical along with min-height
Similar to the minimum height property, is-vertical can only change
after an insertion or deletion event. So we only need to update the
flags after one of those events, so simply update it along side
min-height.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-tor-scan-converter.c b/src/cairo-tor-scan-converter.c
index d9c9ce8..c35ec0f 100644
--- a/src/cairo-tor-scan-converter.c
+++ b/src/cairo-tor-scan-converter.c
@@ -493,6 +493,7 @@ struct active_list {
* scan conversion by a full pixel row if an edge ends somewhere
* within it. */
grid_scaled_y_t min_height;
+ int is_vertical;
};
struct glitter_scan_converter {
@@ -1121,6 +1122,7 @@ active_list_reset (struct active_list *active)
active->tail.height_left = INT_MAX;
active->tail.vertical = 1;
active->min_height = 0;
+ active->is_vertical = 1;
}
static void
@@ -1262,14 +1264,17 @@ active_list_can_step_full_row (struct active_list *active)
* list if we have been dropping edges. */
if (active->min_height <= 0) {
int min_height = INT_MAX;
+ int is_vertical = 1;
e = active->head.next;
while (NULL != e) {
if (e->height_left < min_height)
min_height = e->height_left;
+ is_vertical &= e->vertical;
e = e->next;
}
+ active->is_vertical = is_vertical;
active->min_height = min_height;
}
@@ -1312,6 +1317,7 @@ polygon_fill_buckets (struct active_list *active,
struct edge **buckets)
{
grid_scaled_y_t min_height = active->min_height;
+ int is_vertical = active->is_vertical;
while (edge) {
struct edge *next = edge->next;
@@ -1323,9 +1329,11 @@ polygon_fill_buckets (struct active_list *active,
buckets[suby] = edge;
if (edge->height_left < min_height)
min_height = edge->height_left;
+ is_vertical &= edge->vertical;
edge = next;
}
+ active->is_vertical = is_vertical;
active->min_height = min_height;
}
@@ -1665,19 +1673,6 @@ glitter_scan_converter_add_edge (glitter_scan_converter_t *converter,
# define GLITTER_BLIT_COVERAGES_EMPTY(y0, y1, xmin, xmax)
#endif
-static cairo_bool_t
-active_list_is_vertical (struct active_list *active)
-{
- struct edge *e;
-
- for (e = active->head.next; e != &active->tail; e = e->next) {
- if (! e->vertical)
- return FALSE;
- }
-
- return TRUE;
-}
-
static void
step_edges (struct active_list *active, int count)
{
@@ -1728,6 +1723,7 @@ glitter_scan_converter_render(
if (GRID_Y == EDGE_Y_BUCKET_HEIGHT && ! polygon->y_buckets[i]) {
if (active->head.next == &active->tail) {
active->min_height = INT_MAX;
+ active->is_vertical = 1;
for (; j < h && ! polygon->y_buckets[j]; j++)
;
GLITTER_BLIT_COVERAGES_EMPTY (i+ymin_i, j-i, xmin_i, xmax_i);
@@ -1744,7 +1740,7 @@ glitter_scan_converter_render(
else
apply_evenodd_fill_rule_and_step_edges (active, coverages);
- if (active_list_is_vertical (active)) {
+ if (active->is_vertical) {
while (j < h &&
polygon->y_buckets[j] == NULL &&
active->min_height >= 2*GRID_Y)
More information about the cairo-commit
mailing list