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-tor-scan-converter.c File Reference
#include "cairoint.h"
#include "cairo-spans-private.h"
#include "cairo-error-private.h"
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <setjmp.h>
Include dependency graph for cairo-tor-scan-converter.c:

Go to the source code of this file.


struct  quorem
struct  _pool_chunk
struct  pool
struct  edge
struct  polygon
struct  cell
struct  cell_list
struct  cell_pair
struct  active_list
struct  glitter_scan_converter
struct  _cairo_tor_scan_converter


#define I   static
#define GRID_Y   15
#define GRID_X   (1 << GRID_X_BITS)
#define GRID_X_TO_INT_FRAC(x, i, f)    _GRID_TO_INT_FRAC_shift(x, i, f, GRID_X_BITS)
#define _GRID_TO_INT_FRAC_general(t, i, f, m)
#define _GRID_TO_INT_FRAC_shift(t, i, f, b)
#define GRID_XY   (2*GRID_X*GRID_Y) /* Unit area on the grid. */
#define GRID_AREA_TO_ALPHA(c)   (((c) + ((c)<<4) + 256) >> 9)
#define UNROLL3(x)   x x x
#define SIZEOF_POOL_CHUNK   (sizeof(struct _pool_chunk) - sizeof(int64_t))
#define EDGE_Y_BUCKET_INDEX(y, ymin)   (((y) - (ymin))/GRID_Y)
#define int_to_grid_scaled_x(x)   int_to_grid_scaled((x), GRID_X)
#define int_to_grid_scaled_y(x)   int_to_grid_scaled((x), GRID_Y)
#define INPUT_TO_GRID_Y(in, out)   INPUT_TO_GRID_general(in, out, GRID_Y)
#define INPUT_TO_GRID_X(in, out)   (out) = (in) >> (GLITTER_INPUT_BITS - GRID_X_BITS)
#define INPUT_TO_GRID_general(in, out, grid_scale)
#define GRID_AREA_TO_A1(A)   ((GRID_AREA_TO_ALPHA (A) > 127) ? 255 : 0)


typedef cairo_status_t glitter_status_t
typedef int glitter_input_scaled_t
typedef struct glitter_scan_converter glitter_scan_converter_t
typedef int grid_scaled_t
typedef int grid_scaled_x_t
typedef int grid_scaled_y_t
typedef struct _cairo_tor_scan_converter cairo_tor_scan_converter_t


