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_lazy_init_for_paint (cairo_composite_rectangles_t *extents,
87 cairo_surface_t *surface,
89 const cairo_pattern_t *source,
90 const cairo_clip_t *clip);
92 cairo_private cairo_int_status_t
93 _cairo_composite_rectangles_init_for_mask (cairo_composite_rectangles_t *extents,
94 cairo_surface_t *surface,
96 const cairo_pattern_t *source,
97 const cairo_pattern_t *mask,
98 const cairo_clip_t *clip);
100 cairo_private cairo_int_status_t
101 _cairo_composite_rectangles_lazy_init_for_mask (cairo_composite_rectangles_t *extents,
102 cairo_surface_t *surface,
104 const cairo_pattern_t *source,
105 const cairo_pattern_t *mask,
106 const cairo_clip_t *clip);
108 cairo_private cairo_int_status_t
109 _cairo_composite_rectangles_init_for_stroke (cairo_composite_rectangles_t *extents,
110 cairo_surface_t *surface,
112 const cairo_pattern_t *source,
113 const cairo_path_fixed_t *path,
114 const cairo_stroke_style_t *style,
115 const cairo_matrix_t *ctm,
116 const cairo_clip_t *clip);
118 cairo_private cairo_int_status_t
119 _cairo_composite_rectangles_lazy_init_for_stroke (cairo_composite_rectangles_t *extents,
120 cairo_surface_t *surface,
122 const cairo_pattern_t *source,
123 const cairo_path_fixed_t *path,
124 const cairo_stroke_style_t *style,
125 const cairo_matrix_t *ctm,
126 const cairo_clip_t *clip);
128 cairo_private cairo_int_status_t
129 _cairo_composite_rectangles_init_for_fill (cairo_composite_rectangles_t *extents,
130 cairo_surface_t *surface,
132 const cairo_pattern_t *source,
133 const cairo_path_fixed_t *path,
134 const cairo_clip_t *clip);
136 cairo_private cairo_int_status_t
137 _cairo_composite_rectangles_lazy_init_for_fill (cairo_composite_rectangles_t *extents,
138 cairo_surface_t *surface,
140 const cairo_pattern_t *source,
141 const cairo_path_fixed_t *path,
142 const cairo_clip_t *clip);
144 cairo_private cairo_int_status_t
145 _cairo_composite_rectangles_init_for_boxes (cairo_composite_rectangles_t *extents,
146 cairo_surface_t *surface,
148 const cairo_pattern_t *source,
149 const cairo_boxes_t *boxes,
150 const cairo_clip_t *clip);
152 cairo_private cairo_int_status_t
153 _cairo_composite_rectangles_init_for_polygon (cairo_composite_rectangles_t *extents,
154 cairo_surface_t *surface,
156 const cairo_pattern_t *source,
157 const cairo_polygon_t *polygon,
158 const cairo_clip_t *clip);
160 cairo_private cairo_int_status_t
161 _cairo_composite_rectangles_init_for_glyphs (cairo_composite_rectangles_t *extents,
162 cairo_surface_t *surface,
164 const cairo_pattern_t *source,
165 cairo_scaled_font_t *scaled_font,
166 cairo_glyph_t *glyphs,
168 const cairo_clip_t *clip,
169 cairo_bool_t *overlap);
171 cairo_private cairo_int_status_t
172 _cairo_composite_rectangles_lazy_init_for_glyphs (cairo_composite_rectangles_t *extents,
173 cairo_surface_t *surface,
175 const cairo_pattern_t *source,
176 cairo_scaled_font_t *scaled_font,
177 cairo_glyph_t *glyphs,
179 const cairo_clip_t *clip,
180 cairo_bool_t *overlap);
182 cairo_private cairo_int_status_t
183 _cairo_composite_rectangles_intersect_source_extents (cairo_composite_rectangles_t *extents,
184 const cairo_box_t *box);
186 cairo_private cairo_int_status_t
187 _cairo_composite_rectangles_intersect_mask_extents (cairo_composite_rectangles_t *extents,
188 const cairo_box_t *box);
190 cairo_private cairo_bool_t
191 _cairo_composite_rectangles_can_reduce_clip (cairo_composite_rectangles_t *composite,
194 cairo_private cairo_int_status_t
195 _cairo_composite_rectangles_add_to_damage (cairo_composite_rectangles_t *composite,
196 cairo_boxes_t *damage);
199 _cairo_composite_rectangles_fini (cairo_composite_rectangles_t *extents);
203 #endif /* CAIRO_COMPOSITE_RECTANGLES_PRIVATE_H */