1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2009 Intel Corporation
5 * This library is free software; you can redistribute it and/or
6 * modify it either under the terms of the GNU Lesser General Public
7 * License version 2.1 as published by the Free Software Foundation
8 * (the "LGPL") or, at your option, under the terms of the Mozilla
9 * Public License Version 1.1 (the "MPL"). If you do not alter this
10 * notice, a recipient may use your version of this file under either
11 * the MPL or the LGPL.
13 * You should have received a copy of the LGPL along with this library
14 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
16 * You should have received a copy of the MPL along with this library
17 * in the file COPYING-MPL-1.1
19 * The contents of this file are subject to the Mozilla Public License
20 * Version 1.1 (the "License"); you may not use this file except in
21 * compliance with the License. You may obtain a copy of the License at
22 * http://www.mozilla.org/MPL/
24 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
26 * the specific language governing rights and limitations.
28 * The Original Code is the cairo graphics library.
30 * The Initial Developer of the Original Code is University of Southern
34 * Chris Wilson <chris@chris-wilson.co.u>
37 #ifndef CAIRO_COMPOSITE_RECTANGLES_PRIVATE_H
38 #define CAIRO_COMPOSITE_RECTANGLES_PRIVATE_H
40 #include "cairo-types-private.h"
41 #include "cairo-error-private.h"
42 #include "cairo-pattern-private.h"
46 /* Rectangles that take part in a composite operation.
48 * The source and mask track the extents of the respective patterns in device
49 * space. The unbounded rectangle is essentially the clip rectangle. And the
50 * intersection of all is the bounded rectangle, which is the minimum extents
51 * the operation may require. Whether or not the operation is actually bounded
52 * is tracked in the is_bounded boolean.
55 struct _cairo_composite_rectangles
{
56 cairo_surface_t
*surface
;
59 cairo_rectangle_int_t source
;
60 cairo_rectangle_int_t mask
;
61 cairo_rectangle_int_t destination
;
63 cairo_rectangle_int_t bounded
; /* source? IN mask? IN unbounded */
64 cairo_rectangle_int_t unbounded
; /* destination IN clip */
67 cairo_rectangle_int_t source_sample_area
;
68 cairo_rectangle_int_t mask_sample_area
;
70 cairo_pattern_union_t source_pattern
;
71 cairo_pattern_union_t mask_pattern
;
72 const cairo_pattern_t
*original_source_pattern
;
73 const cairo_pattern_t
*original_mask_pattern
;
75 cairo_clip_t
*clip
; /* clip will be reduced to the minimal container */
78 cairo_private cairo_int_status_t
79 _cairo_composite_rectangles_init_for_paint (cairo_composite_rectangles_t
*extents
,
80 cairo_surface_t
*surface
,
82 const cairo_pattern_t
*source
,
83 const cairo_clip_t
*clip
);
85 cairo_private cairo_int_status_t
86 _cairo_composite_rectangles_init_for_mask (cairo_composite_rectangles_t
*extents
,
87 cairo_surface_t
*surface
,
89 const cairo_pattern_t
*source
,
90 const cairo_pattern_t
*mask
,
91 const cairo_clip_t
*clip
);
93 cairo_private cairo_int_status_t
94 _cairo_composite_rectangles_init_for_stroke (cairo_composite_rectangles_t
*extents
,
95 cairo_surface_t
*surface
,
97 const cairo_pattern_t
*source
,
98 const cairo_path_fixed_t
*path
,
99 const cairo_stroke_style_t
*style
,
100 const cairo_matrix_t
*ctm
,
101 const cairo_clip_t
*clip
);
103 cairo_private cairo_int_status_t
104 _cairo_composite_rectangles_init_for_fill (cairo_composite_rectangles_t
*extents
,
105 cairo_surface_t
*surface
,
107 const cairo_pattern_t
*source
,
108 const cairo_path_fixed_t
*path
,
109 const cairo_clip_t
*clip
);
111 cairo_private cairo_int_status_t
112 _cairo_composite_rectangles_init_for_boxes (cairo_composite_rectangles_t
*extents
,
113 cairo_surface_t
*surface
,
115 const cairo_pattern_t
*source
,
116 const cairo_boxes_t
*boxes
,
117 const cairo_clip_t
*clip
);
119 cairo_private cairo_int_status_t
120 _cairo_composite_rectangles_init_for_polygon (cairo_composite_rectangles_t
*extents
,
121 cairo_surface_t
*surface
,
123 const cairo_pattern_t
*source
,
124 const cairo_polygon_t
*polygon
,
125 const cairo_clip_t
*clip
);
127 cairo_private cairo_int_status_t
128 _cairo_composite_rectangles_init_for_glyphs (cairo_composite_rectangles_t
*extents
,
129 cairo_surface_t
*surface
,
131 const cairo_pattern_t
*source
,
132 cairo_scaled_font_t
*scaled_font
,
133 cairo_glyph_t
*glyphs
,
135 const cairo_clip_t
*clip
,
136 cairo_bool_t
*overlap
);
138 cairo_private cairo_int_status_t
139 _cairo_composite_rectangles_intersect_source_extents (cairo_composite_rectangles_t
*extents
,
140 const cairo_box_t
*box
);
142 cairo_private cairo_int_status_t
143 _cairo_composite_rectangles_intersect_mask_extents (cairo_composite_rectangles_t
*extents
,
144 const cairo_box_t
*box
);
146 cairo_private cairo_bool_t
147 _cairo_composite_rectangles_can_reduce_clip (cairo_composite_rectangles_t
*composite
,
150 cairo_private cairo_int_status_t
151 _cairo_composite_rectangles_add_to_damage (cairo_composite_rectangles_t
*composite
,
152 cairo_boxes_t
*damage
);
155 _cairo_composite_rectangles_fini (cairo_composite_rectangles_t
*extents
);
159 #endif /* CAIRO_COMPOSITE_RECTANGLES_PRIVATE_H */