tizen 2.3.1 release
[framework/graphics/cairo.git] / src / cairo-tg-journal-private.h
1 /*
2  * Copyright © 2012 SCore Corporation
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it either under the terms of the GNU Lesser General Public
6  * License version 2.1 as published by the Free Software Foundation
7  * (the "LGPL") or, at your option, under the terms of the Mozilla
8  * Public License Version 1.1 (the "MPL"). If you do not alter this
9  * notice, a recipient may use your version of this file under either
10  * the MPL or the LGPL.
11  *
12  * You should have received a copy of the LGPL along with this library
13  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
15  * You should have received a copy of the MPL along with this library
16  * in the file COPYING-MPL-1.1
17  *
18  * The contents of this file are subject to the Mozilla Public License
19  * Version 1.1 (the "License"); you may not use this file except in
20  * compliance with the License. You may obtain a copy of the License at
21  * http://www.mozilla.org/MPL/
22  *
23  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
24  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
25  * the specific language governing rights and limitations.
26  *
27  * Author: Taekyun Kim (podain77@gmail.com)
28  */
29
30 #ifndef CAIRO_TG_JOURNAL_PRIVATE_H
31 #define CAIRO_TG_JOURNAL_PRIVATE_H
32
33 #include "cairoint.h"
34 #include "cairo-pattern-private.h"
35 #include "cairo-clip-private.h"
36 #include "cairo-surface-private.h"
37 #include "cairo-list-private.h"
38 #include "cairo-list-inline.h"
39 #include "cairo-tg-allocator-private.h"
40 #include "cairo-mutex-private.h"
41
42 typedef enum
43 {
44     CAIRO_TG_JOURNAL_ENTRY_PAINT,
45     CAIRO_TG_JOURNAL_ENTRY_MASK,
46     CAIRO_TG_JOURNAL_ENTRY_FILL,
47     CAIRO_TG_JOURNAL_ENTRY_STROKE,
48     CAIRO_TG_JOURNAL_ENTRY_GLYPHS,
49 } cairo_tg_journal_entry_type_t;
50
51 typedef struct _cairo_tg_journal_entry cairo_tg_journal_entry_t;
52
53 struct _cairo_tg_journal_entry
54 {
55     cairo_list_t                    link;
56     cairo_tg_journal_entry_type_t   type;
57
58     cairo_rectangle_int_t           extents;
59
60     cairo_operator_t                op;
61     cairo_pattern_union_t           source;
62     cairo_clip_t                    *clip;
63 };
64
65 typedef struct _cairo_tg_journal_entry_paint
66 {
67     cairo_tg_journal_entry_t base;
68 } cairo_tg_journal_entry_paint_t;
69
70 typedef struct _cairo_tg_journal_entry_mask
71 {
72     cairo_tg_journal_entry_t    base;
73
74     cairo_pattern_union_t       mask;
75 } cairo_tg_journal_entry_mask_t;
76
77 typedef struct _cairo_tg_journal_entry_stroke
78 {
79     cairo_tg_journal_entry_t    base;
80
81     cairo_path_fixed_t          path;
82     cairo_stroke_style_t        style;
83     cairo_matrix_t              ctm;
84     cairo_matrix_t              ctm_inverse;
85     double                      tolerance;
86     cairo_antialias_t           antialias;
87 } cairo_tg_journal_entry_stroke_t;
88
89 typedef struct _cairo_tg_journal_entry_fill
90 {
91     cairo_tg_journal_entry_t    base;
92
93     cairo_path_fixed_t          path;
94     cairo_fill_rule_t           fill_rule;
95     double                      tolerance;
96     cairo_antialias_t           antialias;
97 } cairo_tg_journal_entry_fill_t;
98
99 typedef struct _cairo_tg_journal_entry_glyphs
100 {
101     cairo_tg_journal_entry_t    base;
102
103     cairo_glyph_t               *glyphs;
104     int                         num_glyphs;
105     cairo_scaled_font_t         *scaled_font;
106 } cairo_tg_journal_entry_glyphs_t;
107
108 typedef struct _cairo_tg_journal
109 {
110     cairo_rectangle_int_t       extents;
111     cairo_list_t                entry_list;
112     int                         num_entries;
113     cairo_tg_mono_allocator_t   allocator;
114     cairo_mutex_t               mutex;
115 } cairo_tg_journal_t;
116
117 typedef struct _cairo_tg_journal_replay_funcs
118 {
119     cairo_int_status_t
120     (*paint)    (void                       *closure,
121                  cairo_operator_t           op,
122                  const cairo_pattern_t      *source,
123                  const cairo_clip_t         *clip);
124
125     cairo_int_status_t
126     (*mask)     (void                       *closure,
127                  cairo_operator_t           op,
128                  const cairo_pattern_t      *source,
129                  const cairo_pattern_t      *mask,
130                  const cairo_clip_t         *clip);
131
132     cairo_int_status_t
133     (*stroke)   (void                       *closure,
134                  cairo_operator_t           op,
135                  const cairo_pattern_t      *source,
136                  const cairo_path_fixed_t   *path,
137                  const cairo_stroke_style_t *style,
138                  const cairo_matrix_t       *ctm,
139                  const cairo_matrix_t       *ctm_inverse,
140                  double                     tolerance,
141                  cairo_antialias_t          antialias,
142                  const cairo_clip_t         *clip);
143
144     cairo_int_status_t
145     (*fill)     (void                       *closure,
146                  cairo_operator_t           op,
147                  const cairo_pattern_t      *source,
148                  const cairo_path_fixed_t   *path,
149                  cairo_fill_rule_t          fill_rule,
150                  double                     tolerance,
151                  cairo_antialias_t          antialias,
152                  const cairo_clip_t         *clip);
153
154     cairo_int_status_t
155     (*glyphs)   (void                       *closure,
156                  cairo_operator_t           op,
157                  const cairo_pattern_t      *source,
158                  cairo_glyph_t              *glyphs,
159                  int                        num_glyphs,
160                  cairo_scaled_font_t        *scaled_font,
161                  const cairo_clip_t         *clip);
162 } cairo_tg_journal_replay_funcs_t;
163
164 cairo_int_status_t
165 _cairo_tg_journal_init (cairo_tg_journal_t *journal);
166
167 void
168 _cairo_tg_journal_fini (cairo_tg_journal_t *journal);
169
170 void
171 _cairo_tg_journal_lock (cairo_tg_journal_t *journal);
172
173 void
174 _cairo_tg_journal_unlock (cairo_tg_journal_t *journal);
175
176 cairo_int_status_t
177 _cairo_tg_journal_log_paint (cairo_tg_journal_t     *journal,
178                              cairo_operator_t       op,
179                              const cairo_pattern_t  *source,
180                              const cairo_clip_t     *clip);
181
182 cairo_int_status_t
183 _cairo_tg_journal_log_mask (cairo_tg_journal_t      *journal,
184                             cairo_operator_t        op,
185                             const cairo_pattern_t   *source,
186                             const cairo_pattern_t   *mask,
187                             const cairo_clip_t      *clip);
188
189 cairo_int_status_t
190 _cairo_tg_journal_log_stroke (cairo_tg_journal_t            *journal,
191                               cairo_operator_t              op,
192                               const cairo_pattern_t         *source,
193                               const cairo_path_fixed_t      *path,
194                               const cairo_stroke_style_t    *style,
195                               const cairo_matrix_t          *ctm,
196                               const cairo_matrix_t          *ctm_inverse,
197                               double                        tolerance,
198                               cairo_antialias_t             antialias,
199                               const cairo_clip_t            *clip);
200
201 cairo_int_status_t
202 _cairo_tg_journal_log_fill (cairo_tg_journal_t          *journal,
203                             cairo_operator_t            op,
204                             const cairo_pattern_t       *source,
205                             const cairo_path_fixed_t    *path,
206                             cairo_fill_rule_t           fill_rule,
207                             double                      tolerance,
208                             cairo_antialias_t           antialias,
209                             const cairo_clip_t          *clip);
210
211 cairo_int_status_t
212 _cairo_tg_journal_log_glyphs (cairo_tg_journal_t        *journal,
213                               cairo_operator_t          op,
214                               const cairo_pattern_t     *source,
215                               cairo_glyph_t             *glyphs,
216                               int                       num_glyphs,
217                               cairo_scaled_font_t       *scaled_font,
218                               const cairo_clip_t        *clip);
219
220 void
221 _cairo_tg_journal_clear (cairo_tg_journal_t *journal);
222
223 cairo_int_status_t
224 _cairo_tg_journal_replay (const cairo_tg_journal_t              *journal,
225                           void                                  *closure,
226                           const cairo_rectangle_int_t           *extents,
227                           const cairo_tg_journal_replay_funcs_t *funcs);
228
229 #endif /* CAIRO_TG_JOURNAL_PRIVATE_H */