Upload Tizen2.0 source
[framework/graphics/cairo.git] / src / cairo-composite-rectangles-private.h
1 /* cairo - a vector graphics library with display and print output
2  *
3  * Copyright © 2009 Intel Corporation
4  *
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.
12  *
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
18  *
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/
23  *
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.
27  *
28  * The Original Code is the cairo graphics library.
29  *
30  * The Initial Developer of the Original Code is University of Southern
31  * California.
32  *
33  * Contributor(s):
34  *      Chris Wilson <chris@chris-wilson.co.u>
35  */
36
37 #ifndef CAIRO_COMPOSITE_RECTANGLES_PRIVATE_H
38 #define CAIRO_COMPOSITE_RECTANGLES_PRIVATE_H
39
40 #include "cairo-types-private.h"
41 #include "cairo-error-private.h"
42 #include "cairo-pattern-private.h"
43
44 CAIRO_BEGIN_DECLS
45
46 /* Rectangles that take part in a composite operation.
47  *
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.
53  *
54  */
55 struct _cairo_composite_rectangles {
56     cairo_surface_t *surface;
57     cairo_operator_t op;
58
59     cairo_rectangle_int_t source;
60     cairo_rectangle_int_t mask;
61     cairo_rectangle_int_t destination;
62
63     cairo_rectangle_int_t bounded; /* source? IN mask? IN unbounded */
64     cairo_rectangle_int_t unbounded; /* destination IN clip */
65     uint32_t is_bounded;
66
67     cairo_rectangle_int_t source_sample_area;
68     cairo_rectangle_int_t mask_sample_area;
69
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;
74
75     cairo_clip_t *clip; /* clip will be reduced to the minimal container */
76 };
77
78 cairo_private cairo_int_status_t
79 _cairo_composite_rectangles_init_for_paint (cairo_composite_rectangles_t *extents,
80                                             cairo_surface_t *surface,
81                                             cairo_operator_t     op,
82                                             const cairo_pattern_t       *source,
83                                             const cairo_clip_t          *clip);
84
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,
88                                                  cairo_operator_t op,
89                                                  const cairo_pattern_t *source,
90                                                  const cairo_clip_t *clip);
91
92 cairo_private cairo_int_status_t
93 _cairo_composite_rectangles_init_for_mask (cairo_composite_rectangles_t *extents,
94                                            cairo_surface_t *surface,
95                                            cairo_operator_t      op,
96                                            const cairo_pattern_t        *source,
97                                            const cairo_pattern_t        *mask,
98                                            const cairo_clip_t           *clip);
99
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,
103                                                 cairo_operator_t op,
104                                                 const cairo_pattern_t *source,
105                                                 const cairo_pattern_t *mask,
106                                                 const cairo_clip_t *clip);
107
108 cairo_private cairo_int_status_t
109 _cairo_composite_rectangles_init_for_stroke (cairo_composite_rectangles_t *extents,
110                                              cairo_surface_t *surface,
111                                              cairo_operator_t    op,
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);
117
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,
121                                                   cairo_operator_t       op,
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);
127
128 cairo_private cairo_int_status_t
129 _cairo_composite_rectangles_init_for_fill (cairo_composite_rectangles_t *extents,
130                                            cairo_surface_t *surface,
131                                            cairo_operator_t      op,
132                                            const cairo_pattern_t        *source,
133                                            const cairo_path_fixed_t     *path,
134                                            const cairo_clip_t           *clip);
135
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,
139                                                 cairo_operator_t op,
140                                                 const cairo_pattern_t *source,
141                                                 const cairo_path_fixed_t *path,
142                                                 const cairo_clip_t *clip);
143
144 cairo_private cairo_int_status_t
145 _cairo_composite_rectangles_init_for_boxes (cairo_composite_rectangles_t *extents,
146                                               cairo_surface_t           *surface,
147                                               cairo_operator_t           op,
148                                               const cairo_pattern_t     *source,
149                                               const cairo_boxes_t       *boxes,
150                                               const cairo_clip_t                *clip);
151
152 cairo_private cairo_int_status_t
153 _cairo_composite_rectangles_init_for_polygon (cairo_composite_rectangles_t *extents,
154                                               cairo_surface_t           *surface,
155                                               cairo_operator_t           op,
156                                               const cairo_pattern_t     *source,
157                                               const cairo_polygon_t     *polygon,
158                                               const cairo_clip_t                *clip);
159
160 cairo_private cairo_int_status_t
161 _cairo_composite_rectangles_init_for_glyphs (cairo_composite_rectangles_t *extents,
162                                              cairo_surface_t *surface,
163                                              cairo_operator_t            op,
164                                              const cairo_pattern_t      *source,
165                                              cairo_scaled_font_t        *scaled_font,
166                                              cairo_glyph_t              *glyphs,
167                                              int                         num_glyphs,
168                                              const cairo_clip_t         *clip,
169                                              cairo_bool_t               *overlap);
170
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,
174                                                   cairo_operator_t op,
175                                                   const cairo_pattern_t *source,
176                                                   cairo_scaled_font_t *scaled_font,
177                                                   cairo_glyph_t *glyphs,
178                                                   int num_glyphs,
179                                                   const cairo_clip_t *clip,
180                                                   cairo_bool_t *overlap);
181
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);
185
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);
189
190 cairo_private cairo_bool_t
191 _cairo_composite_rectangles_can_reduce_clip (cairo_composite_rectangles_t *composite,
192                                              cairo_clip_t *clip);
193
194 cairo_private cairo_int_status_t
195 _cairo_composite_rectangles_add_to_damage (cairo_composite_rectangles_t *composite,
196                                            cairo_boxes_t *damage);
197
198 cairo_private void
199 _cairo_composite_rectangles_fini (cairo_composite_rectangles_t *extents);
200
201 CAIRO_END_DECLS
202
203 #endif /* CAIRO_COMPOSITE_RECTANGLES_PRIVATE_H */