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-spans.c
Go to the documentation of this file.
1 /* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
2 /* cairo - a vector graphics library with display and print output
3  *
4  * Copyright (c) 2008 M Joonas Pihlaja
5  *
6  * Permission is hereby granted, free of charge, to any person
7  * obtaining a copy of this software and associated documentation
8  * files (the "Software"), to deal in the Software without
9  * restriction, including without limitation the rights to use,
10  * copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following
13  * conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  */
27 #include "cairoint.h"
28 
30 #include "cairo-clip-private.h"
31 #include "cairo-error-private.h"
32 #include "cairo-fixed-private.h"
33 #include "cairo-types-private.h"
34 
35 static void
36 _cairo_nil_destroy (void *abstract)
37 {
38  (void) abstract;
39 }
40 
41 static cairo_status_t
42 _cairo_nil_scan_converter_generate (void *abstract_converter,
43  cairo_span_renderer_t *renderer)
44 {
45  (void) abstract_converter;
46  (void) renderer;
47  return _cairo_scan_converter_status (abstract_converter);
48 }
49 
51 _cairo_scan_converter_status (void *abstract_converter)
52 {
53  cairo_scan_converter_t *converter = abstract_converter;
54  return converter->status;
55 }
56 
58 _cairo_scan_converter_set_error (void *abstract_converter,
60 {
61  cairo_scan_converter_t *converter = abstract_converter;
64  if (converter->status == CAIRO_STATUS_SUCCESS) {
66  converter->status = error;
67  }
68  return converter->status;
69 }
70 
71 static void
74 {
75  converter->destroy = _cairo_nil_destroy;
76  converter->status = CAIRO_STATUS_SUCCESS;
78 }
79 
82 {
83 #define RETURN_NIL {\
84  static cairo_scan_converter_t nil;\
85  _cairo_nil_scan_converter_init (&nil, status);\
86  return &nil;\
87  }
88  switch (status) {
92  break;
135  default:
136  break;
137  }
139  RETURN_NIL;
140 #undef RETURN_NIL
141 }
142 
143 static cairo_status_t
145  void *abstract_renderer,
146  int y,
147  int height,
148  const cairo_half_open_span_t *coverages,
149  unsigned num_coverages)
150 {
151  (void) y;
152  (void) height;
153  (void) coverages;
154  (void) num_coverages;
155  return _cairo_span_renderer_status (abstract_renderer);
156 }
157 
158 static cairo_status_t
159 _cairo_nil_span_renderer_finish (void *abstract_renderer)
160 {
161  return _cairo_span_renderer_status (abstract_renderer);
162 }
163 
165 _cairo_span_renderer_status (void *abstract_renderer)
166 {
167  cairo_span_renderer_t *renderer = abstract_renderer;
168  return renderer->status;
169 }
170 
173  void *abstract_renderer,
175 {
176  cairo_span_renderer_t *renderer = abstract_renderer;
177  if (error == CAIRO_STATUS_SUCCESS) {
179  }
180  if (renderer->status == CAIRO_STATUS_SUCCESS) {
183  renderer->status = error;
184  }
185  return renderer->status;
186 }
187 
188 static void
191 {
192  renderer->destroy = _cairo_nil_destroy;
193  renderer->status = CAIRO_STATUS_SUCCESS;
195 }
196 
199 {
200 #define RETURN_NIL {\
201  static cairo_span_renderer_t nil;\
202  _cairo_nil_span_renderer_init (&nil, status);\
203  return &nil;\
204  }
205  switch (status) {
209  break;
252  default:
253  break;
254  }
256  RETURN_NIL;
257 #undef RETURN_NIL
258 }
#define height(a)
Definition: aptex-macros.h:200
static void _cairo_nil_scan_converter_init(cairo_scan_converter_t *converter, cairo_status_t status)
Definition: cairo-spans.c:72
cairo_status_t _cairo_span_renderer_status(void *abstract_renderer)
Definition: cairo-spans.c:165
static void _cairo_nil_span_renderer_init(cairo_span_renderer_t *renderer, cairo_status_t status)
Definition: cairo-spans.c:189
cairo_scan_converter_t * _cairo_scan_converter_create_in_error(cairo_status_t status)
Definition: cairo-spans.c:81
cairo_status_t _cairo_span_renderer_set_error(void *abstract_renderer, cairo_status_t error)
Definition: cairo-spans.c:172
static void _cairo_nil_destroy(void *abstract)
Definition: cairo-spans.c:36
static cairo_status_t _cairo_nil_span_renderer_render_rows(void *abstract_renderer, int y, int height, const cairo_half_open_span_t *coverages, unsigned num_coverages)
Definition: cairo-spans.c:144
static cairo_status_t _cairo_nil_scan_converter_generate(void *abstract_converter, cairo_span_renderer_t *renderer)
Definition: cairo-spans.c:42
static cairo_status_t _cairo_nil_span_renderer_finish(void *abstract_renderer)
Definition: cairo-spans.c:159
#define RETURN_NIL
cairo_status_t _cairo_scan_converter_status(void *abstract_converter)
Definition: cairo-spans.c:51
cairo_status_t _cairo_scan_converter_set_error(void *abstract_converter, cairo_status_t error)
Definition: cairo-spans.c:58
cairo_span_renderer_t * _cairo_span_renderer_create_in_error(cairo_status_t status)
Definition: cairo-spans.c:198
@ CAIRO_STATUS_NO_CURRENT_POINT
Definition: cairo.h:320
@ CAIRO_STATUS_INVALID_CLUSTERS
Definition: cairo.h:345
@ CAIRO_STATUS_SUCCESS
Definition: cairo.h:315
@ CAIRO_STATUS_TEMP_FILE_ERROR
Definition: cairo.h:339
@ CAIRO_STATUS_NULL_POINTER
Definition: cairo.h:323
@ CAIRO_STATUS_INVALID_MESH_CONSTRUCTION
Definition: cairo.h:352
@ CAIRO_STATUS_INVALID_CONTENT
Definition: cairo.h:331
@ CAIRO_STATUS_INVALID_SIZE
Definition: cairo.h:348
@ CAIRO_STATUS_SURFACE_TYPE_MISMATCH
Definition: cairo.h:329
@ CAIRO_STATUS_INVALID_FORMAT
Definition: cairo.h:332
@ CAIRO_STATUS_DEVICE_FINISHED
Definition: cairo.h:353
@ CAIRO_STATUS_FILE_NOT_FOUND
Definition: cairo.h:334
@ CAIRO_STATUS_PNG_ERROR
Definition: cairo.h:355
@ CAIRO_STATUS_INVALID_SLANT
Definition: cairo.h:346
@ CAIRO_STATUS_INVALID_INDEX
Definition: cairo.h:337
@ CAIRO_STATUS_JBIG2_GLOBAL_MISSING
Definition: cairo.h:354
@ CAIRO_STATUS_INVALID_STATUS
Definition: cairo.h:322
@ CAIRO_STATUS_INVALID_DASH
Definition: cairo.h:335
@ CAIRO_STATUS_WRITE_ERROR
Definition: cairo.h:327
@ CAIRO_STATUS_SURFACE_FINISHED
Definition: cairo.h:328
@ CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED
Definition: cairo.h:349
@ CAIRO_STATUS_FREETYPE_ERROR
Definition: cairo.h:356
@ CAIRO_STATUS_USER_FONT_ERROR
Definition: cairo.h:343
@ CAIRO_STATUS_DEVICE_ERROR
Definition: cairo.h:351
@ CAIRO_STATUS_INVALID_POP_GROUP
Definition: cairo.h:319
@ CAIRO_STATUS_DEVICE_TYPE_MISMATCH
Definition: cairo.h:350
@ CAIRO_STATUS_NO_MEMORY
Definition: cairo.h:317
@ CAIRO_STATUS_LAST_STATUS
Definition: cairo.h:360
@ CAIRO_STATUS_CLIP_NOT_REPRESENTABLE
Definition: cairo.h:338
@ CAIRO_STATUS_INVALID_RESTORE
Definition: cairo.h:318
@ CAIRO_STATUS_PATTERN_TYPE_MISMATCH
Definition: cairo.h:330
@ CAIRO_STATUS_INVALID_DSC_COMMENT
Definition: cairo.h:336
@ CAIRO_STATUS_NEGATIVE_COUNT
Definition: cairo.h:344
@ CAIRO_STATUS_INVALID_WEIGHT
Definition: cairo.h:347
@ CAIRO_STATUS_READ_ERROR
Definition: cairo.h:326
@ CAIRO_STATUS_WIN32_GDI_ERROR
Definition: cairo.h:357
@ CAIRO_STATUS_TAG_ERROR
Definition: cairo.h:358
@ CAIRO_STATUS_FONT_TYPE_MISMATCH
Definition: cairo.h:341
@ CAIRO_STATUS_INVALID_VISUAL
Definition: cairo.h:333
@ CAIRO_STATUS_INVALID_STRING
Definition: cairo.h:324
@ CAIRO_STATUS_INVALID_PATH_DATA
Definition: cairo.h:325
@ CAIRO_STATUS_USER_FONT_IMMUTABLE
Definition: cairo.h:342
@ CAIRO_STATUS_INVALID_STRIDE
Definition: cairo.h:340
@ CAIRO_STATUS_INVALID_MATRIX
Definition: cairo.h:321
enum _cairo_status cairo_status_t
#define ASSERT_NOT_REACHED
Definition: cairoint.h:155
#define error(a)
Definition: dviinfo.c:48
static void
Definition: fpif.c:118
kerning y
Definition: ttdriver.c:212
#define status
cairo_status_t(* generate)(void *abstract_converter, cairo_span_renderer_t *renderer)
cairo_destroy_func_t destroy
cairo_destroy_func_t destroy
cairo_status_t(* finish)(void *abstract_renderer)
cairo_status_t(* render_rows)(void *abstract_renderer, int y, int height, const cairo_half_open_span_t *coverages, unsigned num_coverages)