2010-10-22 12:35:40 +02:00
|
|
|
/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
|
2004-08-02 13:13:28 +00:00
|
|
|
/* cairo - a vector graphics library with display and print output
|
|
|
|
|
*
|
2004-10-21 18:40:50 +00:00
|
|
|
* Copyright © 2003 University of Southern California
|
2003-07-18 11:34:19 +00:00
|
|
|
*
|
2004-08-02 13:13:28 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
2004-09-04 06:38:34 +00:00
|
|
|
* modify it either under the terms of the GNU Lesser General Public
|
|
|
|
|
* License version 2.1 as published by the Free Software Foundation
|
|
|
|
|
* (the "LGPL") or, at your option, under the terms of the Mozilla
|
|
|
|
|
* Public License Version 1.1 (the "MPL"). If you do not alter this
|
|
|
|
|
* notice, a recipient may use your version of this file under either
|
|
|
|
|
* the MPL or the LGPL.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the LGPL along with this library
|
|
|
|
|
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
|
2010-04-27 10:17:23 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
|
2004-09-04 06:38:34 +00:00
|
|
|
* You should have received a copy of the MPL along with this library
|
|
|
|
|
* in the file COPYING-MPL-1.1
|
|
|
|
|
*
|
|
|
|
|
* The contents of this file are subject to the Mozilla Public License
|
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
|
|
|
|
|
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
|
|
|
|
* the specific language governing rights and limitations.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is the cairo graphics library.
|
|
|
|
|
*
|
|
|
|
|
* The Initial Developer of the Original Code is University of Southern
|
|
|
|
|
* California.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s):
|
2005-02-22 11:35:03 +00:00
|
|
|
* Carl D. Worth <cworth@cworth.org>
|
2003-07-18 11:34:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "cairoint.h"
|
2012-04-19 11:59:54 +01:00
|
|
|
#include "cairo-box-inline.h"
|
2011-07-14 21:19:54 +01:00
|
|
|
#include "cairo-error-private.h"
|
2010-01-22 15:54:45 +00:00
|
|
|
#include "cairo-path-fixed-private.h"
|
2003-07-18 11:34:19 +00:00
|
|
|
|
2010-10-22 12:35:40 +02:00
|
|
|
typedef struct _cairo_path_bounder {
|
|
|
|
|
cairo_point_t current_point;
|
|
|
|
|
cairo_bool_t has_extents;
|
2008-12-18 11:50:00 +00:00
|
|
|
cairo_box_t extents;
|
2003-07-18 12:42:49 +00:00
|
|
|
} cairo_path_bounder_t;
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
static cairo_status_t
|
2008-12-09 20:44:25 +00:00
|
|
|
_cairo_path_bounder_move_to (void *closure,
|
|
|
|
|
const cairo_point_t *point)
|
2003-12-08 17:39:32 +00:00
|
|
|
{
|
|
|
|
|
cairo_path_bounder_t *bounder = closure;
|
|
|
|
|
|
2008-12-27 11:46:24 +00:00
|
|
|
bounder->current_point = *point;
|
2010-10-22 12:35:40 +02:00
|
|
|
|
|
|
|
|
if (likely (bounder->has_extents)) {
|
|
|
|
|
_cairo_box_add_point (&bounder->extents, point);
|
|
|
|
|
} else {
|
|
|
|
|
bounder->has_extents = TRUE;
|
|
|
|
|
_cairo_box_set (&bounder->extents, point, point);
|
|
|
|
|
}
|
2003-12-08 17:39:32 +00:00
|
|
|
|
|
|
|
|
return CAIRO_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_status_t
|
2008-12-09 20:44:25 +00:00
|
|
|
_cairo_path_bounder_line_to (void *closure,
|
|
|
|
|
const cairo_point_t *point)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
2003-07-18 12:42:49 +00:00
|
|
|
cairo_path_bounder_t *bounder = closure;
|
2003-07-18 11:34:19 +00:00
|
|
|
|
2008-12-27 11:29:15 +00:00
|
|
|
bounder->current_point = *point;
|
2010-10-22 12:35:40 +02:00
|
|
|
_cairo_box_add_point (&bounder->extents, point);
|
2003-07-18 11:34:19 +00:00
|
|
|
|
|
|
|
|
return CAIRO_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-25 10:04:50 +00:00
|
|
|
static cairo_status_t
|
|
|
|
|
_cairo_path_bounder_curve_to (void *closure,
|
2008-12-09 20:44:25 +00:00
|
|
|
const cairo_point_t *b,
|
|
|
|
|
const cairo_point_t *c,
|
|
|
|
|
const cairo_point_t *d)
|
2008-11-25 10:04:50 +00:00
|
|
|
{
|
|
|
|
|
cairo_path_bounder_t *bounder = closure;
|
|
|
|
|
|
2010-10-22 12:35:40 +02:00
|
|
|
_cairo_box_add_curve_to (&bounder->extents,
|
|
|
|
|
&bounder->current_point,
|
|
|
|
|
b, c, d);
|
|
|
|
|
bounder->current_point = *d;
|
|
|
|
|
|
|
|
|
|
return CAIRO_STATUS_SUCCESS;
|
2008-11-25 10:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-18 11:34:19 +00:00
|
|
|
static cairo_status_t
|
2003-12-08 17:39:32 +00:00
|
|
|
_cairo_path_bounder_close_path (void *closure)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
|
|
|
|
return CAIRO_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-22 12:35:40 +02:00
|
|
|
cairo_bool_t
|
|
|
|
|
_cairo_path_bounder_extents (const cairo_path_fixed_t *path,
|
|
|
|
|
cairo_box_t *extents)
|
|
|
|
|
{
|
|
|
|
|
cairo_path_bounder_t bounder;
|
|
|
|
|
cairo_status_t status;
|
|
|
|
|
|
|
|
|
|
bounder.has_extents = FALSE;
|
2010-12-09 22:00:01 +01:00
|
|
|
status = _cairo_path_fixed_interpret (path,
|
2010-10-22 12:35:40 +02:00
|
|
|
_cairo_path_bounder_move_to,
|
|
|
|
|
_cairo_path_bounder_line_to,
|
|
|
|
|
_cairo_path_bounder_curve_to,
|
|
|
|
|
_cairo_path_bounder_close_path,
|
|
|
|
|
&bounder);
|
|
|
|
|
assert (!status);
|
|
|
|
|
|
|
|
|
|
if (bounder.has_extents)
|
|
|
|
|
*extents = bounder.extents;
|
|
|
|
|
|
|
|
|
|
return bounder.has_extents;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-25 10:04:50 +00:00
|
|
|
void
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
_cairo_path_fixed_approximate_clip_extents (const cairo_path_fixed_t *path,
|
2009-01-14 18:55:32 +00:00
|
|
|
cairo_rectangle_int_t *extents)
|
2008-12-18 14:52:03 +00:00
|
|
|
{
|
2010-10-22 12:35:40 +02:00
|
|
|
_cairo_path_fixed_approximate_fill_extents (path, extents);
|
2008-12-18 14:52:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
_cairo_path_fixed_approximate_fill_extents (const cairo_path_fixed_t *path,
|
2008-12-18 14:52:03 +00:00
|
|
|
cairo_rectangle_int_t *extents)
|
|
|
|
|
{
|
2010-10-22 12:35:40 +02:00
|
|
|
_cairo_path_fixed_fill_extents (path, CAIRO_FILL_RULE_WINDING, 0, extents);
|
2008-12-18 14:52:03 +00:00
|
|
|
}
|
|
|
|
|
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
void
|
|
|
|
|
_cairo_path_fixed_fill_extents (const cairo_path_fixed_t *path,
|
|
|
|
|
cairo_fill_rule_t fill_rule,
|
|
|
|
|
double tolerance,
|
|
|
|
|
cairo_rectangle_int_t *extents)
|
|
|
|
|
{
|
2010-10-22 12:35:40 +02:00
|
|
|
if (path->extents.p1.x < path->extents.p2.x &&
|
|
|
|
|
path->extents.p1.y < path->extents.p2.y) {
|
|
|
|
|
_cairo_box_round_to_rectangle (&path->extents, extents);
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
} else {
|
|
|
|
|
extents->x = extents->y = 0;
|
|
|
|
|
extents->width = extents->height = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-18 14:52:03 +00:00
|
|
|
/* Adjusts the fill extents (above) by the device-space pen. */
|
|
|
|
|
void
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
_cairo_path_fixed_approximate_stroke_extents (const cairo_path_fixed_t *path,
|
2010-01-18 18:20:16 +00:00
|
|
|
const cairo_stroke_style_t *style,
|
2010-01-22 15:54:45 +00:00
|
|
|
const cairo_matrix_t *ctm,
|
2015-09-21 21:35:05 +09:30
|
|
|
cairo_bool_t is_vector,
|
2008-12-18 14:52:03 +00:00
|
|
|
cairo_rectangle_int_t *extents)
|
2008-11-25 10:04:50 +00:00
|
|
|
{
|
2010-10-22 12:35:40 +02:00
|
|
|
if (path->has_extents) {
|
|
|
|
|
cairo_box_t box_extents;
|
2009-08-27 13:58:43 +01:00
|
|
|
double dx, dy;
|
|
|
|
|
|
2011-07-30 17:28:21 +01:00
|
|
|
_cairo_stroke_style_max_distance_from_path (style, path, ctm, &dx, &dy);
|
2015-09-21 21:35:05 +09:30
|
|
|
if (is_vector)
|
|
|
|
|
{
|
|
|
|
|
/* When calculating extents for vector surfaces, ensure lines thinner
|
|
|
|
|
* than the fixed point resolution are not optimized away. */
|
|
|
|
|
double min = _cairo_fixed_to_double (CAIRO_FIXED_EPSILON*2);
|
|
|
|
|
if (dx < min)
|
|
|
|
|
dx = min;
|
|
|
|
|
|
|
|
|
|
if (dy < min)
|
|
|
|
|
dy = min;
|
|
|
|
|
}
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2010-10-22 12:35:40 +02:00
|
|
|
box_extents = path->extents;
|
|
|
|
|
box_extents.p1.x -= _cairo_fixed_from_double (dx);
|
|
|
|
|
box_extents.p1.y -= _cairo_fixed_from_double (dy);
|
|
|
|
|
box_extents.p2.x += _cairo_fixed_from_double (dx);
|
|
|
|
|
box_extents.p2.y += _cairo_fixed_from_double (dy);
|
2009-08-27 13:58:43 +01:00
|
|
|
|
2010-10-22 12:35:40 +02:00
|
|
|
_cairo_box_round_to_rectangle (&box_extents, extents);
|
2008-11-25 10:04:50 +00:00
|
|
|
} else {
|
2008-12-18 14:52:03 +00:00
|
|
|
extents->x = extents->y = 0;
|
2009-01-02 14:03:35 +00:00
|
|
|
extents->width = extents->height = 0;
|
2008-11-25 10:04:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
cairo_status_t
|
2010-01-22 15:54:45 +00:00
|
|
|
_cairo_path_fixed_stroke_extents (const cairo_path_fixed_t *path,
|
|
|
|
|
const cairo_stroke_style_t *stroke_style,
|
|
|
|
|
const cairo_matrix_t *ctm,
|
|
|
|
|
const cairo_matrix_t *ctm_inverse,
|
|
|
|
|
double tolerance,
|
|
|
|
|
cairo_rectangle_int_t *extents)
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
{
|
2011-07-30 17:28:21 +01:00
|
|
|
cairo_polygon_t polygon;
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
cairo_status_t status;
|
2015-09-21 21:35:05 +09:30
|
|
|
cairo_stroke_style_t style;
|
|
|
|
|
|
|
|
|
|
/* When calculating extents for vector surfaces, ensure lines thinner
|
2017-10-03 22:18:49 +10:30
|
|
|
* than one point are not optimized away. */
|
|
|
|
|
double min_line_width = _cairo_matrix_transformed_circle_major_axis (ctm_inverse, 1.0);
|
2015-09-21 21:35:05 +09:30
|
|
|
if (stroke_style->line_width < min_line_width)
|
|
|
|
|
{
|
|
|
|
|
style = *stroke_style;
|
|
|
|
|
style.line_width = min_line_width;
|
|
|
|
|
stroke_style = &style;
|
|
|
|
|
}
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
|
2011-07-30 17:28:21 +01:00
|
|
|
_cairo_polygon_init (&polygon, NULL, 0);
|
|
|
|
|
status = _cairo_path_fixed_stroke_to_polygon (path,
|
|
|
|
|
stroke_style,
|
|
|
|
|
ctm, ctm_inverse,
|
|
|
|
|
tolerance,
|
|
|
|
|
&polygon);
|
|
|
|
|
_cairo_box_round_to_rectangle (&polygon.extents, extents);
|
|
|
|
|
_cairo_polygon_fini (&polygon);
|
Remove clip handling from generic surface layer.
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
2009-07-23 15:32:13 +01:00
|
|
|
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-22 15:54:45 +00:00
|
|
|
cairo_bool_t
|
|
|
|
|
_cairo_path_fixed_extents (const cairo_path_fixed_t *path,
|
|
|
|
|
cairo_box_t *box)
|
2003-07-18 11:34:19 +00:00
|
|
|
{
|
2010-10-22 12:35:40 +02:00
|
|
|
*box = path->extents;
|
|
|
|
|
return path->has_extents;
|
2003-07-18 11:34:19 +00:00
|
|
|
}
|