2023-01-01 15:14:08 +10:30
|
|
|
/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
|
2006-02-27 17:14:57 -05:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2006 Keith Packard
|
2007-08-21 22:27:57 +09:30
|
|
|
* Copyright © 2007 Adrian Johnson
|
2006-02-27 17:14:57 -05:00
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* 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
|
2006-02-27 17:14:57 -05: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 Keith Packard
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s):
|
|
|
|
|
* Keith Packard <keithp@keithp.com>
|
2007-08-21 22:27:57 +09:30
|
|
|
* Adrian Johnson <ajohnson@redneon.com>
|
2006-02-27 17:14:57 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "cairoint.h"
|
|
|
|
|
|
2006-02-27 14:56:41 -08:00
|
|
|
#include "cairo-analysis-surface-private.h"
|
2012-04-19 11:59:54 +01:00
|
|
|
#include "cairo-box-inline.h"
|
2010-04-23 19:45:26 +01:00
|
|
|
#include "cairo-default-context-private.h"
|
2010-01-18 16:58:40 +00:00
|
|
|
#include "cairo-error-private.h"
|
2007-04-21 02:25:51 -04:00
|
|
|
#include "cairo-paginated-private.h"
|
2012-04-19 11:59:54 +01:00
|
|
|
#include "cairo-recording-surface-inline.h"
|
|
|
|
|
#include "cairo-surface-snapshot-inline.h"
|
2012-04-19 11:59:54 +01:00
|
|
|
#include "cairo-surface-subsurface-inline.h"
|
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
|
|
|
#include "cairo-region-private.h"
|
2006-02-27 17:14:57 -05:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
cairo_surface_t base;
|
|
|
|
|
|
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_surface_t *target;
|
2006-06-06 15:25:49 -07:00
|
|
|
|
2007-09-23 17:43:44 +09:30
|
|
|
cairo_bool_t first_op;
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_bool_t has_supported;
|
|
|
|
|
cairo_bool_t has_unsupported;
|
|
|
|
|
|
2009-04-10 14:50:26 +01:00
|
|
|
cairo_region_t supported_region;
|
|
|
|
|
cairo_region_t fallback_region;
|
2007-09-23 17:43:44 +09:30
|
|
|
cairo_box_t page_bbox;
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
cairo_bool_t create_region_ids;
|
|
|
|
|
unsigned source_region_id;
|
|
|
|
|
unsigned mask_region_id;
|
|
|
|
|
|
2007-12-29 00:26:11 +10:30
|
|
|
cairo_bool_t has_ctm;
|
|
|
|
|
cairo_matrix_t ctm;
|
|
|
|
|
|
2006-02-27 14:56:41 -08:00
|
|
|
} cairo_analysis_surface_t;
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2008-09-25 10:40:32 +01:00
|
|
|
cairo_int_status_t
|
|
|
|
|
_cairo_analysis_surface_merge_status (cairo_int_status_t status_a,
|
|
|
|
|
cairo_int_status_t status_b)
|
|
|
|
|
{
|
|
|
|
|
/* fatal errors should be checked and propagated at source */
|
2011-07-14 21:19:54 +01:00
|
|
|
assert (! _cairo_int_status_is_error (status_a));
|
|
|
|
|
assert (! _cairo_int_status_is_error (status_b));
|
2008-09-25 10:40:32 +01:00
|
|
|
|
|
|
|
|
/* return the most important status */
|
|
|
|
|
if (status_a == CAIRO_INT_STATUS_UNSUPPORTED ||
|
|
|
|
|
status_b == CAIRO_INT_STATUS_UNSUPPORTED)
|
|
|
|
|
return CAIRO_INT_STATUS_UNSUPPORTED;
|
|
|
|
|
|
|
|
|
|
if (status_a == CAIRO_INT_STATUS_IMAGE_FALLBACK ||
|
|
|
|
|
status_b == CAIRO_INT_STATUS_IMAGE_FALLBACK)
|
|
|
|
|
return CAIRO_INT_STATUS_IMAGE_FALLBACK;
|
|
|
|
|
|
2009-10-22 02:13:36 +03:00
|
|
|
if (status_a == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN ||
|
|
|
|
|
status_b == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN)
|
|
|
|
|
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
|
2008-09-25 10:40:32 +01:00
|
|
|
|
|
|
|
|
if (status_a == CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY ||
|
|
|
|
|
status_b == CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY)
|
|
|
|
|
return CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY;
|
|
|
|
|
|
|
|
|
|
/* at this point we have checked all the valid internal codes, so... */
|
2011-07-14 21:19:54 +01:00
|
|
|
assert (status_a == CAIRO_INT_STATUS_SUCCESS &&
|
|
|
|
|
status_b == CAIRO_INT_STATUS_SUCCESS);
|
2008-09-25 10:40:32 +01:00
|
|
|
|
2011-07-14 21:19:54 +01:00
|
|
|
return CAIRO_INT_STATUS_SUCCESS;
|
2008-09-25 10:40:32 +01:00
|
|
|
}
|
|
|
|
|
|
2011-08-14 01:41:44 +01:00
|
|
|
struct proxy {
|
|
|
|
|
cairo_surface_t base;
|
|
|
|
|
cairo_surface_t *target;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static cairo_status_t
|
|
|
|
|
proxy_finish (void *abstract_surface)
|
|
|
|
|
{
|
|
|
|
|
return CAIRO_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const cairo_surface_backend_t proxy_backend = {
|
|
|
|
|
CAIRO_INTERNAL_SURFACE_TYPE_NULL,
|
|
|
|
|
proxy_finish,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static cairo_surface_t *
|
|
|
|
|
attach_proxy (cairo_surface_t *source,
|
|
|
|
|
cairo_surface_t *target)
|
|
|
|
|
{
|
|
|
|
|
struct proxy *proxy;
|
|
|
|
|
|
2024-06-21 10:03:52 +09:30
|
|
|
proxy = _cairo_calloc (sizeof (*proxy));
|
2011-08-14 01:41:44 +01:00
|
|
|
if (unlikely (proxy == NULL))
|
|
|
|
|
return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
|
|
|
|
|
|
2015-09-21 21:35:05 +09:30
|
|
|
_cairo_surface_init (&proxy->base, &proxy_backend, NULL, target->content, target->is_vector);
|
2011-08-14 01:41:44 +01:00
|
|
|
|
|
|
|
|
proxy->target = target;
|
|
|
|
|
_cairo_surface_attach_snapshot (source, &proxy->base, NULL);
|
|
|
|
|
|
|
|
|
|
return &proxy->base;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
detach_proxy (cairo_surface_t *proxy)
|
|
|
|
|
{
|
|
|
|
|
cairo_surface_finish (proxy);
|
|
|
|
|
cairo_surface_destroy (proxy);
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
static cairo_int_status_t
|
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
|
|
|
_add_operation (cairo_analysis_surface_t *surface,
|
|
|
|
|
cairo_rectangle_int_t *rect,
|
|
|
|
|
cairo_int_status_t backend_status)
|
2007-08-21 22:27:57 +09:30
|
|
|
{
|
|
|
|
|
cairo_int_status_t status;
|
2007-09-23 17:43:44 +09:30
|
|
|
cairo_box_t bbox;
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2008-03-24 12:16:20 +10:30
|
|
|
if (rect->width == 0 || rect->height == 0) {
|
|
|
|
|
/* Even though the operation is not visible we must be careful
|
|
|
|
|
* to not allow unsupported operations to be replayed to the
|
|
|
|
|
* backend during CAIRO_PAGINATED_MODE_RENDER */
|
2011-07-14 21:19:54 +01:00
|
|
|
if (backend_status == CAIRO_INT_STATUS_SUCCESS ||
|
2011-07-20 19:08:38 +09:30
|
|
|
backend_status == CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY ||
|
|
|
|
|
backend_status == CAIRO_INT_STATUS_NOTHING_TO_DO)
|
2008-03-24 12:16:20 +10:30
|
|
|
{
|
2011-07-14 21:19:54 +01:00
|
|
|
return CAIRO_INT_STATUS_SUCCESS;
|
2008-03-24 12:16:20 +10:30
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return CAIRO_INT_STATUS_IMAGE_FALLBACK;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2008-05-09 13:20:02 +02:00
|
|
|
_cairo_box_from_rectangle (&bbox, rect);
|
|
|
|
|
|
2007-12-29 00:26:11 +10:30
|
|
|
if (surface->has_ctm) {
|
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
|
|
|
int tx, ty;
|
|
|
|
|
|
|
|
|
|
if (_cairo_matrix_is_integer_translation (&surface->ctm, &tx, &ty)) {
|
|
|
|
|
rect->x += tx;
|
|
|
|
|
rect->y += ty;
|
2012-04-09 12:49:20 +01:00
|
|
|
|
|
|
|
|
tx = _cairo_fixed_from_int (tx);
|
|
|
|
|
bbox.p1.x += tx;
|
|
|
|
|
bbox.p2.x += tx;
|
|
|
|
|
|
|
|
|
|
ty = _cairo_fixed_from_int (ty);
|
|
|
|
|
bbox.p1.y += ty;
|
|
|
|
|
bbox.p2.y += ty;
|
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 {
|
|
|
|
|
_cairo_matrix_transform_bounding_box_fixed (&surface->ctm,
|
|
|
|
|
&bbox, NULL);
|
|
|
|
|
|
|
|
|
|
if (bbox.p1.x == bbox.p2.x || bbox.p1.y == bbox.p2.y) {
|
|
|
|
|
/* Even though the operation is not visible we must be
|
|
|
|
|
* careful to not allow unsupported operations to be
|
|
|
|
|
* replayed to the backend during
|
|
|
|
|
* CAIRO_PAGINATED_MODE_RENDER */
|
2011-07-14 21:19:54 +01:00
|
|
|
if (backend_status == CAIRO_INT_STATUS_SUCCESS ||
|
2011-07-20 19:08:38 +09:30
|
|
|
backend_status == CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY ||
|
|
|
|
|
backend_status == CAIRO_INT_STATUS_NOTHING_TO_DO)
|
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-14 21:19:54 +01:00
|
|
|
return CAIRO_INT_STATUS_SUCCESS;
|
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
|
|
|
|
|
{
|
|
|
|
|
return CAIRO_INT_STATUS_IMAGE_FALLBACK;
|
|
|
|
|
}
|
2008-03-24 12:16:20 +10:30
|
|
|
}
|
2008-01-05 19:22:57 +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_box_round_to_rectangle (&bbox, rect);
|
|
|
|
|
}
|
2007-12-29 00:26:11 +10:30
|
|
|
}
|
|
|
|
|
|
2007-09-23 17:43:44 +09:30
|
|
|
if (surface->first_op) {
|
|
|
|
|
surface->first_op = FALSE;
|
|
|
|
|
surface->page_bbox = bbox;
|
2012-02-10 00:03:51 +00:00
|
|
|
} else
|
|
|
|
|
_cairo_box_add_box(&surface->page_bbox, &bbox);
|
2007-09-23 17:43:44 +09:30
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
/* If the operation is completely enclosed within the fallback
|
|
|
|
|
* region there is no benefit in emitting a native operation as
|
|
|
|
|
* the fallback image will be painted on top.
|
|
|
|
|
*/
|
2009-04-10 14:50:26 +01:00
|
|
|
if (cairo_region_contains_rectangle (&surface->fallback_region, rect) == CAIRO_REGION_OVERLAP_IN)
|
2007-08-21 22:27:57 +09:30
|
|
|
return CAIRO_INT_STATUS_IMAGE_FALLBACK;
|
|
|
|
|
|
|
|
|
|
if (backend_status == CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY) {
|
|
|
|
|
/* A status of CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY indicates
|
|
|
|
|
* that the backend only supports this operation if the
|
|
|
|
|
* transparency removed. If the extents of this operation does
|
|
|
|
|
* not intersect any other native operation, the operation is
|
|
|
|
|
* natively supported and the backend will blend the
|
|
|
|
|
* transparency into the white background.
|
|
|
|
|
*/
|
2009-04-10 14:50:26 +01:00
|
|
|
if (cairo_region_contains_rectangle (&surface->supported_region, rect) == CAIRO_REGION_OVERLAP_OUT)
|
2011-07-14 21:19:54 +01:00
|
|
|
backend_status = CAIRO_INT_STATUS_SUCCESS;
|
2007-08-21 22:27:57 +09:30
|
|
|
}
|
|
|
|
|
|
2011-07-14 21:19:54 +01:00
|
|
|
if (backend_status == CAIRO_INT_STATUS_SUCCESS) {
|
2007-08-21 22:27:57 +09:30
|
|
|
/* Add the operation to the supported region. Operations in
|
|
|
|
|
* this region will be emitted as native operations.
|
|
|
|
|
*/
|
|
|
|
|
surface->has_supported = TRUE;
|
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 cairo_region_union_rectangle (&surface->supported_region, rect);
|
2007-08-21 22:27:57 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add the operation to the unsupported region. This region will
|
|
|
|
|
* be painted as an image after all native operations have been
|
|
|
|
|
* emitted.
|
|
|
|
|
*/
|
|
|
|
|
surface->has_unsupported = TRUE;
|
2009-04-10 14:50:26 +01:00
|
|
|
status = cairo_region_union_rectangle (&surface->fallback_region, rect);
|
2007-08-21 22:27:57 +09:30
|
|
|
|
|
|
|
|
/* The status CAIRO_INT_STATUS_IMAGE_FALLBACK is used to indicate
|
2009-10-22 02:13:36 +03:00
|
|
|
* unsupported operations to the recording surface as using
|
2007-08-21 22:27:57 +09:30
|
|
|
* CAIRO_INT_STATUS_UNSUPPORTED would cause cairo-surface to
|
|
|
|
|
* invoke the cairo-surface-fallback path then return
|
|
|
|
|
* CAIRO_STATUS_SUCCESS.
|
|
|
|
|
*/
|
2011-07-14 21:19:54 +01:00
|
|
|
if (status == CAIRO_INT_STATUS_SUCCESS)
|
2007-08-21 22:27:57 +09:30
|
|
|
return CAIRO_INT_STATUS_IMAGE_FALLBACK;
|
|
|
|
|
else
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-09 20:52:36 +10:30
|
|
|
static cairo_int_status_t
|
|
|
|
|
_analyze_recording_surface_pattern (cairo_analysis_surface_t *surface,
|
|
|
|
|
const cairo_pattern_t *pattern,
|
2023-01-01 15:14:08 +10:30
|
|
|
cairo_rectangle_int_t *extents,
|
2023-02-19 21:10:58 +10:30
|
|
|
unsigned int *regions_id,
|
|
|
|
|
cairo_analysis_source_t source_type)
|
2017-11-09 20:52:36 +10:30
|
|
|
{
|
|
|
|
|
const cairo_surface_pattern_t *surface_pattern;
|
|
|
|
|
cairo_analysis_surface_t *tmp;
|
|
|
|
|
cairo_surface_t *source, *proxy;
|
|
|
|
|
cairo_matrix_t p2d;
|
2018-02-27 17:44:03 -06:00
|
|
|
cairo_int_status_t status;
|
|
|
|
|
cairo_int_status_t analysis_status = CAIRO_INT_STATUS_SUCCESS;
|
2017-11-09 20:52:36 +10:30
|
|
|
cairo_bool_t surface_is_unbounded;
|
|
|
|
|
cairo_bool_t unused;
|
2023-02-19 21:10:58 +10:30
|
|
|
cairo_bool_t replay_all;
|
2017-11-09 20:52:36 +10:30
|
|
|
|
|
|
|
|
assert (pattern->type == CAIRO_PATTERN_TYPE_SURFACE);
|
|
|
|
|
surface_pattern = (const cairo_surface_pattern_t *) pattern;
|
|
|
|
|
assert (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING);
|
|
|
|
|
source = surface_pattern->surface;
|
|
|
|
|
|
|
|
|
|
proxy = _cairo_surface_has_snapshot (source, &proxy_backend);
|
|
|
|
|
if (proxy != NULL) {
|
|
|
|
|
/* nothing untoward found so far */
|
|
|
|
|
return CAIRO_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tmp = (cairo_analysis_surface_t *)
|
2023-01-01 15:14:08 +10:30
|
|
|
_cairo_analysis_surface_create (surface->target, surface->create_region_ids);
|
2017-11-09 20:52:36 +10:30
|
|
|
if (unlikely (tmp->base.status)) {
|
2023-02-19 21:10:58 +10:30
|
|
|
status = tmp->base.status;
|
2017-11-09 20:52:36 +10:30
|
|
|
goto cleanup1;
|
|
|
|
|
}
|
|
|
|
|
proxy = attach_proxy (source, &tmp->base);
|
|
|
|
|
|
|
|
|
|
p2d = pattern->matrix;
|
|
|
|
|
status = cairo_matrix_invert (&p2d);
|
|
|
|
|
assert (status == CAIRO_INT_STATUS_SUCCESS);
|
|
|
|
|
_cairo_analysis_surface_set_ctm (&tmp->base, &p2d);
|
|
|
|
|
|
|
|
|
|
source = _cairo_surface_get_source (source, NULL);
|
|
|
|
|
surface_is_unbounded = (pattern->extend == CAIRO_EXTEND_REPEAT
|
2023-01-01 15:14:08 +10:30
|
|
|
|| pattern->extend == CAIRO_EXTEND_REFLECT);
|
|
|
|
|
|
|
|
|
|
if (surface->create_region_ids) {
|
|
|
|
|
status = _cairo_recording_surface_region_array_attach (source, regions_id);
|
|
|
|
|
if (unlikely (status))
|
|
|
|
|
goto cleanup2;
|
2023-02-19 21:10:58 +10:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
replay_all = FALSE;
|
|
|
|
|
if (surface->target->backend->analyze_recording_surface) {
|
|
|
|
|
status = surface->target->backend->analyze_recording_surface (
|
|
|
|
|
surface->target,
|
|
|
|
|
surface_pattern,
|
|
|
|
|
surface->create_region_ids ? *regions_id : 0,
|
|
|
|
|
source_type,
|
|
|
|
|
TRUE);
|
|
|
|
|
if (status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN) {
|
|
|
|
|
/* Ensure all commands are replayed even if previously
|
|
|
|
|
* replayed and assigned to a region.*/
|
|
|
|
|
replay_all = TRUE;
|
|
|
|
|
status = CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
if (unlikely (status))
|
|
|
|
|
goto cleanup3;
|
|
|
|
|
}
|
2023-01-01 15:14:08 +10:30
|
|
|
|
2023-02-19 21:10:58 +10:30
|
|
|
if (surface->create_region_ids) {
|
2023-01-01 15:14:08 +10:30
|
|
|
status = _cairo_recording_surface_replay_and_create_regions (source,
|
|
|
|
|
*regions_id,
|
|
|
|
|
&pattern->matrix,
|
|
|
|
|
&tmp->base,
|
2023-02-19 21:10:58 +10:30
|
|
|
surface_is_unbounded,
|
|
|
|
|
replay_all);
|
2023-01-01 15:14:08 +10:30
|
|
|
if (unlikely (status))
|
2023-02-19 21:10:58 +10:30
|
|
|
goto cleanup3;
|
2023-01-01 15:14:08 +10:30
|
|
|
} else {
|
2023-02-19 21:10:58 +10:30
|
|
|
status = _cairo_recording_surface_replay_with_transform (source,
|
|
|
|
|
&pattern->matrix,
|
|
|
|
|
&tmp->base,
|
|
|
|
|
surface_is_unbounded,
|
|
|
|
|
replay_all);
|
2023-01-01 15:14:08 +10:30
|
|
|
if (unlikely (status))
|
2023-02-19 21:10:58 +10:30
|
|
|
goto cleanup3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (surface->target->backend->analyze_recording_surface) {
|
|
|
|
|
status = surface->target->backend->analyze_recording_surface (
|
|
|
|
|
surface->target,
|
|
|
|
|
surface_pattern,
|
|
|
|
|
surface->create_region_ids ? *regions_id : 0,
|
|
|
|
|
source_type,
|
|
|
|
|
FALSE);
|
|
|
|
|
if (unlikely (status))
|
|
|
|
|
goto cleanup3;
|
2023-01-01 15:14:08 +10:30
|
|
|
}
|
2017-11-09 20:52:36 +10:30
|
|
|
|
|
|
|
|
/* black background or mime data fills entire extents */
|
|
|
|
|
if (!(source->content & CAIRO_CONTENT_ALPHA) || _cairo_surface_has_mime_image (source)) {
|
|
|
|
|
cairo_rectangle_int_t rect;
|
|
|
|
|
|
|
|
|
|
if (_cairo_surface_get_extents (source, &rect)) {
|
|
|
|
|
cairo_box_t bbox;
|
|
|
|
|
|
|
|
|
|
_cairo_box_from_rectangle (&bbox, &rect);
|
|
|
|
|
_cairo_matrix_transform_bounding_box_fixed (&p2d, &bbox, NULL);
|
|
|
|
|
_cairo_box_round_to_rectangle (&bbox, &rect);
|
|
|
|
|
status = _add_operation (tmp, &rect, CAIRO_INT_STATUS_SUCCESS);
|
|
|
|
|
if (status == CAIRO_INT_STATUS_IMAGE_FALLBACK)
|
|
|
|
|
status = CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
if (unlikely (status))
|
2023-02-19 21:10:58 +10:30
|
|
|
goto cleanup3;
|
2017-11-09 20:52:36 +10:30
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tmp->has_supported) {
|
|
|
|
|
surface->has_supported = TRUE;
|
|
|
|
|
unused = cairo_region_union (&surface->supported_region, &tmp->supported_region);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tmp->has_unsupported) {
|
|
|
|
|
surface->has_unsupported = TRUE;
|
|
|
|
|
unused = cairo_region_union (&surface->fallback_region, &tmp->fallback_region);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
analysis_status = tmp->has_unsupported ? CAIRO_INT_STATUS_IMAGE_FALLBACK : CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
if (pattern->extend != CAIRO_EXTEND_NONE) {
|
|
|
|
|
_cairo_unbounded_rectangle_init (extents);
|
|
|
|
|
} else {
|
|
|
|
|
status = cairo_matrix_invert (&tmp->ctm);
|
|
|
|
|
_cairo_matrix_transform_bounding_box_fixed (&tmp->ctm,
|
|
|
|
|
&tmp->page_bbox, NULL);
|
|
|
|
|
_cairo_box_round_to_rectangle (&tmp->page_bbox, extents);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-19 21:10:58 +10:30
|
|
|
cleanup3:
|
|
|
|
|
if (surface->create_region_ids && unlikely (status)) {
|
|
|
|
|
_cairo_recording_surface_region_array_remove (source, *regions_id);
|
|
|
|
|
}
|
2017-11-09 20:52:36 +10:30
|
|
|
cleanup2:
|
|
|
|
|
detach_proxy (proxy);
|
|
|
|
|
cleanup1:
|
|
|
|
|
cairo_surface_destroy (&tmp->base);
|
|
|
|
|
|
|
|
|
|
if (unlikely (status))
|
|
|
|
|
return status;
|
2018-02-27 17:44:03 -06:00
|
|
|
else
|
|
|
|
|
return analysis_status;
|
2017-11-09 20:52:36 +10:30
|
|
|
}
|
|
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
static cairo_status_t
|
|
|
|
|
_cairo_analysis_surface_finish (void *abstract_surface)
|
|
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
|
|
|
|
|
2009-04-10 14:50:26 +01:00
|
|
|
_cairo_region_fini (&surface->supported_region);
|
|
|
|
|
_cairo_region_fini (&surface->fallback_region);
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2008-05-09 13:23:02 +02:00
|
|
|
cairo_surface_destroy (surface->target);
|
|
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
return CAIRO_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static cairo_bool_t
|
|
|
|
|
_cairo_analysis_surface_get_extents (void *abstract_surface,
|
|
|
|
|
cairo_rectangle_int_t *rectangle)
|
2007-08-21 22:27:57 +09:30
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
|
|
|
|
|
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 _cairo_surface_get_extents (surface->target, rectangle);
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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
|
|
|
static void
|
2011-07-14 21:19:54 +01:00
|
|
|
_rectangle_intersect_clip (cairo_rectangle_int_t *extents, const cairo_clip_t *clip)
|
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
|
|
|
{
|
|
|
|
|
if (clip != NULL)
|
2011-07-14 21:19:54 +01:00
|
|
|
_cairo_rectangle_intersect (extents, _cairo_clip_get_extents (clip));
|
2007-08-21 22:27:57 +09:30
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static void
|
|
|
|
|
_cairo_analysis_surface_operation_extents (cairo_analysis_surface_t *surface,
|
|
|
|
|
cairo_operator_t op,
|
|
|
|
|
const cairo_pattern_t *source,
|
2011-07-14 21:19:54 +01:00
|
|
|
const cairo_clip_t *clip,
|
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_rectangle_int_t *extents)
|
2006-02-27 20:09:24 -08: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_bool_t is_empty;
|
2006-02-27 20:09:24 -08: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
|
|
|
is_empty = _cairo_surface_get_extents (&surface->base, extents);
|
|
|
|
|
|
|
|
|
|
if (_cairo_operator_bounded_by_source (op)) {
|
|
|
|
|
cairo_rectangle_int_t source_extents;
|
|
|
|
|
|
2016-07-16 14:59:43 +09:30
|
|
|
_cairo_pattern_get_extents (source, &source_extents, surface->target->is_vector);
|
2011-03-18 16:57:04 +01:00
|
|
|
_cairo_rectangle_intersect (extents, &source_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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_rectangle_intersect_clip (extents, clip);
|
2006-02-27 20:09:24 -08:00
|
|
|
}
|
|
|
|
|
|
2006-02-27 17:14:57 -05:00
|
|
|
static cairo_int_status_t
|
2006-02-27 14:56:41 -08:00
|
|
|
_cairo_analysis_surface_paint (void *abstract_surface,
|
2008-10-22 19:24:44 +01:00
|
|
|
cairo_operator_t op,
|
2008-10-01 20:50:53 +09:30
|
|
|
const cairo_pattern_t *source,
|
2016-06-04 14:43:43 +09:30
|
|
|
const cairo_clip_t *clip)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2006-02-27 14:56:41 -08:00
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
2011-07-14 21:19:54 +01:00
|
|
|
cairo_int_status_t backend_status;
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_rectangle_int_t extents;
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
surface->source_region_id = 0;
|
|
|
|
|
surface->mask_region_id = 0;
|
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
|
|
|
if (surface->target->backend->paint == NULL) {
|
2007-08-21 22:27:57 +09:30
|
|
|
backend_status = CAIRO_INT_STATUS_UNSUPPORTED;
|
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 {
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->paint (surface->target,
|
|
|
|
|
op, source, clip);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_status))
|
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 backend_status;
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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_analysis_surface_operation_extents (surface,
|
|
|
|
|
op, source, clip,
|
|
|
|
|
&extents);
|
2016-06-04 14:43:43 +09:30
|
|
|
if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN) {
|
|
|
|
|
cairo_rectangle_int_t rec_extents;
|
2023-01-01 15:14:08 +10:30
|
|
|
backend_status = _analyze_recording_surface_pattern (surface,
|
|
|
|
|
source,
|
|
|
|
|
&rec_extents,
|
2023-02-19 21:10:58 +10:30
|
|
|
&surface->source_region_id,
|
|
|
|
|
CAIRO_ANALYSIS_SOURCE_PAINT);
|
2016-06-04 14:43:43 +09:30
|
|
|
_cairo_rectangle_intersect (&extents, &rec_extents);
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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 _add_operation (surface, &extents, backend_status);
|
2006-02-27 17:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
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_analysis_surface_mask (void *abstract_surface,
|
|
|
|
|
cairo_operator_t op,
|
2008-10-22 19:24:44 +01:00
|
|
|
const cairo_pattern_t *source,
|
2008-10-01 20:50:53 +09:30
|
|
|
const cairo_pattern_t *mask,
|
2016-06-04 14:43:43 +09:30
|
|
|
const cairo_clip_t *clip)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2006-02-27 14:56:41 -08:00
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
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_int_status_t backend_status;
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_rectangle_int_t extents;
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
surface->source_region_id = 0;
|
|
|
|
|
surface->mask_region_id = 0;
|
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
|
|
|
if (surface->target->backend->mask == NULL) {
|
2007-08-21 22:27:57 +09:30
|
|
|
backend_status = CAIRO_INT_STATUS_UNSUPPORTED;
|
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 {
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->mask (surface->target,
|
|
|
|
|
op, source, mask, clip);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_status))
|
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 backend_status;
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2016-06-04 14:43:43 +09:30
|
|
|
_cairo_analysis_surface_operation_extents (surface,
|
|
|
|
|
op, source, clip,
|
|
|
|
|
&extents);
|
2009-10-22 02:13:36 +03:00
|
|
|
if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN) {
|
2008-09-25 01:52:45 -07:00
|
|
|
cairo_int_status_t backend_source_status = CAIRO_STATUS_SUCCESS;
|
|
|
|
|
cairo_int_status_t backend_mask_status = CAIRO_STATUS_SUCCESS;
|
2016-06-04 14:43:43 +09:30
|
|
|
cairo_rectangle_int_t rec_extents;
|
2008-09-25 01:52:45 -07:00
|
|
|
|
2007-09-05 22:26:16 +09:30
|
|
|
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
|
2011-09-16 20:51:30 +09:30
|
|
|
cairo_surface_t *src_surface = ((cairo_surface_pattern_t *)source)->surface;
|
2012-04-27 12:39:40 +01:00
|
|
|
src_surface = _cairo_surface_get_source (src_surface, NULL);
|
2011-09-16 20:51:30 +09:30
|
|
|
if (_cairo_surface_is_recording (src_surface)) {
|
2008-09-25 01:52:45 -07:00
|
|
|
backend_source_status =
|
2023-01-01 15:14:08 +10:30
|
|
|
_analyze_recording_surface_pattern (surface,
|
|
|
|
|
source,
|
|
|
|
|
&rec_extents,
|
2023-02-19 21:10:58 +10:30
|
|
|
&surface->source_region_id,
|
|
|
|
|
CAIRO_ANALYSIS_SOURCE_MASK);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_source_status))
|
2008-09-25 01:52:45 -07:00
|
|
|
return backend_source_status;
|
2016-06-04 14:43:43 +09:30
|
|
|
|
|
|
|
|
_cairo_rectangle_intersect (&extents, &rec_extents);
|
2008-09-25 01:52:45 -07:00
|
|
|
}
|
2007-09-05 22:26:16 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mask->type == CAIRO_PATTERN_TYPE_SURFACE) {
|
2011-09-16 20:51:30 +09:30
|
|
|
cairo_surface_t *mask_surface = ((cairo_surface_pattern_t *)mask)->surface;
|
2012-04-27 12:39:40 +01:00
|
|
|
mask_surface = _cairo_surface_get_source (mask_surface, NULL);
|
2011-09-16 20:51:30 +09:30
|
|
|
if (_cairo_surface_is_recording (mask_surface)) {
|
2008-09-25 01:52:45 -07:00
|
|
|
backend_mask_status =
|
2023-01-01 15:14:08 +10:30
|
|
|
_analyze_recording_surface_pattern (surface,
|
|
|
|
|
mask,
|
|
|
|
|
&rec_extents,
|
2023-02-19 21:10:58 +10:30
|
|
|
&surface->mask_region_id,
|
|
|
|
|
CAIRO_ANALYSIS_MASK_MASK);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_mask_status))
|
2008-09-25 10:40:32 +01:00
|
|
|
return backend_mask_status;
|
2016-06-04 14:43:43 +09:30
|
|
|
|
|
|
|
|
_cairo_rectangle_intersect (&extents, &rec_extents);
|
2008-09-25 01:52:45 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-25 10:40:32 +01:00
|
|
|
backend_status =
|
|
|
|
|
_cairo_analysis_surface_merge_status (backend_source_status,
|
|
|
|
|
backend_mask_status);
|
2007-09-05 22:26:16 +09:30
|
|
|
}
|
|
|
|
|
|
2008-10-23 14:38:44 +01:00
|
|
|
if (_cairo_operator_bounded_by_mask (op)) {
|
|
|
|
|
cairo_rectangle_int_t mask_extents;
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2016-07-16 14:59:43 +09:30
|
|
|
_cairo_pattern_get_extents (mask, &mask_extents, surface->target->is_vector);
|
2011-03-18 16:57:04 +01:00
|
|
|
_cairo_rectangle_intersect (&extents, &mask_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
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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 _add_operation (surface, &extents, backend_status);
|
2006-02-27 17:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
2016-06-04 14:43:43 +09:30
|
|
|
_cairo_analysis_surface_stroke (void *abstract_surface,
|
|
|
|
|
cairo_operator_t op,
|
|
|
|
|
const cairo_pattern_t *source,
|
|
|
|
|
const cairo_path_fixed_t *path,
|
|
|
|
|
const cairo_stroke_style_t *style,
|
|
|
|
|
const cairo_matrix_t *ctm,
|
|
|
|
|
const cairo_matrix_t *ctm_inverse,
|
|
|
|
|
double tolerance,
|
|
|
|
|
cairo_antialias_t antialias,
|
|
|
|
|
const cairo_clip_t *clip)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2006-02-27 14:56:41 -08:00
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
2011-07-14 21:19:54 +01:00
|
|
|
cairo_int_status_t backend_status;
|
2008-10-23 14:34:30 +01:00
|
|
|
cairo_rectangle_int_t extents;
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
surface->source_region_id = 0;
|
|
|
|
|
surface->mask_region_id = 0;
|
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
|
|
|
if (surface->target->backend->stroke == NULL) {
|
2007-08-21 22:27:57 +09:30
|
|
|
backend_status = CAIRO_INT_STATUS_UNSUPPORTED;
|
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 {
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->stroke (surface->target, op,
|
|
|
|
|
source, path, style,
|
|
|
|
|
ctm, ctm_inverse,
|
|
|
|
|
tolerance, antialias,
|
|
|
|
|
clip);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_status))
|
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 backend_status;
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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_analysis_surface_operation_extents (surface,
|
|
|
|
|
op, source, clip,
|
|
|
|
|
&extents);
|
2016-06-04 14:43:43 +09:30
|
|
|
if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN) {
|
|
|
|
|
cairo_rectangle_int_t rec_extents;
|
2023-01-01 15:14:08 +10:30
|
|
|
backend_status = _analyze_recording_surface_pattern (surface,
|
|
|
|
|
source,
|
|
|
|
|
&rec_extents,
|
2023-02-19 21:10:58 +10:30
|
|
|
&surface->source_region_id,
|
|
|
|
|
CAIRO_ANALYSIS_SOURCE_STROKE);
|
2016-06-04 14:43:43 +09:30
|
|
|
_cairo_rectangle_intersect (&extents, &rec_extents);
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2007-08-29 20:18:09 +09:30
|
|
|
if (_cairo_operator_bounded_by_mask (op)) {
|
2008-12-18 14:52:03 +00:00
|
|
|
cairo_rectangle_int_t mask_extents;
|
2011-07-14 21:19:54 +01:00
|
|
|
cairo_int_status_t status;
|
2008-12-17 09:29:35 +00:00
|
|
|
|
2010-11-21 00:37:29 +10:30
|
|
|
status = _cairo_path_fixed_stroke_extents (path, style,
|
|
|
|
|
ctm, ctm_inverse,
|
|
|
|
|
tolerance,
|
|
|
|
|
&mask_extents);
|
|
|
|
|
if (unlikely (status))
|
|
|
|
|
return status;
|
2008-09-24 11:12:05 +01:00
|
|
|
|
2011-03-18 16:57:04 +01:00
|
|
|
_cairo_rectangle_intersect (&extents, &mask_extents);
|
2007-08-29 20:18:09 +09:30
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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 _add_operation (surface, &extents, backend_status);
|
2006-02-27 17:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
2006-02-27 14:56:41 -08:00
|
|
|
_cairo_analysis_surface_fill (void *abstract_surface,
|
|
|
|
|
cairo_operator_t op,
|
2008-10-22 19:24:44 +01:00
|
|
|
const cairo_pattern_t *source,
|
2011-07-14 21:19:54 +01:00
|
|
|
const cairo_path_fixed_t *path,
|
2008-01-05 19:34:42 +00:00
|
|
|
cairo_fill_rule_t fill_rule,
|
2006-02-27 14:56:41 -08:00
|
|
|
double tolerance,
|
2008-10-01 20:50:53 +09:30
|
|
|
cairo_antialias_t antialias,
|
2016-06-04 14:43:43 +09:30
|
|
|
const cairo_clip_t *clip)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2006-02-27 14:56:41 -08:00
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
2011-07-14 21:19:54 +01:00
|
|
|
cairo_int_status_t backend_status;
|
2008-10-23 14:34:30 +01:00
|
|
|
cairo_rectangle_int_t extents;
|
2006-02-27 17:14:57 -05: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
|
|
|
if (surface->target->backend->fill == NULL) {
|
2007-08-21 22:27:57 +09:30
|
|
|
backend_status = CAIRO_INT_STATUS_UNSUPPORTED;
|
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 {
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->fill (surface->target, op,
|
|
|
|
|
source, path, fill_rule,
|
|
|
|
|
tolerance, antialias,
|
|
|
|
|
clip);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_status))
|
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 backend_status;
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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_analysis_surface_operation_extents (surface,
|
|
|
|
|
op, source, clip,
|
|
|
|
|
&extents);
|
2016-06-04 14:43:43 +09:30
|
|
|
if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN) {
|
|
|
|
|
cairo_rectangle_int_t rec_extents;
|
2023-01-01 15:14:08 +10:30
|
|
|
backend_status = _analyze_recording_surface_pattern (surface,
|
|
|
|
|
source,
|
|
|
|
|
&rec_extents,
|
2023-02-19 21:10:58 +10:30
|
|
|
&surface->source_region_id,
|
|
|
|
|
CAIRO_ANALYSIS_SOURCE_FILL);
|
2016-06-04 14:43:43 +09:30
|
|
|
_cairo_rectangle_intersect (&extents, &rec_extents);
|
|
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2007-08-29 20:18:09 +09:30
|
|
|
if (_cairo_operator_bounded_by_mask (op)) {
|
2008-12-18 14:52:03 +00:00
|
|
|
cairo_rectangle_int_t mask_extents;
|
2007-08-21 22:27:57 +09:30
|
|
|
|
2010-11-21 00:37:29 +10:30
|
|
|
_cairo_path_fixed_fill_extents (path, fill_rule, tolerance,
|
|
|
|
|
&mask_extents);
|
|
|
|
|
|
2011-03-18 16:57:04 +01:00
|
|
|
_cairo_rectangle_intersect (&extents, &mask_extents);
|
2007-08-29 20:18:09 +09:30
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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 _add_operation (surface, &extents, backend_status);
|
2006-02-27 17:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
2006-02-27 14:56:41 -08:00
|
|
|
_cairo_analysis_surface_show_glyphs (void *abstract_surface,
|
|
|
|
|
cairo_operator_t op,
|
2008-10-22 19:24:44 +01:00
|
|
|
const cairo_pattern_t *source,
|
2007-08-31 16:53:21 +01:00
|
|
|
cairo_glyph_t *glyphs,
|
2006-02-27 14:56:41 -08:00
|
|
|
int num_glyphs,
|
2008-05-23 19:57:48 -04:00
|
|
|
cairo_scaled_font_t *scaled_font,
|
2011-07-30 17:28:21 +01:00
|
|
|
const cairo_clip_t *clip)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2006-02-27 14:56:41 -08:00
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
2011-07-14 21:19:54 +01:00
|
|
|
cairo_int_status_t status, backend_status;
|
2007-08-29 20:18:09 +09:30
|
|
|
cairo_rectangle_int_t extents, glyph_extents;
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
surface->source_region_id = 0;
|
|
|
|
|
surface->mask_region_id = 0;
|
|
|
|
|
|
2008-07-02 19:21:50 -04:00
|
|
|
/* Adapted from _cairo_surface_show_glyphs */
|
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
|
|
|
if (surface->target->backend->show_glyphs != NULL) {
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->show_glyphs (surface->target, op,
|
|
|
|
|
source,
|
|
|
|
|
glyphs, num_glyphs,
|
|
|
|
|
scaled_font,
|
2011-07-30 17:28:21 +01:00
|
|
|
clip);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_status))
|
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 backend_status;
|
|
|
|
|
}
|
|
|
|
|
else if (surface->target->backend->show_text_glyphs != NULL)
|
|
|
|
|
{
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->show_text_glyphs (surface->target, op,
|
|
|
|
|
source,
|
|
|
|
|
NULL, 0,
|
|
|
|
|
glyphs, num_glyphs,
|
|
|
|
|
NULL, 0,
|
|
|
|
|
FALSE,
|
|
|
|
|
scaled_font,
|
|
|
|
|
clip);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_status))
|
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 backend_status;
|
|
|
|
|
}
|
2008-07-02 19:21:50 -04:00
|
|
|
else
|
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
|
|
|
{
|
2008-07-02 19:21:50 -04:00
|
|
|
backend_status = CAIRO_INT_STATUS_UNSUPPORTED;
|
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
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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_analysis_surface_operation_extents (surface,
|
|
|
|
|
op, source, clip,
|
|
|
|
|
&extents);
|
2016-06-04 14:43:43 +09:30
|
|
|
if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN) {
|
|
|
|
|
cairo_rectangle_int_t rec_extents;
|
2023-01-01 15:14:08 +10:30
|
|
|
backend_status = _analyze_recording_surface_pattern (surface,
|
|
|
|
|
source,
|
|
|
|
|
&rec_extents,
|
2023-02-19 21:10:58 +10:30
|
|
|
&surface->source_region_id,
|
|
|
|
|
CAIRO_ANALYSIS_SOURCE_SHOW_GLYPHS);
|
2016-06-04 14:43:43 +09:30
|
|
|
_cairo_rectangle_intersect (&extents, &rec_extents);
|
|
|
|
|
}
|
2007-09-16 20:26:33 +09:30
|
|
|
|
2007-08-29 20:18:09 +09:30
|
|
|
if (_cairo_operator_bounded_by_mask (op)) {
|
|
|
|
|
status = _cairo_scaled_font_glyph_device_extents (scaled_font,
|
|
|
|
|
glyphs,
|
|
|
|
|
num_glyphs,
|
2009-07-28 15:58:54 +01:00
|
|
|
&glyph_extents,
|
|
|
|
|
NULL);
|
2008-11-18 15:38:37 +00:00
|
|
|
if (unlikely (status))
|
2007-08-29 20:18:09 +09:30
|
|
|
return status;
|
|
|
|
|
|
2011-03-18 16:57:04 +01:00
|
|
|
_cairo_rectangle_intersect (&extents, &glyph_extents);
|
2007-08-29 20:18:09 +09:30
|
|
|
}
|
2007-08-21 22:27:57 +09:30
|
|
|
|
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 _add_operation (surface, &extents, backend_status);
|
2006-02-27 17:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
2008-06-26 16:44:59 -04:00
|
|
|
static cairo_bool_t
|
|
|
|
|
_cairo_analysis_surface_has_show_text_glyphs (void *abstract_surface)
|
|
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
|
|
|
|
|
2008-08-18 14:52:43 -04:00
|
|
|
return cairo_surface_has_show_text_glyphs (surface->target);
|
2008-06-26 16:44:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
|
|
|
|
_cairo_analysis_surface_show_text_glyphs (void *abstract_surface,
|
|
|
|
|
cairo_operator_t op,
|
2008-10-22 19:24:44 +01:00
|
|
|
const cairo_pattern_t *source,
|
2008-06-26 16:44:59 -04:00
|
|
|
const char *utf8,
|
|
|
|
|
int utf8_len,
|
|
|
|
|
cairo_glyph_t *glyphs,
|
|
|
|
|
int num_glyphs,
|
|
|
|
|
const cairo_text_cluster_t *clusters,
|
|
|
|
|
int num_clusters,
|
2008-09-18 00:26:07 -04:00
|
|
|
cairo_text_cluster_flags_t cluster_flags,
|
2008-10-01 20:50:53 +09:30
|
|
|
cairo_scaled_font_t *scaled_font,
|
2011-07-14 21:19:54 +01:00
|
|
|
const cairo_clip_t *clip)
|
2008-06-26 16:44:59 -04:00
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
2011-07-14 21:19:54 +01:00
|
|
|
cairo_int_status_t status, backend_status;
|
2008-06-26 16:44:59 -04:00
|
|
|
cairo_rectangle_int_t extents, glyph_extents;
|
|
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
surface->source_region_id = 0;
|
|
|
|
|
surface->mask_region_id = 0;
|
|
|
|
|
|
2008-07-02 19:21:50 -04:00
|
|
|
/* Adapted from _cairo_surface_show_glyphs */
|
|
|
|
|
backend_status = CAIRO_INT_STATUS_UNSUPPORTED;
|
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
|
|
|
if (surface->target->backend->show_text_glyphs != NULL) {
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->show_text_glyphs (surface->target, op,
|
|
|
|
|
source,
|
|
|
|
|
utf8, utf8_len,
|
|
|
|
|
glyphs, num_glyphs,
|
|
|
|
|
clusters, num_clusters,
|
|
|
|
|
cluster_flags,
|
|
|
|
|
scaled_font,
|
|
|
|
|
clip);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_status))
|
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 backend_status;
|
|
|
|
|
}
|
|
|
|
|
if (backend_status == CAIRO_INT_STATUS_UNSUPPORTED &&
|
|
|
|
|
surface->target->backend->show_glyphs != NULL)
|
|
|
|
|
{
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->show_glyphs (surface->target, op,
|
|
|
|
|
source,
|
|
|
|
|
glyphs, num_glyphs,
|
|
|
|
|
scaled_font,
|
2011-07-30 17:28:21 +01:00
|
|
|
clip);
|
2011-07-14 21:19:54 +01:00
|
|
|
if (_cairo_int_status_is_error (backend_status))
|
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 backend_status;
|
2008-07-02 19:21:50 -04:00
|
|
|
}
|
2008-06-26 16:44:59 -04: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_analysis_surface_operation_extents (surface,
|
|
|
|
|
op, source, clip,
|
|
|
|
|
&extents);
|
2016-06-04 14:43:43 +09:30
|
|
|
if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN) {
|
|
|
|
|
cairo_rectangle_int_t rec_extents;
|
2023-01-01 15:14:08 +10:30
|
|
|
_analyze_recording_surface_pattern (surface,
|
|
|
|
|
source,
|
|
|
|
|
&rec_extents,
|
2023-02-19 21:10:58 +10:30
|
|
|
&surface->source_region_id,
|
|
|
|
|
CAIRO_ANALYSIS_SOURCE_SHOW_GLYPHS);
|
2016-06-04 14:43:43 +09:30
|
|
|
_cairo_rectangle_intersect (&extents, &rec_extents);
|
|
|
|
|
}
|
2008-06-26 16:44:59 -04:00
|
|
|
|
|
|
|
|
if (_cairo_operator_bounded_by_mask (op)) {
|
|
|
|
|
status = _cairo_scaled_font_glyph_device_extents (scaled_font,
|
|
|
|
|
glyphs,
|
|
|
|
|
num_glyphs,
|
2009-07-28 15:58:54 +01:00
|
|
|
&glyph_extents,
|
|
|
|
|
NULL);
|
2008-11-18 15:38:37 +00:00
|
|
|
if (unlikely (status))
|
2008-06-26 16:44:59 -04:00
|
|
|
return status;
|
|
|
|
|
|
2011-03-18 16:57:04 +01:00
|
|
|
_cairo_rectangle_intersect (&extents, &glyph_extents);
|
2008-06-26 16:44:59 -04: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
|
|
|
return _add_operation (surface, &extents, backend_status);
|
2008-06-26 16:44:59 -04:00
|
|
|
}
|
|
|
|
|
|
2016-10-01 17:30:13 +09:30
|
|
|
static cairo_int_status_t
|
|
|
|
|
_cairo_analysis_surface_tag (void *abstract_surface,
|
|
|
|
|
cairo_bool_t begin,
|
|
|
|
|
const char *tag_name,
|
2021-07-16 09:42:56 +09:30
|
|
|
const char *attributes)
|
2016-10-01 17:30:13 +09:30
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
|
|
|
|
cairo_int_status_t backend_status;
|
|
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
surface->source_region_id = 0;
|
|
|
|
|
surface->mask_region_id = 0;
|
2016-10-01 17:30:13 +09:30
|
|
|
backend_status = CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
if (surface->target->backend->tag != NULL) {
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->tag (surface->target,
|
|
|
|
|
begin,
|
|
|
|
|
tag_name,
|
2021-07-16 09:42:56 +09:30
|
|
|
attributes);
|
2019-02-01 19:46:00 +10:30
|
|
|
if (backend_status == CAIRO_INT_STATUS_SUCCESS)
|
|
|
|
|
surface->has_supported = TRUE;
|
2016-10-01 17:30:13 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return backend_status;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-22 15:55:06 +10:30
|
|
|
static cairo_bool_t
|
|
|
|
|
_cairo_analysis_surface_supports_color_glyph (void *abstract_surface,
|
|
|
|
|
cairo_scaled_font_t *scaled_font,
|
|
|
|
|
unsigned long glyph_index)
|
|
|
|
|
{
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-19 21:10:58 +10:30
|
|
|
static cairo_int_status_t
|
|
|
|
|
_cairo_analysis_surface_command_id (void *abstract_surface,
|
|
|
|
|
unsigned int recording_id,
|
|
|
|
|
unsigned int command_id)
|
|
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = abstract_surface;
|
|
|
|
|
cairo_int_status_t backend_status;
|
|
|
|
|
|
|
|
|
|
backend_status = CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
if (surface->target->backend->command_id != NULL) {
|
|
|
|
|
backend_status =
|
|
|
|
|
surface->target->backend->command_id (surface->target,
|
|
|
|
|
recording_id,
|
|
|
|
|
command_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return backend_status;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 14:56:41 -08:00
|
|
|
static const cairo_surface_backend_t cairo_analysis_surface_backend = {
|
2006-04-04 14:58:52 -07:00
|
|
|
CAIRO_INTERNAL_SURFACE_TYPE_ANALYSIS,
|
2011-07-22 00:36:03 +01:00
|
|
|
|
|
|
|
|
_cairo_analysis_surface_finish,
|
2010-04-23 19:45:26 +01:00
|
|
|
NULL,
|
|
|
|
|
|
2006-02-27 17:14:57 -05:00
|
|
|
NULL, /* create_similar */
|
2011-07-22 00:36:03 +01:00
|
|
|
NULL, /* create_similar_image */
|
|
|
|
|
NULL, /* map_to_image */
|
|
|
|
|
NULL, /* unmap */
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2012-02-09 13:01:17 +00:00
|
|
|
NULL, /* source */
|
2006-02-27 17:14:57 -05:00
|
|
|
NULL, /* acquire_source_image */
|
|
|
|
|
NULL, /* release_source_image */
|
2011-07-30 17:28:21 +01:00
|
|
|
NULL, /* snapshot */
|
|
|
|
|
|
2006-02-27 17:14:57 -05:00
|
|
|
NULL, /* copy_page */
|
|
|
|
|
NULL, /* show_page */
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2006-02-28 12:07:14 -08:00
|
|
|
_cairo_analysis_surface_get_extents,
|
2006-02-27 17:14:57 -05:00
|
|
|
NULL, /* get_font_options */
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2006-02-27 17:14:57 -05:00
|
|
|
NULL, /* flush */
|
|
|
|
|
NULL, /* mark_dirty_rectangle */
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2006-02-27 14:56:41 -08:00
|
|
|
_cairo_analysis_surface_paint,
|
|
|
|
|
_cairo_analysis_surface_mask,
|
|
|
|
|
_cairo_analysis_surface_stroke,
|
|
|
|
|
_cairo_analysis_surface_fill,
|
2008-01-22 15:32:11 -08:00
|
|
|
NULL, /* fill_stroke */
|
2011-07-30 17:28:21 +01:00
|
|
|
_cairo_analysis_surface_show_glyphs,
|
2008-06-26 16:44:59 -04:00
|
|
|
_cairo_analysis_surface_has_show_text_glyphs,
|
2016-10-01 17:30:13 +09:30
|
|
|
_cairo_analysis_surface_show_text_glyphs,
|
|
|
|
|
NULL, /* get_supported_mime_types */
|
2023-01-22 15:55:06 +10:30
|
|
|
_cairo_analysis_surface_tag,
|
2023-02-19 21:10:58 +10:30
|
|
|
_cairo_analysis_surface_supports_color_glyph,
|
|
|
|
|
NULL, /* analyze_recording_surface */
|
|
|
|
|
_cairo_analysis_surface_command_id,
|
2006-02-27 17:14:57 -05:00
|
|
|
};
|
|
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_surface_t *
|
2023-01-01 15:14:08 +10:30
|
|
|
_cairo_analysis_surface_create (cairo_surface_t *target,
|
|
|
|
|
cairo_bool_t create_region_ids)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2006-02-27 14:56:41 -08:00
|
|
|
cairo_analysis_surface_t *surface;
|
2008-10-18 00:36:34 +01:00
|
|
|
cairo_status_t status;
|
|
|
|
|
|
|
|
|
|
status = target->status;
|
2008-11-18 15:38:37 +00:00
|
|
|
if (unlikely (status))
|
2008-10-18 00:36:34 +01:00
|
|
|
return _cairo_surface_create_in_error (status);
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2024-06-21 10:03:52 +09:30
|
|
|
surface = _cairo_calloc (sizeof (cairo_analysis_surface_t));
|
2008-11-18 17:26:55 +00:00
|
|
|
if (unlikely (surface == NULL))
|
2008-01-17 10:10:55 +00:00
|
|
|
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2006-05-24 17:05:51 -07:00
|
|
|
/* I believe the content type here is truly arbitrary. I'm quite
|
|
|
|
|
* sure nothing will ever use this value. */
|
2010-01-18 21:53:42 +00:00
|
|
|
_cairo_surface_init (&surface->base,
|
|
|
|
|
&cairo_analysis_surface_backend,
|
|
|
|
|
NULL, /* device */
|
2015-09-21 21:35:05 +09:30
|
|
|
CAIRO_CONTENT_COLOR_ALPHA,
|
|
|
|
|
target->is_vector);
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2007-12-29 00:26:11 +10:30
|
|
|
cairo_matrix_init_identity (&surface->ctm);
|
|
|
|
|
surface->has_ctm = FALSE;
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2008-05-09 13:23:02 +02:00
|
|
|
surface->target = cairo_surface_reference (target);
|
2007-09-23 17:43:44 +09:30
|
|
|
surface->first_op = TRUE;
|
2007-08-21 22:27:57 +09:30
|
|
|
surface->has_supported = FALSE;
|
|
|
|
|
surface->has_unsupported = FALSE;
|
2008-05-09 14:34:22 +02:00
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
surface->create_region_ids = create_region_ids;
|
|
|
|
|
surface->source_region_id = 0;
|
|
|
|
|
surface->mask_region_id = 0;
|
|
|
|
|
|
2009-04-10 14:50:26 +01:00
|
|
|
_cairo_region_init (&surface->supported_region);
|
|
|
|
|
_cairo_region_init (&surface->fallback_region);
|
|
|
|
|
|
2008-05-09 14:34:22 +02:00
|
|
|
surface->page_bbox.p1.x = 0;
|
|
|
|
|
surface->page_bbox.p1.y = 0;
|
|
|
|
|
surface->page_bbox.p2.x = 0;
|
|
|
|
|
surface->page_bbox.p2.y = 0;
|
|
|
|
|
|
2006-02-27 17:14:57 -05:00
|
|
|
return &surface->base;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-18 00:36:34 +01:00
|
|
|
void
|
2008-05-09 11:27:55 +02:00
|
|
|
_cairo_analysis_surface_set_ctm (cairo_surface_t *abstract_surface,
|
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
|
|
|
const cairo_matrix_t *ctm)
|
2008-05-09 11:27:55 +02:00
|
|
|
{
|
2008-10-18 00:36:34 +01:00
|
|
|
cairo_analysis_surface_t *surface;
|
|
|
|
|
|
|
|
|
|
if (abstract_surface->status)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
surface = (cairo_analysis_surface_t *) abstract_surface;
|
2008-05-09 11:27:55 +02:00
|
|
|
|
|
|
|
|
surface->ctm = *ctm;
|
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
|
|
|
surface->has_ctm = ! _cairo_matrix_is_identity (&surface->ctm);
|
2008-05-09 11:27:55 +02:00
|
|
|
}
|
|
|
|
|
|
2008-10-18 00:36:34 +01:00
|
|
|
void
|
2008-05-09 11:27:55 +02:00
|
|
|
_cairo_analysis_surface_get_ctm (cairo_surface_t *abstract_surface,
|
|
|
|
|
cairo_matrix_t *ctm)
|
|
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
|
|
|
|
|
|
|
|
|
*ctm = surface->ctm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_region_t *
|
2006-02-27 14:58:51 -08:00
|
|
|
_cairo_analysis_surface_get_supported (cairo_surface_t *abstract_surface)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
|
|
|
|
|
2009-04-10 14:50:26 +01:00
|
|
|
return &surface->supported_region;
|
2006-02-27 17:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_region_t *
|
2006-02-27 14:58:51 -08:00
|
|
|
_cairo_analysis_surface_get_unsupported (cairo_surface_t *abstract_surface)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
|
|
|
|
|
2009-04-10 14:50:26 +01:00
|
|
|
return &surface->fallback_region;
|
2007-08-21 22:27:57 +09:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cairo_bool_t
|
|
|
|
|
_cairo_analysis_surface_has_supported (cairo_surface_t *abstract_surface)
|
|
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
|
|
|
|
|
|
|
|
|
return surface->has_supported;
|
2006-02-27 17:14:57 -05:00
|
|
|
}
|
|
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
cairo_bool_t
|
2006-02-27 14:56:41 -08:00
|
|
|
_cairo_analysis_surface_has_unsupported (cairo_surface_t *abstract_surface)
|
2006-02-27 17:14:57 -05:00
|
|
|
{
|
2006-02-27 14:56:41 -08:00
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
2006-02-27 17:14:57 -05:00
|
|
|
|
2007-08-21 22:27:57 +09:30
|
|
|
return surface->has_unsupported;
|
2006-02-27 17:14:57 -05:00
|
|
|
}
|
2007-09-23 17:43:44 +09:30
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_cairo_analysis_surface_get_bounding_box (cairo_surface_t *abstract_surface,
|
|
|
|
|
cairo_box_t *bbox)
|
|
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
|
|
|
|
|
|
|
|
|
*bbox = surface->page_bbox;
|
|
|
|
|
}
|
2008-05-09 15:29:10 +02:00
|
|
|
|
2023-01-01 15:14:08 +10:30
|
|
|
unsigned int
|
|
|
|
|
_cairo_analysis_surface_get_source_region_id (cairo_surface_t *abstract_surface)
|
|
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
|
|
|
|
|
|
|
|
|
return surface->source_region_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
|
_cairo_analysis_surface_get_mask_region_id (cairo_surface_t *abstract_surface)
|
|
|
|
|
{
|
|
|
|
|
cairo_analysis_surface_t *surface = (cairo_analysis_surface_t *) abstract_surface;
|
|
|
|
|
|
|
|
|
|
return surface->mask_region_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-05-09 15:29:10 +02:00
|
|
|
/* null surface type: a surface that does nothing (has no side effects, yay!) */
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
2020-08-31 22:14:59 -06:00
|
|
|
_paint_return_success (void *surface,
|
|
|
|
|
cairo_operator_t op,
|
|
|
|
|
const cairo_pattern_t *source,
|
|
|
|
|
const cairo_clip_t *clip)
|
2008-05-09 15:29:10 +02:00
|
|
|
{
|
2022-06-13 21:56:02 +09:30
|
|
|
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
|
|
|
|
|
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) source;
|
|
|
|
|
if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
|
|
|
|
|
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-31 22:14:59 -06:00
|
|
|
return CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
|
|
|
|
_mask_return_success (void *surface,
|
|
|
|
|
cairo_operator_t op,
|
|
|
|
|
const cairo_pattern_t *source,
|
|
|
|
|
const cairo_pattern_t *mask,
|
|
|
|
|
const cairo_clip_t *clip)
|
|
|
|
|
{
|
2022-06-13 21:56:02 +09:30
|
|
|
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
|
|
|
|
|
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) source;
|
|
|
|
|
if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
|
|
|
|
|
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mask->type == CAIRO_PATTERN_TYPE_SURFACE) {
|
|
|
|
|
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) mask;
|
|
|
|
|
if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
|
|
|
|
|
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-31 22:14:59 -06:00
|
|
|
return CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
|
|
|
|
_stroke_return_success (void *surface,
|
|
|
|
|
cairo_operator_t op,
|
|
|
|
|
const cairo_pattern_t *source,
|
|
|
|
|
const cairo_path_fixed_t *path,
|
|
|
|
|
const cairo_stroke_style_t *style,
|
|
|
|
|
const cairo_matrix_t *ctm,
|
|
|
|
|
const cairo_matrix_t *ctm_inverse,
|
|
|
|
|
double tolerance,
|
|
|
|
|
cairo_antialias_t antialias,
|
|
|
|
|
const cairo_clip_t *clip)
|
|
|
|
|
{
|
2022-06-13 21:56:02 +09:30
|
|
|
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
|
|
|
|
|
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) source;
|
|
|
|
|
if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
|
|
|
|
|
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-31 22:14:59 -06:00
|
|
|
return CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static cairo_int_status_t
|
|
|
|
|
_fill_return_success (void *surface,
|
|
|
|
|
cairo_operator_t op,
|
|
|
|
|
const cairo_pattern_t *source,
|
|
|
|
|
const cairo_path_fixed_t *path,
|
|
|
|
|
cairo_fill_rule_t fill_rule,
|
|
|
|
|
double tolerance,
|
|
|
|
|
cairo_antialias_t antialias,
|
|
|
|
|
const cairo_clip_t *clip)
|
|
|
|
|
{
|
2022-06-13 21:56:02 +09:30
|
|
|
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
|
|
|
|
|
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) source;
|
|
|
|
|
if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
|
|
|
|
|
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-31 22:14:59 -06:00
|
|
|
return CAIRO_INT_STATUS_SUCCESS;
|
2008-05-09 15:29:10 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-31 22:14:59 -06:00
|
|
|
static cairo_int_status_t
|
|
|
|
|
_show_glyphs_return_success (void *surface,
|
|
|
|
|
cairo_operator_t op,
|
|
|
|
|
const cairo_pattern_t *source,
|
|
|
|
|
cairo_glyph_t *glyphs,
|
|
|
|
|
int num_glyphs,
|
|
|
|
|
cairo_scaled_font_t *scaled_font,
|
|
|
|
|
const cairo_clip_t *clip)
|
|
|
|
|
{
|
2022-06-13 21:56:02 +09:30
|
|
|
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
|
|
|
|
|
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) source;
|
|
|
|
|
if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
|
|
|
|
|
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-31 22:14:59 -06:00
|
|
|
return CAIRO_INT_STATUS_SUCCESS;
|
|
|
|
|
}
|
2008-05-10 08:11:54 +01:00
|
|
|
|
2008-05-09 15:29:10 +02:00
|
|
|
static const cairo_surface_backend_t cairo_null_surface_backend = {
|
|
|
|
|
CAIRO_INTERNAL_SURFACE_TYPE_NULL,
|
2011-07-22 00:36:03 +01:00
|
|
|
NULL, /* finish */
|
|
|
|
|
|
2011-07-30 17:28:21 +01:00
|
|
|
NULL, /* only accessed through the surface functions */
|
2008-05-09 15:29:10 +02:00
|
|
|
|
2009-06-18 15:31:27 +01:00
|
|
|
NULL, /* create_similar */
|
2011-07-22 00:36:03 +01:00
|
|
|
NULL, /* create similar image */
|
|
|
|
|
NULL, /* map to image */
|
|
|
|
|
NULL, /* unmap image*/
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2012-02-09 13:01:17 +00:00
|
|
|
NULL, /* source */
|
2008-05-09 15:29:10 +02:00
|
|
|
NULL, /* acquire_source_image */
|
|
|
|
|
NULL, /* release_source_image */
|
2011-07-30 17:28:21 +01:00
|
|
|
NULL, /* snapshot */
|
|
|
|
|
|
2008-05-09 15:29:10 +02:00
|
|
|
NULL, /* copy_page */
|
|
|
|
|
NULL, /* show_page */
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2009-06-18 15:31:27 +01:00
|
|
|
NULL, /* get_extents */
|
2008-05-09 15:29:10 +02:00
|
|
|
NULL, /* get_font_options */
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2008-05-09 15:29:10 +02:00
|
|
|
NULL, /* flush */
|
|
|
|
|
NULL, /* mark_dirty_rectangle */
|
2011-07-30 17:28:21 +01:00
|
|
|
|
2020-08-31 22:14:59 -06:00
|
|
|
_paint_return_success, /* paint */
|
|
|
|
|
_mask_return_success, /* mask */
|
|
|
|
|
_stroke_return_success, /* stroke */
|
|
|
|
|
_fill_return_success, /* fill */
|
2008-06-26 16:44:59 -04:00
|
|
|
NULL, /* fill_stroke */
|
2020-08-31 22:14:59 -06:00
|
|
|
_show_glyphs_return_success, /* show_glyphs */
|
2009-06-18 15:31:27 +01:00
|
|
|
NULL, /* has_show_text_glyphs */
|
2023-02-19 21:10:58 +10:30
|
|
|
NULL, /* show_text_glyphs */
|
|
|
|
|
NULL, /* get_supported_mime_types */
|
|
|
|
|
NULL, /* tag */
|
|
|
|
|
NULL, /* supports_color_glyph */
|
|
|
|
|
NULL, /* analyze_recording_surface */
|
|
|
|
|
NULL, /* command_id*/
|
2008-05-09 15:29:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
cairo_surface_t *
|
|
|
|
|
_cairo_null_surface_create (cairo_content_t content)
|
|
|
|
|
{
|
|
|
|
|
cairo_surface_t *surface;
|
|
|
|
|
|
2024-06-21 10:03:52 +09:30
|
|
|
surface = _cairo_calloc (sizeof (cairo_surface_t));
|
2008-11-18 17:26:55 +00:00
|
|
|
if (unlikely (surface == NULL)) {
|
2008-05-09 15:29:10 +02:00
|
|
|
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-18 21:53:42 +00:00
|
|
|
_cairo_surface_init (surface,
|
|
|
|
|
&cairo_null_surface_backend,
|
|
|
|
|
NULL, /* device */
|
2015-09-21 21:35:05 +09:30
|
|
|
content,
|
|
|
|
|
TRUE); /* is_vector */
|
2008-05-09 15:29:10 +02:00
|
|
|
|
|
|
|
|
return surface;
|
|
|
|
|
}
|