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

Go to the source code of this file.

Classes

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_clip_tor_scan_converter
 

Macros

#define GLITTER_INPUT_BITS   CAIRO_FIXED_FRAC_BITS
 
#define GRID_X_BITS   CAIRO_FIXED_FRAC_BITS
 
#define GRID_Y   15
 
#define GLITTER_INPUT_SCALE   (1<<GLITTER_INPUT_BITS)
 
#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 EDGE_Y_BUCKET_HEIGHT   GRID_Y
 
#define EDGE_Y_BUCKET_INDEX(y, ymin)   (((y) - (ymin))/EDGE_Y_BUCKET_HEIGHT)
 
#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)
 

Typedefs

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 int grid_area_t
 
typedef struct _cairo_clip_tor_scan_converter cairo_clip_tor_scan_converter_t
 

Functions

static struct quorem floored_divrem (int a, int b)
 
static struct quorem floored_muldivrem (int x, int a, int b)
 
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_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 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 cairo_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 polygon_add_edge (struct polygon *polygon, const cairo_edge_t *edge, int clip)
 
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 int active_list_can_step_full_row (struct active_list *active)
 
static void active_list_merge_edges_from_polygon (struct active_list *active, struct edge **ptail, grid_scaled_y_t y, struct polygon *polygon)
 
static void active_list_substep_edges (struct active_list *active)
 
static void apply_nonzero_fill_rule_for_subrow (struct active_list *active, struct cell_list *coverages)
 
static void apply_evenodd_fill_rule_for_subrow (struct active_list *active, struct cell_list *coverages)
 
static void apply_nonzero_fill_rule_and_step_edges (struct active_list *active, struct cell_list *coverages)
 
static void apply_evenodd_fill_rule_and_step_edges (struct active_list *active, struct cell_list *coverages)
 
static void _glitter_scan_converter_init (glitter_scan_converter_t *converter, jmp_buf *jmp)
 
static void _glitter_scan_converter_fini (glitter_scan_converter_t *converter)
 
static grid_scaled_t int_to_grid_scaled (int i, int scale)
 
static cairo_status_t glitter_scan_converter_reset (glitter_scan_converter_t *converter, int ymin, int ymax)
 
static void glitter_scan_converter_add_edge (glitter_scan_converter_t *converter, const cairo_edge_t *edge, int clip)
 
static cairo_bool_t active_list_is_vertical (struct active_list *active)
 
static void step_edges (struct active_list *active, int count)
 
static cairo_status_t blit_coverages (struct cell_list *cells, cairo_span_renderer_t *renderer, struct pool *span_pool, int y, int height)
 
static void glitter_scan_converter_render (glitter_scan_converter_t *converter, int nonzero_fill, cairo_span_renderer_t *span_renderer, struct pool *span_pool)
 
static void _cairo_clip_tor_scan_converter_destroy (void *converter)
 
static cairo_status_t _cairo_clip_tor_scan_converter_generate (void *converter, cairo_span_renderer_t *renderer)
 
cairo_scan_converter_t_cairo_clip_tor_scan_converter_create (cairo_clip_t *clip, cairo_polygon_t *polygon, 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,
  i,
  f,
  m 
)
Value:
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
m
Definition: tex4ht.c:3990

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

◆ _GRID_TO_INT_FRAC_shift

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

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

◆ EDGE_Y_BUCKET_HEIGHT

#define EDGE_Y_BUCKET_HEIGHT   GRID_Y

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

◆ EDGE_Y_BUCKET_INDEX

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

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

◆ GLITTER_INPUT_BITS

#define GLITTER_INPUT_BITS   CAIRO_FIXED_FRAC_BITS

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

◆ GLITTER_INPUT_SCALE

#define GLITTER_INPUT_SCALE   (1<<GLITTER_INPUT_BITS)

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

◆ GRID_AREA_TO_ALPHA

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

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

◆ GRID_X

#define GRID_X   (1 << GRID_X_BITS)

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

◆ GRID_X_BITS

#define GRID_X_BITS   CAIRO_FIXED_FRAC_BITS

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

◆ GRID_X_TO_INT_FRAC

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

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

◆ GRID_XY

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

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

◆ GRID_Y

#define GRID_Y   15

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

◆ INPUT_TO_GRID_general

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

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

◆ INPUT_TO_GRID_X

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

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

◆ INPUT_TO_GRID_Y

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

Definition at line 1523 of file cairo-clip-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 1487 of file cairo-clip-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 1488 of file cairo-clip-tor-scan-converter.c.

◆ UNROLL3

#define UNROLL3 (   x)    x x x

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

Typedef Documentation

◆ cairo_clip_tor_scan_converter_t

◆ glitter_input_scaled_t

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

◆ glitter_scan_converter_t

◆ grid_area_t