static glitter_status_t glitter_scan_converter_reset (glitter_scan_converter_t *converter, int xmin, int ymin, int xmax, int ymax)
static struct _pool_chunk_pool_chunk_init (struct _pool_chunk *p, struct _pool_chunk *prev_chunk, size_t capacity)
static struct _pool_chunk_pool_chunk_create (struct pool *pool, size_t size)
static void pool_init (struct pool *pool, jmp_buf *jmp, size_t default_capacity, size_t embedded_capacity)
static void pool_fini (struct pool *pool)
static void_pool_alloc_from_new_chunk (struct pool *pool, size_t size)
static voidpool_alloc (struct pool *pool, size_t size)
static void pool_reset (struct pool *pool)
static void cell_list_rewind (struct cell_list *cells)
static void cell_list_maybe_rewind (struct cell_list *cells, int x)
static void cell_list_set_rewind (struct cell_list *cells)
static void cell_list_init (struct cell_list *cells, jmp_buf *jmp)
static void cell_list_fini (struct cell_list *cells)
static void cell_list_reset (struct cell_list *cells)
static struct cellcell_list_alloc (struct cell_list *cells, struct cell *tail, int x)
static struct cellcell_list_find (struct cell_list *cells, int x)
static struct cell_pair cell_list_find_pair (struct cell_list *cells, int x1, int x2)
static void cell_list_add_subspan (struct cell_list *cells, grid_scaled_x_t x1, grid_scaled_x_t x2)
static void full_step (struct edge *e)
static void cell_list_render_edge (struct cell_list *cells, struct edge *edge, int sign)
static void polygon_init (struct polygon *polygon, jmp_buf *jmp)
static void polygon_fini (struct polygon *polygon)
static glitter_status_t polygon_reset (struct polygon *polygon, grid_scaled_y_t ymin, grid_scaled_y_t ymax)
static void _polygon_insert_edge_into_its_y_bucket (struct polygon *polygon, struct edge *e)
static void active_list_reset (struct active_list *active)
static void active_list_init (struct active_list *active)
static struct edgemerge_sorted_edges (struct edge *head_a, struct edge *head_b)
static struct edgesort_edges (struct edge *list, unsigned int level, struct edge **head_out)
static struct edgemerge_unsorted_edges (struct edge *head, struct edge *unsorted)
static int can_do_full_row (struct active_list *active)
static void active_list_merge_edges_from_bucket (struct active_list *active, struct edge *edges)
static int polygon_fill_buckets (struct active_list *active, struct edge *edge, int y, struct edge **buckets)
static void step (struct edge *edge)
static void sub_row (struct active_list *active, struct cell_list *coverages, unsigned int mask)
static void dec (struct active_list *a, struct edge *e, int h)
static void full_row (struct active_list *active, struct cell_list *coverages, unsigned int mask)
static void _glitter_scan_converter_init (glitter_scan_converter_t *converter, jmp_buf *jmp)
static void _glitter_scan_converter_fini (glitter_scan_converter_t *self)
static grid_scaled_t int_to_grid_scaled (int i, int scale)
static void polygon_add_edge (struct polygon *polygon, const cairo_edge_t *edge)
static void glitter_scan_converter_add_edge (glitter_scan_converter_t *converter, const cairo_edge_t *edge)
static void step_edges (struct active_list *active, int count)
static glitter_status_t blit_a8 (struct cell_list *cells, cairo_span_renderer_t *renderer, cairo_half_open_span_t *spans, int y, int height, int xmin, int xmax)
static glitter_status_t blit_a1 (struct cell_list *cells, cairo_span_renderer_t *renderer, cairo_half_open_span_t *spans, int y, int height, int xmin, int xmax)
static void glitter_scan_converter_render (glitter_scan_converter_t *converter, unsigned int winding_mask, int antialias, cairo_span_renderer_t *renderer)
static void _cairo_tor_scan_converter_destroy (void *converter)
cairo_status_t _cairo_tor_scan_converter_add_polygon (void *converter, const cairo_polygon_t *polygon)
static cairo_status_t _cairo_tor_scan_converter_generate (void *converter, cairo_span_renderer_t *renderer)
cairo_scan_converter_t_cairo_tor_scan_converter_create (int xmin, int ymin, int xmax, int ymax, cairo_fill_rule_t fill_rule, cairo_antialias_t antialias)

Macro Definition Documentation

◆ _GRID_TO_INT_FRAC_general

#define _GRID_TO_INT_FRAC_general (   t,
do { \
(i) = (t) / (m); \
(f) = (t) % (m); \
if ((f) < 0) { \
--(i); \
(f) += (m); \
} \
} while (0)
mpz_t * f
Definition: gen-fib.c:34
small capitals from c petite p scientific i
Definition: afcover.h:80
Definition: dvips.h:235
Definition: tex4ht.c:3990

Definition at line 221 of file cairo-tor-scan-converter.c.


#define _GRID_TO_INT_FRAC_shift (   t,
do { \
(f) = (t) & ((1 << (b)) - 1); \
(i) = (t) >> (b); \
} while (0)
#define b
Definition: jpegint.h:372

Definition at line 230 of file cairo-tor-scan-converter.c.


#define EDGE_Y_BUCKET_INDEX (   y,
)    (((y) - (ymin))/GRID_Y)

Definition at line 350 of file cairo-tor-scan-converter.c.



Definition at line 111 of file cairo-tor-scan-converter.c.



Definition at line 117 of file cairo-tor-scan-converter.c.



Definition at line 139 of file cairo-tor-scan-converter.c.



Definition at line 113 of file cairo-tor-scan-converter.c.



Definition at line 112 of file cairo-tor-scan-converter.c.


#define GRID_AREA_TO_A1 (   A)    ((GRID_AREA_TO_ALPHA (A) > 127) ? 255 : 0)

Definition at line 1646 of file cairo-tor-scan-converter.c.


#define GRID_AREA_TO_ALPHA (   c)    (((c) + ((c)<<4) + 256) >> 9)

Definition at line 256 of file cairo-tor-scan-converter.c.


#define GRID_X   (1 << GRID_X_BITS)

Definition at line 203 of file cairo-tor-scan-converter.c.



Definition at line 118 of file cairo-tor-scan-converter.c.


