w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

cairo-path-fixed-private.h
Go to the documentation of this file.
1 /* cairo - a vector graphics library with display and print output
2  *
3  * Copyright © 2005 Red Hat, Inc.
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 Red Hat, Inc.
31  *
32  * Contributor(s):
33  * Carl D. Worth <cworth@redhat.com>
34  */
35 
36 #ifndef CAIRO_PATH_FIXED_PRIVATE_H
37 #define CAIRO_PATH_FIXED_PRIVATE_H
38 
39 #include "cairo-types-private.h"
40 #include "cairo-compiler-private.h"
41 #include "cairo-list-private.h"
42 
43 #define WATCH_PATH 0
44 #if WATCH_PATH
45 #include <stdio.h>
46 #endif
47 
53 };
54 
55 /* we want to make sure a single byte is used for the enum */
56 typedef char cairo_path_op_t;
57 
58 /* make _cairo_path_fixed fit into ~512 bytes -- about 50 items */
59 #define CAIRO_PATH_BUF_SIZE ((512 - sizeof (cairo_path_buf_t)) \
60  / (2 * sizeof (cairo_point_t) + sizeof (cairo_path_op_t)))
61 
62 #define cairo_path_head(path__) (&(path__)->buf.base)
63 #define cairo_path_tail(path__) cairo_path_buf_prev (cairo_path_head (path__))
64 
65 #define cairo_path_buf_next(pos__) \
66  cairo_list_entry ((pos__)->link.next, cairo_path_buf_t, link)
67 #define cairo_path_buf_prev(pos__) \
68  cairo_list_entry ((pos__)->link.prev, cairo_path_buf_t, link)
69 
70 #define cairo_path_foreach_buf_start(pos__, path__) \
71  pos__ = cairo_path_head (path__); do
72 #define cairo_path_foreach_buf_end(pos__, path__) \
73  while ((pos__ = cairo_path_buf_next (pos__)) != cairo_path_head (path__))
74 
75 
76 typedef struct _cairo_path_buf {
78  unsigned int num_ops;
79  unsigned int size_ops;
80  unsigned int num_points;
81  unsigned int size_points;
82 
86 
87 typedef struct _cairo_path_buf_fixed {
89 
93 
94 /*
95  NOTES:
96  has_curve_to => !stroke_is_rectilinear
97  fill_is_rectilinear => stroke_is_rectilinear
98  fill_is_empty => fill_is_rectilinear
99  fill_maybe_region => fill_is_rectilinear
100 */
101 struct _cairo_path_fixed {
104  unsigned int has_current_point : 1;
105  unsigned int needs_move_to : 1;
106  unsigned int has_extents : 1;
107  unsigned int has_curve_to : 1;
108  unsigned int stroke_is_rectilinear : 1;
109  unsigned int fill_is_rectilinear : 1;
110  unsigned int fill_maybe_region : 1;
111  unsigned int fill_is_empty : 1;
112 
114 
116 };
117 
118 cairo_private void
120  cairo_fixed_t offx,
121  cairo_fixed_t offy);
122 
125  const cairo_path_fixed_t *other,
126  cairo_fixed_t tx,
127  cairo_fixed_t ty);
128 
129 cairo_private unsigned long
131 
132 cairo_private unsigned long
134 
137  const cairo_path_fixed_t *b);
138 
139 typedef struct _cairo_path_fixed_iter {
140  const cairo_path_buf_t *first;
141  const cairo_path_buf_t *buf;
142  unsigned int n_op;
143  unsigned int n_point;
145 
146 cairo_private void
148  const cairo_path_fixed_t *path);
149 
152  cairo_box_t *box);
153 
156 
157 static inline cairo_bool_t
159 {
160  return path->fill_is_empty;
161 }
162 
163 static inline cairo_bool_t
165 {
166  if (! path->fill_is_rectilinear)
167  return 0;
168 
169  if (! path->has_current_point || path->needs_move_to)
170  return 1;
171 
172  /* check whether the implicit close preserves the rectilinear property */
173  return path->current_point.x == path->last_move_point.x ||
174  path->current_point.y == path->last_move_point.y;
175 }
176 
177 static inline cairo_bool_t
179 {
180  return path->stroke_is_rectilinear;
181 }
182 
183 static inline cairo_bool_t
185 {
186  if (! path->fill_maybe_region)
187  return 0;
188 
189  if (! path->has_current_point || path->needs_move_to)
190  return 1;
191 
192  /* check whether the implicit close preserves the rectilinear property
193  * (the integer point property is automatically preserved)
194  */
195  return path->current_point.x == path->last_move_point.x ||
196  path->current_point.y == path->last_move_point.y;
197 }
198 
201  cairo_box_t *box);
202 
205 
206 #endif /* CAIRO_PATH_FIXED_PRIVATE_H */
#define cairo_private
int32_t cairo_fixed_t
char cairo_path_op_t
void _cairo_path_fixed_translate(cairo_path_fixed_t *path, cairo_fixed_t offx, cairo_fixed_t offy)
cairo_bool_t _cairo_path_fixed_iter_is_fill_box(cairo_path_fixed_iter_t *_iter, cairo_box_t *box)
@ CAIRO_PATH_OP_LINE_TO
@ CAIRO_PATH_OP_MOVE_TO
@ CAIRO_PATH_OP_CLOSE_PATH
@ CAIRO_PATH_OP_CURVE_TO
struct _cairo_path_fixed_iter cairo_path_fixed_iter_t
void _cairo_path_fixed_iter_init(cairo_path_fixed_iter_t *iter, const cairo_path_fixed_t *path)
cairo_bool_t _cairo_path_fixed_iter_at_end(const cairo_path_fixed_iter_t *iter)
cairo_bool_t _cairo_path_fixed_equal(const cairo_path_fixed_t *a, const cairo_path_fixed_t *b)
struct _cairo_path_buf_fixed cairo_path_buf_fixed_t
cairo_bool_t _cairo_path_fixed_is_simple_quad(const cairo_path_fixed_t *path)
cairo_bool_t _cairo_path_fixed_is_stroke_box(const cairo_path_fixed_t *path, cairo_box_t *box)
unsigned long _cairo_path_fixed_hash(const cairo_path_fixed_t *path)
struct _cairo_path_buf cairo_path_buf_t
cairo_status_t _cairo_path_fixed_append(cairo_path_fixed_t *path, const cairo_path_fixed_t *other, cairo_fixed_t tx, cairo_fixed_t ty)
unsigned long _cairo_path_fixed_size(const cairo_path_fixed_t *path)
int cairo_bool_t
Definition: cairo.h:107
enum _cairo_status cairo_status_t
static cairo_bool_t _cairo_path_fixed_fill_is_empty(const cairo_path_fixed_t *path)
#define CAIRO_PATH_BUF_SIZE
static cairo_bool_t _cairo_path_fixed_fill_is_rectilinear(const cairo_path_fixed_t *path)
static cairo_bool_t _cairo_path_fixed_fill_maybe_region(const cairo_path_fixed_t *path)
static cairo_bool_t _cairo_path_fixed_stroke_is_rectilinear(const cairo_path_fixed_t *path)
#define b
Definition: jpegint.h:372
#define a(n)
Definition: gpos-common.c:148
@ other
Definition: mtxline.h:22
cairo_point_t points[2 *((512 - sizeof(cairo_path_buf_t))/(2 *sizeof(cairo_point_t)+sizeof(cairo_path_op_t)))]
cairo_path_op_t * op
const cairo_path_buf_t * first
const cairo_path_buf_t * buf
cairo_path_buf_fixed_t buf
Definition: jquant2.c:258
Definition: sh.h:1226
Definition: tpic.c:45
double x
Definition: tpic.c:46
double y
Definition: tpic.c:46