typedef int grid_area_t

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

◆ grid_scaled_t

typedef int grid_scaled_t

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

◆ grid_scaled_x_t

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

◆ grid_scaled_y_t

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

Function Documentation

◆ _cairo_clip_tor_scan_converter_create()

◆ _cairo_clip_tor_scan_converter_destroy()

static void _cairo_clip_tor_scan_converter_destroy ( void converter)
static

◆ _cairo_clip_tor_scan_converter_generate()

◆ _glitter_scan_converter_fini()

◆ _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 
)
static

Definition at line 937 of file cairo-clip-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 
)
static

◆ _pool_chunk_create()

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

◆ _pool_chunk_init()

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

Definition at line 452 of file cairo-clip-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_can_step_full_row()

static int active_list_can_step_full_row ( struct active_list active)
inlinestatic

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

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

◆ active_list_init()

static void active_list_init ( struct active_list active)
static

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

References active, and active_list_reset().

Referenced by _glitter_scan_converter_init().

◆ active_list_is_vertical()

static cairo_bool_t active_list_is_vertical ( struct active_list active)
static

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

References active, e, FALSE, NULL, and TRUE.

◆ active_list_merge_edges_from_polygon()

static void active_list_merge_edges_from_polygon ( struct active_list active,
struct edge **  ptail,
grid_scaled_y_t  y,
struct polygon polygon 
)
inlinestatic

◆ active_list_reset()

static void active_list_reset ( struct active_list active)
static

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

References active, and NULL.

Referenced by active_list_init(), and glitter_scan_converter_reset().

◆ active_list_substep_edges()

static void active_list_substep_edges ( struct active_list active)
inlinestatic

◆ apply_evenodd_fill_rule_and_step_edges()

static void apply_evenodd_fill_rule_and_step_edges ( struct active_list active,
struct cell_list coverages 
)
static

◆ apply_evenodd_fill_rule_for_subrow()

static void apply_evenodd_fill_rule_for_subrow ( struct active_list active,
struct cell_list coverages 
)
static

◆ apply_nonzero_fill_rule_and_step_edges()

static void apply_nonzero_fill_rule_and_step_edges ( struct active_list active,
struct cell_list coverages 
)
static

◆ apply_nonzero_fill_rule_for_subrow()

static void apply_nonzero_fill_rule_for_subrow ( struct active_list active,
struct cell_list coverages 
)
inlinestatic

◆ blit_coverages()

◆ cell_list_add_subspan()

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

◆ cell_list_alloc()

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

◆ cell_list_find()

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

◆ cell_list_find_pair()

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

◆ cell_list_fini()

static void cell_list_fini ( struct cell_list cells)
static

◆ cell_list_init()

static void cell_list_init ( struct cell_list cells,
jmp_buf *  jmp 
)
static

◆ cell_list_maybe_rewind()

static void cell_list_maybe_rewind ( struct cell_list cells,
int  x 
)
inlinestatic

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

References cell_list_rewind(), cell_list::cursor, tail, and cordic::x.

Referenced by cell_list_render_edge().

◆ cell_list_render_edge()

◆ cell_list_reset()

static void cell_list_reset ( struct cell_list cells)
inlinestatic

◆ cell_list_rewind()

◆ floored_divrem()

static struct quorem floored_divrem ( int  a,
int  b 
)
inlinestatic

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

Referenced by cell_list_render_edge(), and polygon_add_edge().

◆ floored_muldivrem()

static struct quorem floored_muldivrem ( int  x,
int  a,
int  b 
)
static

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

Referenced by polygon_add_edge().

◆ glitter_scan_converter_add_edge()

static void glitter_scan_converter_add_edge ( glitter_scan_converter_t converter,
const cairo_edge_t edge,
int  clip 
)
static

◆ glitter_scan_converter_render()

static void glitter_scan_converter_render ( glitter_scan_converter_t converter,
int  nonzero_fill,
cairo_span_renderer_t span_renderer,
struct pool span_pool 
)
static

◆ glitter_scan_converter_reset()

◆ int_to_grid_scaled()

static grid_scaled_t int_to_grid_scaled ( int  i,
int  scale 
)
static

Definition at line 1473 of file cairo-clip-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 
)
static

◆ polygon_add_edge()

◆ polygon_fini()

static void polygon_fini ( struct polygon polygon)
static

◆ polygon_init()

◆ polygon_reset()

◆ pool_alloc()

static void* pool_alloc ( struct pool pool,
size_t  size 
)
inlinestatic

◆ pool_fini()

static void pool_fini ( struct pool pool)
static

◆ pool_init()

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

◆ pool_reset()

static void pool_reset ( struct pool pool)
static

◆ sort_edges()

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

◆ step_edges()

static void step_edges ( struct active_list active,
int  count 
)
static