beta-0.89.2
[luatex.git] / source / libs / cairo / cairo-src / src / cairo-surface-observer-private.h
blob6ed0c18d17c27aa817d3bed81aeaab8b84c62f4c
1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2011 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 Intel Corporation.
32 * Contributor(s):
33 * Chris Wilson <chris@chris-wilson.co.uk>
36 #ifndef CAIRO_SURFACE_OBSERVER_PRIVATE_H
37 #define CAIRO_SURFACE_OBSERVER_PRIVATE_H
39 #include "cairoint.h"
41 #include "cairo-device-private.h"
42 #include "cairo-list-private.h"
43 #include "cairo-recording-surface-private.h"
44 #include "cairo-surface-private.h"
45 #include "cairo-surface-backend-private.h"
46 #include "cairo-time-private.h"
48 struct stat {
49 double min, max, sum, sum_sq;
50 unsigned count;
53 #define NUM_OPERATORS (CAIRO_OPERATOR_HSL_LUMINOSITY+1)
54 #define NUM_CAPS (CAIRO_LINE_CAP_SQUARE+1)
55 #define NUM_JOINS (CAIRO_LINE_JOIN_BEVEL+1)
56 #define NUM_ANTIALIAS (CAIRO_ANTIALIAS_BEST+1)
57 #define NUM_FILL_RULE (CAIRO_FILL_RULE_EVEN_ODD+1)
59 struct extents {
60 struct stat area;
61 unsigned int bounded, unbounded;
64 struct pattern {
65 unsigned int type[8]; /* native/record/other surface/gradients */
68 struct path {
69 unsigned int type[5]; /* empty/pixel/rectilinear/straight/curved */
72 struct clip {
73 unsigned int type[6]; /* none, region, boxes, single path, polygon, general */
76 typedef struct _cairo_observation cairo_observation_t;
77 typedef struct _cairo_observation_record cairo_observation_record_t;
78 typedef struct _cairo_device_observer cairo_device_observer_t;
80 struct _cairo_observation_record {
81 cairo_content_t target_content;
82 int target_width;
83 int target_height;
85 int index;
86 cairo_operator_t op;
87 int source;
88 int mask;
89 int num_glyphs;
90 int path;
91 int fill_rule;
92 double tolerance;
93 int antialias;
94 int clip;
95 cairo_time_t elapsed;
98 struct _cairo_observation {
99 int num_surfaces;
100 int num_contexts;
101 int num_sources_acquired;
103 /* XXX put interesting stats here! */
105 struct paint {
106 cairo_time_t elapsed;
107 unsigned int count;
108 struct extents extents;
109 unsigned int operators[NUM_OPERATORS];
110 struct pattern source;
111 struct clip clip;
112 unsigned int noop;
114 cairo_observation_record_t slowest;
115 } paint;
117 struct mask {
118 cairo_time_t elapsed;
119 unsigned int count;
120 struct extents extents;
121 unsigned int operators[NUM_OPERATORS];
122 struct pattern source;
123 struct pattern mask;
124 struct clip clip;
125 unsigned int noop;
127 cairo_observation_record_t slowest;
128 } mask;
130 struct fill {
131 cairo_time_t elapsed;
132 unsigned int count;
133 struct extents extents;
134 unsigned int operators[NUM_OPERATORS];
135 struct pattern source;
136 struct path path;
137 unsigned int antialias[NUM_ANTIALIAS];
138 unsigned int fill_rule[NUM_FILL_RULE];
139 struct clip clip;
140 unsigned int noop;
142 cairo_observation_record_t slowest;
143 } fill;
145 struct stroke {
146 cairo_time_t elapsed;
147 unsigned int count;
148 struct extents extents;
149 unsigned int operators[NUM_OPERATORS];
150 unsigned int caps[NUM_CAPS];
151 unsigned int joins[NUM_CAPS];
152 unsigned int antialias[NUM_ANTIALIAS];
153 struct pattern source;
154 struct path path;
155 struct stat line_width;
156 struct clip clip;
157 unsigned int noop;
159 cairo_observation_record_t slowest;
160 } stroke;
162 struct glyphs {
163 cairo_time_t elapsed;
164 unsigned int count;
165 struct extents extents;
166 unsigned int operators[NUM_OPERATORS];
167 struct pattern source;
168 struct clip clip;
169 unsigned int noop;
171 cairo_observation_record_t slowest;
172 } glyphs;
174 cairo_array_t timings;
175 cairo_recording_surface_t *record;
178 struct _cairo_device_observer {
179 cairo_device_t base;
180 cairo_device_t *target;
182 cairo_observation_t log;
185 struct callback_list {
186 cairo_list_t link;
188 cairo_surface_observer_callback_t func;
189 void *data;
192 struct _cairo_surface_observer {
193 cairo_surface_t base;
194 cairo_surface_t *target;
196 cairo_observation_t log;
198 cairo_list_t paint_callbacks;
199 cairo_list_t mask_callbacks;
200 cairo_list_t fill_callbacks;
201 cairo_list_t stroke_callbacks;
202 cairo_list_t glyphs_callbacks;
204 cairo_list_t flush_callbacks;
205 cairo_list_t finish_callbacks;
208 #endif /* CAIRO_SURFACE_OBSERVER_PRIVATE_H */