#define GRID_X_TO_INT_FRAC (   x,
)     _GRID_TO_INT_FRAC_shift(x, i, f, GRID_X_BITS)

Definition at line 214 of file cairo-tor-scan-converter.c.


#define GRID_XY   (2*GRID_X*GRID_Y) /* Unit area on the grid. */

Definition at line 240 of file cairo-tor-scan-converter.c.


#define GRID_Y   15

Definition at line 119 of file cairo-tor-scan-converter.c.

◆ I

#define I   static

Definition at line 108 of file cairo-tor-scan-converter.c.

◆ INPUT_TO_GRID_general

#define INPUT_TO_GRID_general (   in,
do { \
long long tmp__ = (long long)(grid_scale) * (in); \
tmp__ += 1 << (GLITTER_INPUT_BITS-1); \
(out) = tmp__; \
} while (0)
FILE * out
Definition: hbf2gf.c:286
static FILE * in
Definition: squeeze.c:36

Definition at line 1458 of file cairo-tor-scan-converter.c.


#define INPUT_TO_GRID_X (   in,
)    (out) = (in) >> (GLITTER_INPUT_BITS - GRID_X_BITS)

Definition at line 1453 of file cairo-tor-scan-converter.c.


#define INPUT_TO_GRID_Y (   in,
)    INPUT_TO_GRID_general(in, out, GRID_Y)

Definition at line 1449 of file cairo-tor-scan-converter.c.

◆ int_to_grid_scaled_x

#define int_to_grid_scaled_x (   x)    int_to_grid_scaled((x), GRID_X)

Definition at line 1396 of file cairo-tor-scan-converter.c.

◆ int_to_grid_scaled_y

#define int_to_grid_scaled_y (   x)    int_to_grid_scaled((x), GRID_Y)

Definition at line 1397 of file cairo-tor-scan-converter.c.


#define SIZEOF_POOL_CHUNK   (sizeof(struct _pool_chunk) - sizeof(int64_t))

Definition at line 286 of file cairo-tor-scan-converter.c.


#define UNROLL3 (   x)    x x x

Definition at line 261 of file cairo-tor-scan-converter.c.

Typedef Documentation

◆ cairo_tor_scan_converter_t

◆ glitter_input_scaled_t

Definition at line 140 of file cairo-tor-scan-converter.c.

◆ glitter_scan_converter_t

◆ glitter_status_t

Definition at line 114 of file cairo-tor-scan-converter.c.

◆ grid_scaled_t

typedef int grid_scaled_t

Definition at line 187 of file cairo-tor-scan-converter.c.

◆ grid_scaled_x_t

Definition at line 188 of file cairo-tor-scan-converter.c.

◆ grid_scaled_y_t

Definition at line 189 of file cairo-tor-scan-converter.c.

Function Documentation

◆ _cairo_tor_scan_converter_add_polygon()

cairo_status_t _cairo_tor_scan_converter_add_polygon ( void converter,
const cairo_polygon_t polygon 

Definition at line 1829 of file cairo-tor-scan-converter.c.

◆ _cairo_tor_scan_converter_create()

cairo_scan_converter_t* _cairo_tor_scan_converter_create ( int  xmin,
int  ymin,
int  xmax,
int  ymax,
cairo_fill_rule_t  fill_rule,
cairo_antialias_t  antialias 

Definition at line 1865 of file cairo-tor-scan-converter.c.

◆ _cairo_tor_scan_converter_destroy()

static void _cairo_tor_scan_converter_destroy ( void converter)

◆ _cairo_tor_scan_converter_generate()

◆ _glitter_scan_converter_fini()

static void _glitter_scan_converter_fini ( glitter_scan_converter_t self)

Definition at line 1367 of file cairo-tor-scan-converter.c.

References cell_list_fini(), free, and polygon_fini().

Referenced by _cairo_tor_scan_converter_destroy().

◆ _glitter_scan_converter_init()

◆ _polygon_insert_edge_into_its_y_bucket()

static void _polygon_insert_edge_into_its_y_bucket ( struct polygon polygon,
struct edge e 

Definition at line 990 of file cairo-tor-scan-converter.c.

References e, EDGE_Y_BUCKET_INDEX, polygon::y_buckets, and polygon::ymin.

Referenced by polygon_add_edge().

◆ _pool_alloc_from_new_chunk()

static void* _pool_alloc_from_new_chunk ( struct pool pool,
size_t  size 

◆ _pool_chunk_create()

static struct _pool_chunk* _pool_chunk_create ( struct pool pool,
size_t  size 

◆ _pool_chunk_init()

static struct _pool_chunk* _pool_chunk_init ( struct _pool_chunk p,
struct _pool_chunk prev_chunk,
size_t  capacity 

Definition at line 470 of file cairo-tor-scan-converter.c.

References capacity, p, and prev_chunk.

Referenced by _pool_alloc_from_new_chunk(), _pool_chunk_create(), and pool_init().

◆ active_list_init()

static void active_list_init ( struct active_list active)

Definition at line 1017 of file cairo-tor-scan-converter.c.

References active, and active_list_reset().

Referenced by _glitter_scan_converter_init().

◆ active_list_merge_edges_from_bucket()

static void active_list_merge_edges_from_bucket ( struct active_list active,
struct edge edges 

Definition at line 1203 of file cairo-tor-scan-converter.c.

References active, and merge_unsorted_edges().

◆ active_list_reset()

static void active_list_reset ( struct active_list active)

Definition at line 1000 of file cairo-tor-scan-converter.c.

References active, INT_MAX, INT_MIN, and NULL.

Referenced by active_list_init(), and glitter_scan_converter_reset().

◆ blit_a1()

◆ blit_a8()

◆ can_do_full_row()

static int can_do_full_row ( struct active_list active)

Definition at line 1146 of file cairo-tor-scan-converter.c.

References active, e, GRID_Y, INT_MAX, INT_MIN, is_vertical(), NULL, prev_x, and cordic::x.

◆ cell_list_add_subspan()

static void cell_list_add_subspan ( struct cell_list cells,
grid_scaled_x_t  x1,
grid_scaled_x_t  x2 

◆ cell_list_alloc()

static struct cell* cell_list_alloc ( struct cell_list cells,
struct cell tail,
int  x 

◆ cell_list_find()

static struct cell* cell_list_find ( struct cell_list cells,
int  x 

◆ cell_list_find_pair()

static struct cell_pair cell_list_find_pair ( struct cell_list cells,
int  x1,
int  x2 

Definition at line 671 of file cairo-tor-scan-converter.c.

Referenced by cell_list_add_subspan(), and cell_list_render_edge().

◆ cell_list_fini()

static void cell_list_fini ( struct cell_list cells)

◆ cell_list_init()

static void cell_list_init ( struct cell_list cells,
jmp_buf *  jmp 

◆ cell_list_maybe_rewind()

static void cell_list_maybe_rewind ( struct cell_list cells,
int  x 

Definition at line 605 of file cairo-tor-scan-converter.c.

References cell_list::cursor, and cell_list::rewind.

Referenced by cell_list_render_edge().

◆ cell_list_render_edge()

◆ cell_list_reset()

static void cell_list_reset ( struct cell_list cells)

◆ cell_list_rewind()

static void cell_list_rewind ( struct cell_list cells)

Definition at line 599 of file cairo-tor-scan-converter.c.

References cell_list::cursor.

Referenced by cell_list_init(), cell_list_reset(), and sub_row().

◆ cell_list_set_rewind()

static void cell_list_set_rewind ( struct cell_list cells)

Definition at line 615 of file cairo-tor-scan-converter.c.

References cell_list::cursor, and cell_list::rewind.

Referenced by full_row().

◆ dec()

static void dec ( struct active_list a,
struct edge e,
int  h 

Definition at line 1309 of file cairo-tor-scan-converter.c.

References a, e, and h.

Referenced by full_row().

◆ full_row()

static void full_row ( struct active_list active,
struct cell_list coverages,
unsigned int  mask 

◆ full_step()

static void full_step ( struct edge e)

Definition at line 758 of file cairo-tor-scan-converter.c.

References e.

Referenced by cell_list_render_edge(), and full_row().

◆ glitter_scan_converter_add_edge()

static void glitter_scan_converter_add_edge ( glitter_scan_converter_t converter,
const cairo_edge_t edge 

◆ glitter_scan_converter_render()

static void glitter_scan_converter_render ( glitter_scan_converter_t converter,
unsigned int  winding_mask,
int  antialias,
cairo_span_renderer_t renderer 

Definition at line 1717 of file cairo-tor-scan-converter.c.

Referenced by _cairo_tor_scan_converter_generate().

◆ glitter_scan_converter_reset()

◆ int_to_grid_scaled()

static grid_scaled_t int_to_grid_scaled ( int  i,
int  scale 

Definition at line 1382 of file cairo-tor-scan-converter.c.

References i, INT_MAX, INT_MIN, and scale.

◆ merge_sorted_edges()

static struct edge* merge_sorted_edges ( struct edge head_a,
struct edge head_b 

Definition at line 1041 of file cairo-tor-scan-converter.c.

References edge::cell, head, edge::next, next, NULL, prev, edge::prev, and cordic::x.

Referenced by merge_unsorted_edges(), and sort_edges().

◆ merge_unsorted_edges()

static struct edge* merge_unsorted_edges ( struct edge head,
struct edge unsorted 

◆ polygon_add_edge()

◆ polygon_fill_buckets()

static int polygon_fill_buckets ( struct active_list active,
struct edge edge,
int  y,
struct edge **  buckets 

◆ polygon_fini()

static void polygon_fini ( struct polygon polygon)

◆ polygon_init()

static void polygon_init ( struct polygon polygon,
jmp_buf *  jmp 

◆ polygon_reset()

◆ pool_alloc()

static void* pool_alloc ( struct pool pool,
size_t  size 

◆ pool_fini()

static void pool_fini ( struct pool pool)

Definition at line 507 of file cairo-tor-scan-converter.c.

References pool::current, pool::first_free, free, NULL, p, prev, and pool::sentinel.

Referenced by cell_list_fini(), and polygon_fini().

◆ pool_init()

static void pool_init ( struct pool pool,
jmp_buf *  jmp,
size_t  default_capacity,
size_t  embedded_capacity 

◆ pool_reset()

static void pool_reset ( struct pool pool)

◆ sort_edges()

static struct edge* sort_edges ( struct edge list,
unsigned int  level,
struct edge **  head_out 

◆ step()

static void step ( struct edge edge)

Definition at line 1241 of file cairo-tor-scan-converter.c.

References edge::cell, edge::dxdy, edge::dy, quorem::quo, quorem::rem, and edge::x.

Referenced by __gmpz_hamdist(), _cairo_arc_in_direction(), _cairo_hash_table_lookup(), _cairo_hash_table_lookup_exact_key(), _cairo_hash_table_lookup_unique_key(), _cairo_hash_table_random_entry(), _cairo_stroker_dash_step(), _findSameDataBlock(), _lzw_symbol_table_lookup(), _range_step(), add_fan(), apply_stch(), block_resieve(), BrotliOptimizeHuffmanCountsForRle(), BrotliTransformDictionaryWord(), hb_hashmap_t< K, V, kINVALID, vINVALID >::bucket_for_hash(), ccbaReadStream(), coerce_step_counter(), create_1d_filter(), crec_copy(), crec_copy_unroll(), crec_fill(), crec_fill_unroll(), Collation::decThreeBytePrimaryByOneStep(), Collation::decTwoBytePrimaryByOneStep(), do_dvi_pages(), do_mps_pages(), do_translation(), fdotcurvdist2(), PSOutputDev::filterPSLabel(), first_block_primesieve(), fix_expand_value(), font_from_lua(), font_to_lua(), forlimit(), gen_hex_dump(), geojson_curveto(), get_file(), get_filter(), CollationRootElements::getPrimaryAfter(), CollationRootElements::getPrimaryBefore(), gmp_snprintf_format(), gssentry(), graphite2::Segment::justify(), learn(), lj_opt_narrow_forl(), lj_str_new(), lookup(), luaS_hash(), luaS_newlstr(), luaV_execute(), magstep(), CollationDataBuilder::maybeSetPrimaryRange(), mrb_debug_get_line(), png_do_encode_alpha(), png_image_read_colormap(), DVIToSVGActions::progress(), range_step(), rec_for_check(), rec_for_loop(), recff_ffi_fill(), sendraw(), setParaRunsOnly(), CollationDataBuilder::setPrimaryRangeAndReturnNext(), GfxUnivariateShading::setupCache(), shapeUnicode(), sub_row(), u_shapeArabic_68(), and unpack_q().

◆ step_edges()

static void step_edges ( struct active_list active,
int  count 

◆ sub_row()

static void sub_row ( struct active_list active,
struct cell_list coverages,
unsigned int  mask