Back to index

lightning-sunbird  0.9+nobinonly
Classes | Typedefs | Functions
cairo-gstate.c File Reference
#include <stdlib.h>
#include "cairoint.h"
#include "cairo-clip-private.h"
#include "cairo-gstate-private.h"

Go to the source code of this file.

Classes

struct  cairo_composite_traps_info_t
struct  cairo_show_glyphs_info_t

Typedefs

typedef cairo_status_t(* cairo_draw_func_t )(void *closure, cairo_operator_t operator, cairo_pattern_t *src, cairo_surface_t *dst, int dst_x, int dst_y, const cairo_rectangle_t *extents)

Functions

static cairo_status_t _cairo_gstate_init (cairo_gstate_t *gstate, cairo_surface_t *target)
static cairo_status_t _cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other)
static void _cairo_gstate_fini (cairo_gstate_t *gstate)
static cairo_status_t _cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate, cairo_traps_t *traps)
static cairo_status_t _cairo_gstate_ensure_font_face (cairo_gstate_t *gstate)
static cairo_status_t _cairo_gstate_ensure_scaled_font (cairo_gstate_t *gstate)
static void _cairo_gstate_unset_scaled_font (cairo_gstate_t *gstate)
cairo_gstate_t * _cairo_gstate_create (cairo_surface_t *target)
void _cairo_gstate_destroy (cairo_gstate_t *gstate)
cairo_gstate_t * _cairo_gstate_clone (cairo_gstate_t *gstate)
cairo_surface_t * _cairo_gstate_get_target (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_set_source (cairo_gstate_t *gstate, cairo_pattern_t *source)
cairo_pattern_t * _cairo_gstate_get_source (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_set_operator (cairo_gstate_t *gstate, cairo_operator_t operator)
cairo_operator_t _cairo_gstate_get_operator (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_set_tolerance (cairo_gstate_t *gstate, double tolerance)
double _cairo_gstate_get_tolerance (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_set_fill_rule (cairo_gstate_t *gstate, cairo_fill_rule_t fill_rule)
cairo_fill_rule_t _cairo_gstate_get_fill_rule (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_set_line_width (cairo_gstate_t *gstate, double width)
double _cairo_gstate_get_line_width (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_set_line_cap (cairo_gstate_t *gstate, cairo_line_cap_t line_cap)
cairo_line_cap_t _cairo_gstate_get_line_cap (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_set_line_join (cairo_gstate_t *gstate, cairo_line_join_t line_join)
cairo_line_join_t _cairo_gstate_get_line_join (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, double offset)
cairo_status_t _cairo_gstate_set_miter_limit (cairo_gstate_t *gstate, double limit)
double _cairo_gstate_get_miter_limit (cairo_gstate_t *gstate)
static void _cairo_gstate_apply_device_transform (cairo_gstate_t *gstate, cairo_matrix_t *matrix)
static void _cairo_gstate_apply_device_inverse_transform (cairo_gstate_t *gstate, cairo_matrix_t *matrix)
void _cairo_gstate_get_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix)
cairo_status_t _cairo_gstate_translate (cairo_gstate_t *gstate, double tx, double ty)
cairo_status_t _cairo_gstate_scale (cairo_gstate_t *gstate, double sx, double sy)
cairo_status_t _cairo_gstate_rotate (cairo_gstate_t *gstate, double angle)
cairo_status_t _cairo_gstate_transform (cairo_gstate_t *gstate, const cairo_matrix_t *matrix)
cairo_status_t _cairo_gstate_set_matrix (cairo_gstate_t *gstate, const cairo_matrix_t *matrix)
cairo_status_t _cairo_gstate_identity_matrix (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_user_to_device (cairo_gstate_t *gstate, double *x, double *y)
cairo_status_t _cairo_gstate_user_to_device_distance (cairo_gstate_t *gstate, double *dx, double *dy)
cairo_status_t _cairo_gstate_device_to_user (cairo_gstate_t *gstate, double *x, double *y)
cairo_status_t _cairo_gstate_device_to_user_distance (cairo_gstate_t *gstate, double *dx, double *dy)
void _cairo_gstate_user_to_backend (cairo_gstate_t *gstate, double *x, double *y)
void _cairo_gstate_backend_to_user (cairo_gstate_t *gstate, double *x, double *y)
static void _cairo_gstate_copy_transformed_pattern (cairo_gstate_t *gstate, cairo_pattern_t *pattern, cairo_pattern_t *original, cairo_matrix_t *ctm_inverse)
static void _cairo_gstate_copy_transformed_source (cairo_gstate_t *gstate, cairo_pattern_t *pattern)
static void _cairo_gstate_copy_transformed_mask (cairo_gstate_t *gstate, cairo_pattern_t *pattern, cairo_pattern_t *mask)
cairo_status_t _cairo_gstate_paint (cairo_gstate_t *gstate)
cairo_bool_t _cairo_operator_bounded (cairo_operator_t operator)
 _cairo_operator_bounded: : a cairo_operator_t
static cairo_status_t _create_composite_mask_pattern (cairo_surface_pattern_t *mask_pattern, cairo_clip_t *clip, cairo_draw_func_t draw_func, void *draw_closure, cairo_surface_t *dst, const cairo_rectangle_t *extents)
static cairo_status_t _cairo_gstate_clip_and_composite_with_mask (cairo_clip_t *clip, cairo_operator_t operator, cairo_pattern_t *src, cairo_draw_func_t draw_func, void *draw_closure, cairo_surface_t *dst, const cairo_rectangle_t *extents)
static cairo_status_t _cairo_gstate_clip_and_composite_combine (cairo_clip_t *clip, cairo_operator_t operator, cairo_pattern_t *src, cairo_draw_func_t draw_func, void *draw_closure, cairo_surface_t *dst, const cairo_rectangle_t *extents)
static cairo_status_t _cairo_gstate_clip_and_composite_source (cairo_clip_t *clip, cairo_pattern_t *src, cairo_draw_func_t draw_func, void *draw_closure, cairo_surface_t *dst, const cairo_rectangle_t *extents)
static int _cairo_rectangle_empty (const cairo_rectangle_t *rect)
static cairo_status_t _cairo_gstate_clip_and_composite (cairo_clip_t *clip, cairo_operator_t operator, cairo_pattern_t *src, cairo_draw_func_t draw_func, void *draw_closure, cairo_surface_t *dst, const cairo_rectangle_t *extents)
 _cairo_gstate_clip_and_composite: : a #cairo_gstate_t : the operator to draw with : source pattern : function that can be called to draw with the mask onto a surface.
static cairo_status_t _get_mask_extents (cairo_gstate_t *gstate, cairo_pattern_t *mask, cairo_rectangle_t *extents)
static cairo_status_t _cairo_gstate_mask_draw_func (void *closure, cairo_operator_t operator, cairo_pattern_t *src, cairo_surface_t *dst, int dst_x, int dst_y, const cairo_rectangle_t *extents)
cairo_status_t _cairo_gstate_mask (cairo_gstate_t *gstate, cairo_pattern_t *mask)
cairo_status_t _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
cairo_status_t _cairo_gstate_in_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path, double x, double y, cairo_bool_t *inside_ret)
void _cairo_box_round_to_rectangle (cairo_box_t *box, cairo_rectangle_t *rectangle)
void _cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src)
static cairo_status_t _composite_trap_region (cairo_clip_t *clip, cairo_pattern_t *src, cairo_operator_t operator, cairo_surface_t *dst, pixman_region16_t *trap_region, cairo_rectangle_t *extents)
static cairo_status_t _composite_traps_draw_func (void *closure, cairo_operator_t operator, cairo_pattern_t *src, cairo_surface_t *dst, int dst_x, int dst_y, const cairo_rectangle_t *extents)
cairo_status_t _cairo_surface_clip_and_composite_trapezoids (cairo_pattern_t *src, cairo_operator_t operator, cairo_surface_t *dst, cairo_traps_t *traps, cairo_clip_t *clip, cairo_antialias_t antialias)
cairo_status_t _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
cairo_status_t _cairo_gstate_in_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path, double x, double y, cairo_bool_t *inside_ret)
cairo_status_t _cairo_gstate_copy_page (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_show_page (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_stroke_extents (cairo_gstate_t *gstate, cairo_path_fixed_t *path, double *x1, double *y1, double *x2, double *y2)
cairo_status_t _cairo_gstate_fill_extents (cairo_gstate_t *gstate, cairo_path_fixed_t *path, double *x1, double *y1, double *x2, double *y2)
cairo_status_t _cairo_gstate_reset_clip (cairo_gstate_t *gstate)
cairo_status_t _cairo_gstate_clip (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
cairo_status_t _cairo_gstate_select_font_face (cairo_gstate_t *gstate, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight)
cairo_status_t _cairo_gstate_set_font_size (cairo_gstate_t *gstate, double size)
cairo_status_t _cairo_gstate_set_font_matrix (cairo_gstate_t *gstate, const cairo_matrix_t *matrix)
void _cairo_gstate_get_font_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix)
cairo_status_t _cairo_gstate_set_font_options (cairo_gstate_t *gstate, const cairo_font_options_t *options)
void _cairo_gstate_get_font_options (cairo_gstate_t *gstate, cairo_font_options_t *options)
cairo_status_t _cairo_gstate_get_font_face (cairo_gstate_t *gstate, cairo_font_face_t **font_face)
cairo_status_t _cairo_gstate_get_font_extents (cairo_gstate_t *gstate, cairo_font_extents_t *extents)
cairo_status_t _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate, const char *utf8, double x, double y, cairo_glyph_t **glyphs, int *num_glyphs)
cairo_status_t _cairo_gstate_set_font_face (cairo_gstate_t *gstate, cairo_font_face_t *font_face)
cairo_status_t _cairo_gstate_glyph_extents (cairo_gstate_t *gstate, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents)
static cairo_status_t _cairo_gstate_show_glyphs_draw_func (void *closure, cairo_operator_t operator, cairo_pattern_t *src, cairo_surface_t *dst, int dst_x, int dst_y, const cairo_rectangle_t *extents)
cairo_status_t _cairo_gstate_show_glyphs (cairo_gstate_t *gstate, cairo_glyph_t *glyphs, int num_glyphs)
cairo_status_t _cairo_gstate_glyph_path (cairo_gstate_t *gstate, cairo_glyph_t *glyphs, int num_glyphs, cairo_path_fixed_t *path)
cairo_private cairo_status_t _cairo_gstate_set_antialias (cairo_gstate_t *gstate, cairo_antialias_t antialias)
cairo_private cairo_antialias_t _cairo_gstate_get_antialias (cairo_gstate_t *gstate)

Class Documentation

struct cairo_composite_traps_info_t

Definition at line 1355 of file cairo-gstate.c.

Collaboration diagram for cairo_composite_traps_info_t:
Class Members
cairo_antialias_t antialias
cairo_traps_t * traps
struct cairo_show_glyphs_info_t

Definition at line 2016 of file cairo-gstate.c.

Collaboration diagram for cairo_show_glyphs_info_t:
Class Members
cairo_scaled_font_t * font
cairo_glyph_t * glyphs
int num_glyphs

Typedef Documentation

typedef cairo_status_t(* cairo_draw_func_t)(void *closure, cairo_operator_t operator, cairo_pattern_t *src, cairo_surface_t *dst, int dst_x, int dst_y, const cairo_rectangle_t *extents)

Definition at line 804 of file cairo-gstate.c.


Function Documentation

Definition at line 1265 of file cairo-gstate.c.

{
    rectangle->x = _cairo_fixed_integer_floor (box->p1.x);
    rectangle->y = _cairo_fixed_integer_floor (box->p1.y);
    rectangle->width = _cairo_fixed_integer_ceil (box->p2.x) - rectangle->x;
    rectangle->height = _cairo_fixed_integer_ceil (box->p2.y) - rectangle->y;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _cairo_gstate_apply_device_inverse_transform ( cairo_gstate_t *  gstate,
cairo_matrix_t matrix 
) [static]

Definition at line 508 of file cairo-gstate.c.

{
    if (gstate->target->device_x_scale != 1.0 ||
       gstate->target->device_y_scale != 1.0)
    {
       cairo_matrix_scale (matrix,
                         1/gstate->target->device_x_scale,
                         1/gstate->target->device_y_scale);
    }
}

Here is the caller graph for this function:

static void _cairo_gstate_apply_device_transform ( cairo_gstate_t *  gstate,
cairo_matrix_t matrix 
) [static]

Definition at line 495 of file cairo-gstate.c.

{
    if (gstate->target->device_x_scale != 1.0 ||
       gstate->target->device_y_scale != 1.0)
    {
       cairo_matrix_scale (matrix,
                         gstate->target->device_x_scale,
                         gstate->target->device_y_scale);
    }
}

Here is the caller graph for this function:

void _cairo_gstate_backend_to_user ( cairo_gstate_t *  gstate,
double *  x,
double *  y 
)

Definition at line 673 of file cairo-gstate.c.

{
    *x -= gstate->target->device_x_offset;
    *y -= gstate->target->device_y_offset;
    cairo_matrix_transform_point (&gstate->ctm_inverse, x, y);
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_clip ( cairo_gstate_t *  gstate,
cairo_path_fixed_t *  path 
)

Definition at line 1714 of file cairo-gstate.c.

{
    return _cairo_clip_clip (&gstate->clip,
                          path, gstate->fill_rule, gstate->tolerance,
                          gstate->antialias, gstate->target);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_clip_and_composite ( cairo_clip_t *  clip,
cairo_operator_t  operator,
cairo_pattern_t *  src,
cairo_draw_func_t  draw_func,
void draw_closure,
cairo_surface_t *  dst,
const cairo_rectangle_t extents 
) [static]

_cairo_gstate_clip_and_composite: : a #cairo_gstate_t : the operator to draw with : source pattern : function that can be called to draw with the mask onto a surface.

: data to pass to . : destination surface : rectangle holding a bounding box for the operation; this rectangle will be used as the size for the temporary surface.

When there is a surface clip, we typically need to create an intermediate surface. This function handles the logic of creating a temporary surface drawing to it, then compositing the result onto the target surface.

is to called to draw the mask; it will be called no more than once.

Return value: CAIRO_STATUS_SUCCESS if the drawing succeeded.

Definition at line 1053 of file cairo-gstate.c.

{
    cairo_pattern_union_t solid_pattern;
    cairo_status_t status;

    if (_cairo_rectangle_empty (extents))
       /* Nothing to do */
       return CAIRO_STATUS_SUCCESS;

    if (operator == CAIRO_OPERATOR_CLEAR) {
       _cairo_pattern_init_solid (&solid_pattern.solid, CAIRO_COLOR_WHITE);
       src = &solid_pattern.base;
       operator = CAIRO_OPERATOR_DEST_OUT;
    }

    if (clip->surface || operator == CAIRO_OPERATOR_SOURCE)
    {
       if (operator == CAIRO_OPERATOR_SOURCE)
           status = _cairo_gstate_clip_and_composite_source (clip,
                                                       src,
                                                       draw_func, draw_closure,
                                                       dst, extents);
       else if (_cairo_operator_bounded (operator))
           status = _cairo_gstate_clip_and_composite_with_mask (clip, operator,
                                                         src,
                                                         draw_func, draw_closure,
                                                         dst, extents);
       else
           status = _cairo_gstate_clip_and_composite_combine (clip, operator,
                                                        src,
                                                        draw_func, draw_closure,
                                                        dst, extents);
    }
    else
    {
       status = (*draw_func) (draw_closure, operator,
                            src, dst,
                            0, 0,
                            extents);
    }

    if (src == &solid_pattern.base)
       _cairo_pattern_fini (&solid_pattern.base);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_clip_and_composite_combine ( cairo_clip_t *  clip,
cairo_operator_t  operator,
cairo_pattern_t *  src,
cairo_draw_func_t  draw_func,
void draw_closure,
cairo_surface_t *  dst,
const cairo_rectangle_t extents 
) [static]

Definition at line 891 of file cairo-gstate.c.

{
    cairo_surface_t *intermediate;
    cairo_surface_pattern_t dst_pattern;
    cairo_surface_pattern_t intermediate_pattern;
    cairo_status_t status;

    /* We'd be better off here creating a surface identical in format
     * to dst, but we have no way of getting that information.
     * A CAIRO_CONTENT_CLONE or something might be useful.
     * cairo_surface_create_similar() also unnecessarily clears the surface.
     */
    intermediate = cairo_surface_create_similar (dst,
                                           CAIRO_CONTENT_COLOR_ALPHA,
                                           extents->width,
                                           extents->height);
    if (intermediate->status)
       return CAIRO_STATUS_NO_MEMORY;

    /* Initialize the intermediate surface from the destination surface
     */
    _cairo_pattern_init_for_surface (&dst_pattern, dst);

    status = _cairo_surface_composite (CAIRO_OPERATOR_SOURCE,
                                   &dst_pattern.base, NULL, intermediate,
                                   extents->x,     extents->y,
                                   0,              0,
                                   0,              0,
                                   extents->width, extents->height);

    _cairo_pattern_fini (&dst_pattern.base);

    if (status)
       goto CLEANUP_SURFACE;

    status = (*draw_func) (draw_closure, operator,
                        src, intermediate,
                        extents->x, extents->y,
                        extents);
    if (status)
       goto CLEANUP_SURFACE;

    /* Combine that with the clip
     */
    status = _cairo_clip_combine_to_surface (clip, CAIRO_OPERATOR_DEST_IN,
                                        intermediate,
                                        extents->x, extents->y,                                        
                                        extents);
    if (status)
       goto CLEANUP_SURFACE;

    /* Punch the clip out of the destination
     */
    status = _cairo_clip_combine_to_surface (clip, CAIRO_OPERATOR_DEST_OUT,
                                        dst,
                                        0, 0,
                                        extents);
    if (status)
       goto CLEANUP_SURFACE;

    /* Now add the two results together
     */
    _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate);
    
    status = _cairo_surface_composite (CAIRO_OPERATOR_ADD,
                                   &intermediate_pattern.base, NULL, dst,
                                   0,              0,
                                   0,              0,
                                   extents->x,     extents->y,
                                   extents->width, extents->height);

    _cairo_pattern_fini (&intermediate_pattern.base);
    
 CLEANUP_SURFACE:
    cairo_surface_destroy (intermediate);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_clip_and_composite_source ( cairo_clip_t *  clip,
cairo_pattern_t *  src,
cairo_draw_func_t  draw_func,
void draw_closure,
cairo_surface_t *  dst,
const cairo_rectangle_t extents 
) [static]

Definition at line 980 of file cairo-gstate.c.

{
    cairo_surface_pattern_t mask_pattern;
    cairo_status_t status;

    /* Create a surface that is mask IN clip
     */
    status = _create_composite_mask_pattern (&mask_pattern,
                                        clip,
                                        draw_func, draw_closure,
                                        dst, extents);
    if (status)
       return status;
    
    /* Compute dest' = dest OUT (mask IN clip)
     */
    status = _cairo_surface_composite (CAIRO_OPERATOR_DEST_OUT,
                                   &mask_pattern.base, NULL, dst,
                                   0,              0,
                                   0,              0,
                                   extents->x,     extents->y,
                                   extents->width, extents->height);

    if (status)
       goto CLEANUP_MASK_PATTERN;

    /* Now compute (src IN (mask IN clip)) ADD dest'
     */
    status = _cairo_surface_composite (CAIRO_OPERATOR_ADD,
                                   src, &mask_pattern.base, dst,
                                   extents->x,     extents->y,
                                   0,              0,
                                   extents->x,     extents->y,
                                   extents->width, extents->height);

 CLEANUP_MASK_PATTERN:
    _cairo_pattern_fini (&mask_pattern.base);
    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_clip_and_composite_trapezoids ( cairo_gstate_t *  gstate,
cairo_traps_t traps 
) [static]

Definition at line 1536 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_clip_and_composite_with_mask ( cairo_clip_t *  clip,
cairo_operator_t  operator,
cairo_pattern_t *  src,
cairo_draw_func_t  draw_func,
void draw_closure,
cairo_surface_t *  dst,
const cairo_rectangle_t extents 
) [static]

Definition at line 857 of file cairo-gstate.c.

{
    cairo_surface_pattern_t mask_pattern;
    cairo_status_t status;

    status = _create_composite_mask_pattern (&mask_pattern,
                                        clip,
                                        draw_func, draw_closure,
                                        dst, extents);
    if (status)
       return status;
       
    status = _cairo_surface_composite (operator,
                                   src, &mask_pattern.base, dst,
                                   extents->x,     extents->y,
                                   0,              0,
                                   extents->x,     extents->y,
                                   extents->width, extents->height);

    _cairo_pattern_fini (&mask_pattern.base);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_gstate_t* _cairo_gstate_clone ( cairo_gstate_t *  gstate)

Definition at line 216 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_gstate_t *clone;

    clone = malloc (sizeof (cairo_gstate_t));
    if (clone) {
       status = _cairo_gstate_init_copy (clone, gstate);
       if (status) {
           free (clone);
           return NULL;
       }
       clone->next = NULL;
    }

    return clone;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_copy_page ( cairo_gstate_t *  gstate)

Definition at line 1627 of file cairo-gstate.c.

{
    return _cairo_surface_copy_page (gstate->target);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _cairo_gstate_copy_transformed_mask ( cairo_gstate_t *  gstate,
cairo_pattern_t *  pattern,
cairo_pattern_t *  mask 
) [static]

Definition at line 719 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void _cairo_gstate_copy_transformed_pattern ( cairo_gstate_t *  gstate,
cairo_pattern_t *  pattern,
cairo_pattern_t *  original,
cairo_matrix_t ctm_inverse 
) [static]

Definition at line 692 of file cairo-gstate.c.

{
    cairo_matrix_t tmp_matrix = *ctm_inverse;
  
    _cairo_pattern_init_copy (pattern, original);

    if (gstate->target)
       cairo_matrix_translate (&tmp_matrix,
                            - gstate->target->device_x_offset,
                            - gstate->target->device_y_offset);

    _cairo_pattern_transform (pattern, &tmp_matrix);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _cairo_gstate_copy_transformed_source ( cairo_gstate_t *  gstate,
cairo_pattern_t *  pattern 
) [static]

Definition at line 710 of file cairo-gstate.c.

{
    _cairo_gstate_copy_transformed_pattern (gstate, pattern,
                                       gstate->source,
                                       &gstate->source_ctm_inverse);
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_gstate_t* _cairo_gstate_create ( cairo_surface_t *  target)

Definition at line 69 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_gstate_t *gstate;

    gstate = malloc (sizeof (cairo_gstate_t));

    if (gstate)
    {
       status = _cairo_gstate_init (gstate, target);
       if (status) {
           free (gstate);
           return NULL;            
       }
    }

    return gstate;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _cairo_gstate_destroy ( cairo_gstate_t *  gstate)

Definition at line 209 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_device_to_user ( cairo_gstate_t *  gstate,
double *  x,
double *  y 
)

Definition at line 648 of file cairo-gstate.c.

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_device_to_user_distance ( cairo_gstate_t *  gstate,
double *  dx,
double *  dy 
)

Definition at line 656 of file cairo-gstate.c.

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_ensure_font_face ( cairo_gstate_t *  gstate) [static]

Definition at line 1887 of file cairo-gstate.c.

{
    if (!gstate->font_face) {
       cairo_font_face_t *font_face;

       font_face = _cairo_toy_font_face_create (CAIRO_FONT_FAMILY_DEFAULT,
                                           CAIRO_FONT_SLANT_DEFAULT,
                                           CAIRO_FONT_WEIGHT_DEFAULT);
       if (font_face->status)
           return font_face->status;
       else
           gstate->font_face = font_face;
    }
    
    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_ensure_scaled_font ( cairo_gstate_t *  gstate) [static]

Definition at line 1905 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_font_options_t options;
    
    if (gstate->scaled_font)
       return CAIRO_STATUS_SUCCESS;
    
    status = _cairo_gstate_ensure_font_face (gstate);
    if (status)
       return status;

    cairo_surface_get_font_options (gstate->target, &options);
    cairo_font_options_merge (&options, &gstate->font_options);
    
    gstate->scaled_font = cairo_scaled_font_create (gstate->font_face,
                                              &gstate->font_matrix,
                                              &gstate->ctm,
                                              &options);
    
    if (!gstate->scaled_font)
       return CAIRO_STATUS_NO_MEMORY;

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_fill ( cairo_gstate_t *  gstate,
cairo_path_fixed_t *  path 
)

Definition at line 1557 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_traps_t traps;

    if (gstate->source->status)
       return gstate->source->status;
    
    status = _cairo_surface_set_clip (gstate->target, &gstate->clip);
    if (status)
       return status;

    status = _cairo_surface_fill_path (gstate->operator,
                                   gstate->source,
                                   gstate->target,
                                   path,
                                   gstate->fill_rule,
                                   gstate->tolerance);
    
    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
       return status;

    _cairo_traps_init (&traps);

    status = _cairo_path_fixed_fill_to_traps (path,
                                         gstate->fill_rule,
                                         gstate->tolerance,
                                         &traps);
    if (status) {
       _cairo_traps_fini (&traps);
       return status;
    }

    _cairo_gstate_clip_and_composite_trapezoids (gstate, &traps);

    _cairo_traps_fini (&traps);

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_fill_extents ( cairo_gstate_t *  gstate,
cairo_path_fixed_t *  path,
double *  x1,
double *  y1,
double *  x2,
double *  y2 
)

Definition at line 1673 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_traps_t traps;
    cairo_box_t extents;
  
    _cairo_traps_init (&traps);
  
    status = _cairo_path_fixed_fill_to_traps (path,
                                         gstate->fill_rule,
                                         gstate->tolerance,
                                         &traps);
    if (status)
       goto BAIL;
  
    _cairo_traps_extents (&traps, &extents);

    *x1 = _cairo_fixed_to_double (extents.p1.x);
    *y1 = _cairo_fixed_to_double (extents.p1.y);
    *x2 = _cairo_fixed_to_double (extents.p2.x);
    *y2 = _cairo_fixed_to_double (extents.p2.y);

    _cairo_gstate_backend_to_user (gstate, x1, y1);
    _cairo_gstate_backend_to_user (gstate, x2, y2);
  
BAIL:
    _cairo_traps_fini (&traps);
  
    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _cairo_gstate_fini ( cairo_gstate_t *  gstate) [static]

Definition at line 183 of file cairo-gstate.c.

{
    if (gstate->font_face)
       cairo_font_face_destroy (gstate->font_face);

    if (gstate->scaled_font)
       cairo_scaled_font_destroy (gstate->scaled_font);

    if (gstate->target) {
       cairo_surface_destroy (gstate->target);
       gstate->target = NULL;
    }

    _cairo_clip_fini (&gstate->clip);

    cairo_pattern_destroy (gstate->source);

    _cairo_pen_fini (&gstate->pen_regular);

    if (gstate->dash) {
       free (gstate->dash);
       gstate->dash = NULL;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2189 of file cairo-gstate.c.

{
    return gstate->antialias;
}

Here is the caller graph for this function:

cairo_fill_rule_t _cairo_gstate_get_fill_rule ( cairo_gstate_t *  gstate)

Definition at line 383 of file cairo-gstate.c.

{
    return gstate->fill_rule;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_get_font_extents ( cairo_gstate_t *  gstate,
cairo_font_extents_t extents 
)

Definition at line 1932 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_get_font_face ( cairo_gstate_t *  gstate,
cairo_font_face_t **  font_face 
)

Definition at line 1796 of file cairo-gstate.c.

{
    cairo_status_t status;

    status = _cairo_gstate_ensure_font_face (gstate);
    if (status)
       return status;
    
    *font_face = gstate->font_face;

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _cairo_gstate_get_font_matrix ( cairo_gstate_t *  gstate,
cairo_matrix_t matrix 
)

Definition at line 1771 of file cairo-gstate.c.

{
    *matrix = gstate->font_matrix;
}

Here is the caller graph for this function:

void _cairo_gstate_get_font_options ( cairo_gstate_t *  gstate,
cairo_font_options_t *  options 
)

Definition at line 1789 of file cairo-gstate.c.

{
    *options = gstate->font_options;
}

Here is the caller graph for this function:

cairo_line_cap_t _cairo_gstate_get_line_cap ( cairo_gstate_t *  gstate)

Definition at line 411 of file cairo-gstate.c.

{
    return gstate->line_cap;
}

Here is the caller graph for this function:

cairo_line_join_t _cairo_gstate_get_line_join ( cairo_gstate_t *  gstate)

Definition at line 425 of file cairo-gstate.c.

{
    return gstate->line_join;
}

Here is the caller graph for this function:

double _cairo_gstate_get_line_width ( cairo_gstate_t *  gstate)

Definition at line 397 of file cairo-gstate.c.

{
    return gstate->line_width;
}

Here is the caller graph for this function:

void _cairo_gstate_get_matrix ( cairo_gstate_t *  gstate,
cairo_matrix_t matrix 
)

Definition at line 521 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

double _cairo_gstate_get_miter_limit ( cairo_gstate_t *  gstate)

Definition at line 489 of file cairo-gstate.c.

{
    return gstate->miter_limit;
}

Here is the caller graph for this function:

cairo_operator_t _cairo_gstate_get_operator ( cairo_gstate_t *  gstate)

Definition at line 355 of file cairo-gstate.c.

{
    return gstate->operator;
}

Here is the caller graph for this function:

cairo_pattern_t* _cairo_gstate_get_source ( cairo_gstate_t *  gstate)

Definition at line 338 of file cairo-gstate.c.

{
    if (gstate == NULL)
       return NULL;

    return gstate->source;
}

Here is the caller graph for this function:

cairo_surface_t* _cairo_gstate_get_target ( cairo_gstate_t *  gstate)

Definition at line 317 of file cairo-gstate.c.

{
    return gstate->target;
}

Here is the caller graph for this function:

double _cairo_gstate_get_tolerance ( cairo_gstate_t *  gstate)

Definition at line 369 of file cairo-gstate.c.

{
    return gstate->tolerance;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_glyph_extents ( cairo_gstate_t *  gstate,
cairo_glyph_t glyphs,
int  num_glyphs,
cairo_text_extents_t extents 
)

Definition at line 1998 of file cairo-gstate.c.

{
    cairo_status_t status;

    status = _cairo_gstate_ensure_scaled_font (gstate);
    if (status)
       return status;

    cairo_scaled_font_glyph_extents (gstate->scaled_font,
                                 glyphs, num_glyphs,
                                 extents);

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_glyph_path ( cairo_gstate_t *  gstate,
cairo_glyph_t glyphs,
int  num_glyphs,
cairo_path_fixed_t *  path 
)

Definition at line 2146 of file cairo-gstate.c.

{
    cairo_status_t status;
    int i;
    cairo_glyph_t *transformed_glyphs = NULL;

    status = _cairo_gstate_ensure_scaled_font (gstate);
    if (status)
       return status;
    
    transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
    if (transformed_glyphs == NULL)
       return CAIRO_STATUS_NO_MEMORY;
    
    for (i = 0; i < num_glyphs; ++i)
    {
       transformed_glyphs[i] = glyphs[i];
       _cairo_gstate_user_to_backend (gstate,
                                   &(transformed_glyphs[i].x), 
                                   &(transformed_glyphs[i].y));
    }

    status = _cairo_scaled_font_glyph_path (gstate->scaled_font,
                                       transformed_glyphs, num_glyphs,
                                       path);

    free (transformed_glyphs);
    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_identity_matrix ( cairo_gstate_t *  gstate)

Definition at line 617 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_in_fill ( cairo_gstate_t *  gstate,
cairo_path_fixed_t *  path,
double  x,
double  y,
cairo_bool_t inside_ret 
)

Definition at line 1598 of file cairo-gstate.c.

{
    cairo_status_t status = CAIRO_STATUS_SUCCESS;
    cairo_traps_t traps;

    _cairo_gstate_user_to_backend (gstate, &x, &y);

    _cairo_traps_init (&traps);

    status = _cairo_path_fixed_fill_to_traps (path,
                                         gstate->fill_rule,
                                         gstate->tolerance,
                                         &traps);
    if (status)
       goto BAIL;

    *inside_ret = _cairo_traps_contain (&traps, x, y);
    
BAIL:
    _cairo_traps_fini (&traps);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_in_stroke ( cairo_gstate_t *  gstate,
cairo_path_fixed_t *  path,
double  x,
double  y,
cairo_bool_t inside_ret 
)

Definition at line 1223 of file cairo-gstate.c.

{
    cairo_status_t status = CAIRO_STATUS_SUCCESS;
    cairo_traps_t traps;

    _cairo_gstate_user_to_backend (gstate, &x, &y);

    _cairo_pen_init (&gstate->pen_regular, gstate->line_width / 2.0, gstate);

    _cairo_traps_init (&traps);

    status = _cairo_path_fixed_stroke_to_traps (path, gstate, &traps);
    if (status)
       goto BAIL;

    *inside_ret = _cairo_traps_contain (&traps, x, y);

BAIL:
    _cairo_traps_fini (&traps);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_init ( cairo_gstate_t *  gstate,
cairo_surface_t *  target 
) [static]

Definition at line 89 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_init_copy ( cairo_gstate_t *  gstate,
cairo_gstate_t *  other 
) [static]

Definition at line 136 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_gstate_t *next;
    
    /* Copy all members, but don't smash the next pointer */
    next = gstate->next;
    *gstate = *other;
    gstate->next = next;

    /* Now fix up pointer data that needs to be cloned/referenced */
    if (other->dash) {
       gstate->dash = malloc (other->num_dashes * sizeof (double));
       if (gstate->dash == NULL)
           return CAIRO_STATUS_NO_MEMORY;
       memcpy (gstate->dash, other->dash, other->num_dashes * sizeof (double));
    }

    _cairo_clip_init_copy (&gstate->clip, &other->clip);

    if (gstate->font_face)
       cairo_font_face_reference (gstate->font_face);

    if (gstate->scaled_font)
       cairo_scaled_font_reference (gstate->scaled_font);
    
    cairo_surface_reference (gstate->target);

    cairo_pattern_reference (gstate->source);
    
    status = _cairo_pen_init_copy (&gstate->pen_regular, &other->pen_regular);
    if (status)
       goto CLEANUP_FONT;

    return status;

  CLEANUP_FONT:
    cairo_scaled_font_destroy (gstate->scaled_font);
    gstate->scaled_font = NULL;
    
    free (gstate->dash);
    gstate->dash = NULL;

    return CAIRO_STATUS_NO_MEMORY;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_mask ( cairo_gstate_t *  gstate,
cairo_pattern_t *  mask 
)

Definition at line 1155 of file cairo-gstate.c.

{
    cairo_rectangle_t extents;
    cairo_pattern_union_t source_pattern, mask_pattern;
    cairo_status_t status;

    if (mask->status)
       return mask->status;

    if (gstate->source->status)
       return gstate->source->status;

    status = _cairo_surface_set_clip (gstate->target, &gstate->clip);
    if (status)
       return status;

    _cairo_gstate_copy_transformed_source (gstate, &source_pattern.base);
    _cairo_gstate_copy_transformed_mask (gstate, &mask_pattern.base, mask);
    
    _get_mask_extents (gstate, &mask_pattern.base, &extents);
    
    status = _cairo_gstate_clip_and_composite (&gstate->clip, gstate->operator,
                                          &source_pattern.base, 
                                          _cairo_gstate_mask_draw_func, &mask_pattern.base,
                                          gstate->target,
                                          &extents);

    _cairo_pattern_fini (&source_pattern.base);
    _cairo_pattern_fini (&mask_pattern.base);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_mask_draw_func ( void closure,
cairo_operator_t  operator,
cairo_pattern_t *  src,
cairo_surface_t *  dst,
int  dst_x,
int  dst_y,
const cairo_rectangle_t extents 
) [static]

Definition at line 1128 of file cairo-gstate.c.

{
    cairo_pattern_t *mask = closure;

    if (src)
       return _cairo_surface_composite (operator,
                                    src, mask, dst,
                                    extents->x,         extents->y,
                                    extents->x,         extents->y,
                                    extents->x - dst_x, extents->y - dst_y,
                                    extents->width,     extents->height);
    else
       return _cairo_surface_composite (operator,
                                    mask, NULL, dst,
                                    extents->x,         extents->y,
                                    0,                  0, /* unused */
                                    extents->x - dst_x, extents->y - dst_y,
                                    extents->width,     extents->height);
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_paint ( cairo_gstate_t *  gstate)

Definition at line 729 of file cairo-gstate.c.

{
    cairo_rectangle_t rectangle;
    cairo_status_t status;
    cairo_box_t box;
    cairo_traps_t traps;

    if (gstate->source->status)
       return gstate->source->status;

    status = _cairo_surface_set_clip (gstate->target, &gstate->clip);
    if (status)
       return status;

    status = _cairo_surface_get_extents (gstate->target, &rectangle);
    if (status)
       return status;
    status = _cairo_clip_intersect_to_rectangle (&gstate->clip, &rectangle);
    if (status)
       return status;

    box.p1.x = _cairo_fixed_from_int (rectangle.x);
    box.p1.y = _cairo_fixed_from_int (rectangle.y);
    box.p2.x = _cairo_fixed_from_int (rectangle.x + rectangle.width);
    box.p2.y = _cairo_fixed_from_int (rectangle.y + rectangle.height);
    status = _cairo_traps_init_box (&traps, &box);
    if (status)
       return status;
    
    _cairo_gstate_clip_and_composite_trapezoids (gstate, &traps);

    _cairo_traps_fini (&traps);

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_reset_clip ( cairo_gstate_t *  gstate)

Definition at line 1708 of file cairo-gstate.c.

{
    return _cairo_clip_reset (&gstate->clip);
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_rotate ( cairo_gstate_t *  gstate,
double  angle 
)

Definition at line 563 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_scale ( cairo_gstate_t *  gstate,
double  sx,
double  sy 
)

Definition at line 544 of file cairo-gstate.c.

{
    cairo_matrix_t tmp;

    if (sx == 0 || sy == 0)
       return CAIRO_STATUS_INVALID_MATRIX;

    _cairo_gstate_unset_scaled_font (gstate);
    
    cairo_matrix_init_scale (&tmp, sx, sy);
    cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);

    cairo_matrix_init_scale (&tmp, 1/sx, 1/sy);
    cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_select_font_face ( cairo_gstate_t *  gstate,
const char *  family,
cairo_font_slant_t  slant,
cairo_font_weight_t  weight 
)

Definition at line 1731 of file cairo-gstate.c.

{
    cairo_font_face_t *font_face;

    font_face = _cairo_toy_font_face_create (family, slant, weight);
    if (font_face->status)
       return font_face->status;

    _cairo_gstate_set_font_face (gstate, font_face);
    cairo_font_face_destroy (font_face);

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_private cairo_status_t _cairo_gstate_set_antialias ( cairo_gstate_t *  gstate,
cairo_antialias_t  antialias 
)

Definition at line 2180 of file cairo-gstate.c.

{
    gstate->antialias = antialias;

    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_dash ( cairo_gstate_t *  gstate,
double *  dash,
int  num_dashes,
double  offset 
)

Definition at line 431 of file cairo-gstate.c.

{
    int i;
    double dash_total;

    if (gstate->dash)
       free (gstate->dash);
    
    gstate->num_dashes = num_dashes;

    if (gstate->num_dashes == 0) {
       gstate->dash = NULL;
       gstate->dash_offset = 0.0;
       return CAIRO_STATUS_SUCCESS;
    }

    gstate->dash = malloc (gstate->num_dashes * sizeof (double));
    if (gstate->dash == NULL) {
       gstate->num_dashes = 0;
       return CAIRO_STATUS_NO_MEMORY;
    }

    memcpy (gstate->dash, dash, gstate->num_dashes * sizeof (double));
    
    dash_total = 0.0;
    for (i = 0; i < gstate->num_dashes; i++) {
       if (gstate->dash[i] < 0)
           return CAIRO_STATUS_INVALID_DASH;
       dash_total += gstate->dash[i];
    }

    if (dash_total == 0.0)
       return CAIRO_STATUS_INVALID_DASH;

    /* A single dash value indicate symmetric repeating, so the total
     * is twice as long. */
    if (gstate->num_dashes == 1)
       dash_total *= 2;

    /* The dashing code doesn't like a negative offset, so we compute
     * the equivalent positive offset. */
    if (offset < 0)
       offset += ceil (-offset / dash_total + 0.5) * dash_total;

    gstate->dash_offset = offset;

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_fill_rule ( cairo_gstate_t *  gstate,
cairo_fill_rule_t  fill_rule 
)

Definition at line 375 of file cairo-gstate.c.

{
    gstate->fill_rule = fill_rule;

    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_font_face ( cairo_gstate_t *  gstate,
cairo_font_face_t *  font_face 
)

Definition at line 1981 of file cairo-gstate.c.

{
    if (font_face && font_face->status)
       return font_face->status;
    
    if (font_face != gstate->font_face) {
       cairo_font_face_destroy (gstate->font_face);
       gstate->font_face = cairo_font_face_reference (font_face);
    }

    _cairo_gstate_unset_scaled_font (gstate);
    
    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_font_matrix ( cairo_gstate_t *  gstate,
const cairo_matrix_t matrix 
)

Definition at line 1760 of file cairo-gstate.c.

{
    _cairo_gstate_unset_scaled_font (gstate);

    gstate->font_matrix = *matrix;

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_font_options ( cairo_gstate_t *  gstate,
const cairo_font_options_t *  options 
)

Definition at line 1778 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_font_size ( cairo_gstate_t *  gstate,
double  size 
)

Definition at line 1749 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_line_cap ( cairo_gstate_t *  gstate,
cairo_line_cap_t  line_cap 
)

Definition at line 403 of file cairo-gstate.c.

{
    gstate->line_cap = line_cap;

    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_line_join ( cairo_gstate_t *  gstate,
cairo_line_join_t  line_join 
)

Definition at line 417 of file cairo-gstate.c.

{
    gstate->line_join = line_join;

    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_line_width ( cairo_gstate_t *  gstate,
double  width 
)

Definition at line 389 of file cairo-gstate.c.

{
    gstate->line_width = width;

    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_matrix ( cairo_gstate_t *  gstate,
const cairo_matrix_t matrix 
)

Definition at line 596 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_miter_limit ( cairo_gstate_t *  gstate,
double  limit 
)

Definition at line 481 of file cairo-gstate.c.

{
    gstate->miter_limit = limit;

    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_operator ( cairo_gstate_t *  gstate,
cairo_operator_t  operator 
)

Definition at line 347 of file cairo-gstate.c.

{
    gstate->operator = operator;

    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_source ( cairo_gstate_t *  gstate,
cairo_pattern_t *  source 
)

Definition at line 323 of file cairo-gstate.c.

{
    if (source->status)
       return source->status;

    cairo_pattern_reference (source);
    cairo_pattern_destroy (gstate->source);
    gstate->source = source;
    gstate->source_ctm_inverse = gstate->ctm_inverse;
    
    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_set_tolerance ( cairo_gstate_t *  gstate,
double  tolerance 
)

Definition at line 361 of file cairo-gstate.c.

{
    gstate->tolerance = tolerance;

    return CAIRO_STATUS_SUCCESS;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_show_glyphs ( cairo_gstate_t *  gstate,
cairo_glyph_t glyphs,
int  num_glyphs 
)

Definition at line 2069 of file cairo-gstate.c.

{
    cairo_status_t status;
    int i;
    cairo_glyph_t *transformed_glyphs = NULL;
    cairo_pattern_union_t pattern;
    cairo_box_t bbox;
    cairo_rectangle_t extents;
    cairo_show_glyphs_info_t glyph_info;

    if (gstate->source->status)
       return gstate->source->status;

    status = _cairo_surface_set_clip (gstate->target, &gstate->clip);
    if (status)
       return status;

    status = _cairo_gstate_ensure_scaled_font (gstate);
    if (status)
       return status;
    
    transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
    if (transformed_glyphs == NULL)
       return CAIRO_STATUS_NO_MEMORY;
    
    for (i = 0; i < num_glyphs; ++i)
    {
       transformed_glyphs[i] = glyphs[i];
       _cairo_gstate_user_to_backend (gstate,
                                   &transformed_glyphs[i].x, 
                                   &transformed_glyphs[i].y);
    }

    if (_cairo_operator_bounded (gstate->operator))
    {
       status = _cairo_scaled_font_glyph_bbox (gstate->scaled_font,
                                          transformed_glyphs, num_glyphs, 
                                          &bbox);
       if (status)
           goto CLEANUP_GLYPHS;
       
       _cairo_box_round_to_rectangle (&bbox, &extents);
    }
    else
    {
       status = _cairo_surface_get_extents (gstate->target, &extents);
       if (status)
           goto CLEANUP_GLYPHS;
    }
    
    status = _cairo_clip_intersect_to_rectangle (&gstate->clip, &extents);
    if (status)
       goto CLEANUP_GLYPHS;
    
    _cairo_gstate_copy_transformed_source (gstate, &pattern.base);

    glyph_info.font = gstate->scaled_font;
    glyph_info.glyphs = transformed_glyphs;
    glyph_info.num_glyphs = num_glyphs;
    
    status = _cairo_gstate_clip_and_composite (&gstate->clip, gstate->operator,
                                          &pattern.base,
                                          _cairo_gstate_show_glyphs_draw_func, &glyph_info,
                                          gstate->target,
                                          &extents);

    _cairo_pattern_fini (&pattern.base);
    
 CLEANUP_GLYPHS:
    free (transformed_glyphs);
    
    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _cairo_gstate_show_glyphs_draw_func ( void closure,
cairo_operator_t  operator,
cairo_pattern_t *  src,
cairo_surface_t *  dst,
int  dst_x,
int  dst_y,
const cairo_rectangle_t extents 
) [static]

Definition at line 2023 of file cairo-gstate.c.

{
    cairo_show_glyphs_info_t *glyph_info = closure;
    cairo_pattern_union_t pattern;
    cairo_status_t status;

    /* Modifying the glyph array is fine because we know that this function
     * will be called only once, and we've already made a copy of the
     * glyphs in the wrapper.
     */
    if (dst_x != 0 || dst_y != 0) {
       int i;
       
       for (i = 0; i < glyph_info->num_glyphs; ++i)
       {
           glyph_info->glyphs[i].x -= dst_x;
           glyph_info->glyphs[i].y -= dst_y;
       }
    }

    _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
    if (!src)
       src = &pattern.base;
    
    status = _cairo_scaled_font_show_glyphs (glyph_info->font, 
                                        operator, 
                                        src, dst,
                                        extents->x,         extents->y,
                                        extents->x - dst_x, extents->y - dst_y,
                                        extents->width,     extents->height,
                                        glyph_info->glyphs,
                                        glyph_info->num_glyphs);

    if (src == &pattern.base)
       _cairo_pattern_fini (&pattern.base);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_show_page ( cairo_gstate_t *  gstate)

Definition at line 1633 of file cairo-gstate.c.

{
    return _cairo_surface_show_page (gstate->target);
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_stroke ( cairo_gstate_t *  gstate,
cairo_path_fixed_t *  path 
)

Definition at line 1190 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_traps_t traps;

    if (gstate->source->status)
       return gstate->source->status;

    if (gstate->line_width <= 0.0)
       return CAIRO_STATUS_SUCCESS;

    status = _cairo_surface_set_clip (gstate->target, &gstate->clip);
    if (status)
       return status;

    _cairo_pen_init (&gstate->pen_regular, gstate->line_width / 2.0, gstate);

    _cairo_traps_init (&traps);

    status = _cairo_path_fixed_stroke_to_traps (path, gstate, &traps);
    if (status) {
       _cairo_traps_fini (&traps);
       return status;
    }

    _cairo_gstate_clip_and_composite_trapezoids (gstate, &traps);

    _cairo_traps_fini (&traps);

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_stroke_extents ( cairo_gstate_t *  gstate,
cairo_path_fixed_t *  path,
double *  x1,
double *  y1,
double *  x2,
double *  y2 
)

Definition at line 1639 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_traps_t traps;
    cairo_box_t extents;
  
    _cairo_pen_init (&gstate->pen_regular, gstate->line_width / 2.0, gstate);

    _cairo_traps_init (&traps);
  
    status = _cairo_path_fixed_stroke_to_traps (path, gstate, &traps);
    if (status)
       goto BAIL;

    _cairo_traps_extents (&traps, &extents);

    *x1 = _cairo_fixed_to_double (extents.p1.x);
    *y1 = _cairo_fixed_to_double (extents.p1.y);
    *x2 = _cairo_fixed_to_double (extents.p2.x);
    *y2 = _cairo_fixed_to_double (extents.p2.y);

    _cairo_gstate_backend_to_user (gstate, x1, y1);
    _cairo_gstate_backend_to_user (gstate, x2, y2);
  
BAIL:
    _cairo_traps_fini (&traps);
  
    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_text_to_glyphs ( cairo_gstate_t *  gstate,
const char *  utf8,
double  x,
double  y,
cairo_glyph_t **  glyphs,
int num_glyphs 
)

Definition at line 1945 of file cairo-gstate.c.

{
    cairo_status_t status;
    int i;

    status = _cairo_gstate_ensure_scaled_font (gstate);
    if (status)
       return status;
    
    status = _cairo_scaled_font_text_to_glyphs (gstate->scaled_font, 
                                          utf8, glyphs, num_glyphs);

    if (status || !glyphs || !num_glyphs || !(*glyphs) || !(num_glyphs))
       return status;

    /* The font responded in glyph space, starting from (0,0).  Convert to
       user space by applying the font transform, then add any current point
       offset. */

    for (i = 0; i < *num_glyphs; ++i) {
       cairo_matrix_transform_point (&gstate->font_matrix, 
                                  &((*glyphs)[i].x),
                                  &((*glyphs)[i].y));
       (*glyphs)[i].x += x;
       (*glyphs)[i].y += y;
    }
    
    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_transform ( cairo_gstate_t *  gstate,
const cairo_matrix_t matrix 
)

Definition at line 579 of file cairo-gstate.c.

{
    cairo_matrix_t tmp;

    _cairo_gstate_unset_scaled_font (gstate);
    
    tmp = *matrix;
    cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);

    cairo_matrix_invert (&tmp);
    cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);

    return CAIRO_STATUS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_translate ( cairo_gstate_t *  gstate,
double  tx,
double  ty 
)

Definition at line 528 of file cairo-gstate.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void _cairo_gstate_unset_scaled_font ( cairo_gstate_t *  gstate) [static]

Definition at line 1722 of file cairo-gstate.c.

{
    if (gstate->scaled_font) {
       cairo_scaled_font_destroy (gstate->scaled_font);
       gstate->scaled_font = NULL;
    }
}

Here is the caller graph for this function:

void _cairo_gstate_user_to_backend ( cairo_gstate_t *  gstate,
double *  x,
double *  y 
)

Definition at line 665 of file cairo-gstate.c.

{
    cairo_matrix_transform_point (&gstate->ctm, x, y);
    *x += gstate->target->device_x_offset;
    *y += gstate->target->device_y_offset;
}

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_user_to_device ( cairo_gstate_t *  gstate,
double *  x,
double *  y 
)

Definition at line 631 of file cairo-gstate.c.

Here is the caller graph for this function:

cairo_status_t _cairo_gstate_user_to_device_distance ( cairo_gstate_t *  gstate,
double *  dx,
double *  dy 
)

Definition at line 639 of file cairo-gstate.c.

Here is the caller graph for this function:

_cairo_operator_bounded: : a cairo_operator_t

A bounded operator is one where a source or mask pixel of zero results in no effect on the destination image.

Unbounded operators often require special handling; if you, for example, draw trapezoids with an unbounded operator, the effect extends past the bounding box of the trapezoids.

Return value: TRUE if the operator is bounded

Definition at line 779 of file cairo-gstate.c.

Here is the caller graph for this function:

static int _cairo_rectangle_empty ( const cairo_rectangle_t rect) [static]

Definition at line 1026 of file cairo-gstate.c.

{
    return rect->width == 0 || rect->height == 0;
}

Here is the caller graph for this function:

Definition at line 1274 of file cairo-gstate.c.

{
    int x1, y1, x2, y2;

    x1 = MAX (dest->x, src->x);
    y1 = MAX (dest->y, src->y);
    x2 = MIN (dest->x + dest->width, src->x + src->width);
    y2 = MIN (dest->y + dest->height, src->y + src->height);

    if (x1 >= x2 || y1 >= y2) {
       dest->x = 0;
       dest->y = 0;
       dest->width = 0;
       dest->height = 0;
    } else {
       dest->x = x1;
       dest->y = y1;
       dest->width = x2 - x1;
       dest->height = y2 - y1;
    }  
}

Here is the call graph for this function:

Here is the caller graph for this function:

cairo_status_t _cairo_surface_clip_and_composite_trapezoids ( cairo_pattern_t *  src,
cairo_operator_t  operator,
cairo_surface_t *  dst,
cairo_traps_t traps,
cairo_clip_t *  clip,
cairo_antialias_t  antialias 
)

Definition at line 1394 of file cairo-gstate.c.

{
    cairo_status_t status;
    pixman_region16_t *trap_region;
    pixman_region16_t *clear_region = NULL;
    cairo_rectangle_t extents;
    cairo_composite_traps_info_t traps_info;
    
    if (traps->num_traps == 0)
       return CAIRO_STATUS_SUCCESS;

    status = _cairo_traps_extract_region (traps, &trap_region);
    if (status)
       return status;

    if (_cairo_operator_bounded (operator))
    {
       if (trap_region) {
           status = _cairo_clip_intersect_to_region (clip, trap_region);
           _cairo_region_extents_rectangle (trap_region, &extents);
       } else {
           cairo_box_t trap_extents;
           _cairo_traps_extents (traps, &trap_extents);
           _cairo_box_round_to_rectangle (&trap_extents, &extents);
           status = _cairo_clip_intersect_to_rectangle (clip, &extents);
       }
    }
    else
    {
       status = _cairo_surface_get_extents (dst, &extents);
       if (status)
           return status;
       
       if (trap_region && !clip->surface) {
           /* If we optimize drawing with an unbounded operator to
            * _cairo_surface_fill_rectangles() or to drawing with a
            * clip region, then we have an additional region to clear.
            */
           status = _cairo_surface_get_extents (dst, &extents);
           if (status)
              return status;
           
           clear_region = _cairo_region_create_from_rectangle (&extents);
           status = _cairo_clip_intersect_to_region (clip, clear_region);
           if (status)
              return status;
           
           _cairo_region_extents_rectangle (clear_region,  &extents);
           
           if (pixman_region_subtract (clear_region, clear_region, trap_region) != PIXMAN_REGION_STATUS_SUCCESS)
              return CAIRO_STATUS_NO_MEMORY;
           
           if (!pixman_region_not_empty (clear_region)) {
              pixman_region_destroy (clear_region);
              clear_region = NULL;
           }
       } else {
           status = _cairo_clip_intersect_to_rectangle (clip, &extents);
           if (status)
              return status;
       }
    }
       
    if (status)
       goto out;
    
    if (trap_region)
    {
       if ((src->type == CAIRO_PATTERN_SOLID || operator == CAIRO_OPERATOR_CLEAR) &&
           !clip->surface)
       {
           const cairo_color_t *color;

           if (operator == CAIRO_OPERATOR_CLEAR)
              color = CAIRO_COLOR_TRANSPARENT;
           else
              color = &((cairo_solid_pattern_t *)src)->color;
         
           /* Solid rectangles special case */
           status = _cairo_surface_fill_region (dst, operator, color, trap_region);
           if (!status && clear_region)
              status = _cairo_surface_fill_region (dst, CAIRO_OPERATOR_CLEAR,
                                               CAIRO_COLOR_TRANSPARENT,
                                               clear_region);

           goto out;
       }

       if ((_cairo_operator_bounded (operator) && operator != CAIRO_OPERATOR_SOURCE) ||
           !clip->surface)
       {
           /* For a simple rectangle, we can just use composite(), for more
            * rectangles, we have to set a clip region. The cost of rasterizing
            * trapezoids is pretty high for most backends currently, so it's
            * worthwhile even if a region is needed.
            *
            * If we have a clip surface, we set it as the mask; this only works
            * for bounded operators other than SOURCE; for unbounded operators,
            * clip and mask cannot be interchanged. For SOURCE, the operator
            * as implemented by the backends is different in it's handling
            * of the mask then what we want.
            *
            * CAIRO_INT_STATUS_UNSUPPORTED will be returned if the region has
            * more than rectangle and the destination doesn't support clip
            * regions. In that case, we fall through.
            */
           status = _composite_trap_region (clip, src, operator, dst,
                                        trap_region, &extents);
           if (status != CAIRO_INT_STATUS_UNSUPPORTED)
           {
              if (!status && clear_region)
                  status = _cairo_surface_fill_region (dst, CAIRO_OPERATOR_CLEAR,
                                                  CAIRO_COLOR_TRANSPARENT,
                                                  clear_region);
              goto out;
           }
       }
    }

    traps_info.traps = traps;
    traps_info.antialias = antialias;

    status = _cairo_gstate_clip_and_composite (clip, operator, src,
                                          _composite_traps_draw_func, &traps_info,
                                          dst, &extents);

 out:
    if (trap_region)
       pixman_region_destroy (trap_region);
    if (clear_region)
       pixman_region_destroy (clear_region);
    
    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _composite_trap_region ( cairo_clip_t *  clip,
cairo_pattern_t *  src,
cairo_operator_t  operator,
cairo_surface_t *  dst,
pixman_region16_t *  trap_region,
cairo_rectangle_t extents 
) [static]

Definition at line 1299 of file cairo-gstate.c.

{
    cairo_status_t status;
    cairo_pattern_union_t solid_pattern;
    cairo_pattern_union_t mask;
    int num_rects = pixman_region_num_rects (trap_region);
    unsigned int clip_serial;

    if (clip->surface && operator == CAIRO_OPERATOR_CLEAR) {
       _cairo_pattern_init_solid (&solid_pattern.solid, CAIRO_COLOR_WHITE);
       src = &solid_pattern.base;
       operator = CAIRO_OPERATOR_DEST_OUT;
    }

    if (num_rects == 0)
       return CAIRO_STATUS_SUCCESS;
    
    if (num_rects > 1) {
       if (clip->mode != CAIRO_CLIP_MODE_REGION)
           return CAIRO_INT_STATUS_UNSUPPORTED;
       
       clip_serial = _cairo_surface_allocate_clip_serial (dst);
       status = _cairo_surface_set_clip_region (dst,
                                           trap_region,
                                           clip_serial);
       if (status)
           return status;
    }
    
    if (clip->surface)
       _cairo_pattern_init_for_surface (&mask.surface, clip->surface);
       
    status = _cairo_surface_composite (operator,
                                   src,
                                   clip->surface ? &mask.base : NULL,
                                   dst,
                                   extents->x, extents->y,
                                   extents->x - (clip->surface ? clip->surface_rect.x : 0),
                                   extents->y - (clip->surface ? clip->surface_rect.y : 0),
                                   extents->x, extents->y,
                                   extents->width, extents->height);

    if (clip->surface)
      _cairo_pattern_fini (&mask.base);

    if (src == &solid_pattern.base)
       _cairo_pattern_fini (&solid_pattern.base);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _composite_traps_draw_func ( void closure,
cairo_operator_t  operator,
cairo_pattern_t *  src,
cairo_surface_t *  dst,
int  dst_x,
int  dst_y,
const cairo_rectangle_t extents 
) [static]

Definition at line 1361 of file cairo-gstate.c.

{
    cairo_composite_traps_info_t *info = closure;
    cairo_pattern_union_t pattern;
    cairo_status_t status;
    
    if (dst_x != 0 || dst_y != 0)
       _cairo_traps_translate (info->traps, - dst_x, - dst_y);

    _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
    if (!src)
       src = &pattern.base;
    
    status = _cairo_surface_composite_trapezoids (operator,
                                            src, dst, info->antialias,
                                            extents->x,         extents->y,
                                            extents->x - dst_x, extents->y - dst_y,
                                            extents->width,     extents->height,
                                            info->traps->traps,
                                            info->traps->num_traps);
    _cairo_pattern_fini (&pattern.base);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _create_composite_mask_pattern ( cairo_surface_pattern_t mask_pattern,
cairo_clip_t *  clip,
cairo_draw_func_t  draw_func,
void draw_closure,
cairo_surface_t *  dst,
const cairo_rectangle_t extents 
) [static]

Definition at line 813 of file cairo-gstate.c.

{
    cairo_surface_t *mask;
    cairo_status_t status;
    
    mask = cairo_surface_create_similar (dst,
                                    CAIRO_CONTENT_ALPHA,
                                    extents->width,
                                    extents->height);
    if (mask->status)
       return CAIRO_STATUS_NO_MEMORY;
    
    status = (*draw_func) (draw_closure, CAIRO_OPERATOR_ADD,
                        NULL, mask,
                        extents->x, extents->y,
                        extents);
    if (status)
       goto CLEANUP_SURFACE;

    if (clip->surface)
       status = _cairo_clip_combine_to_surface (clip, CAIRO_OPERATOR_IN,
                                           mask,
                                           extents->x, extents->y,
                                           extents);
    if (status)
       goto CLEANUP_SURFACE;
    
    _cairo_pattern_init_for_surface (mask_pattern, mask);

 CLEANUP_SURFACE:
    cairo_surface_destroy (mask);

    return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static cairo_status_t _get_mask_extents ( cairo_gstate_t *  gstate,
cairo_pattern_t *  mask,
cairo_rectangle_t extents 
) [static]

Definition at line 1108 of file cairo-gstate.c.

{
    cairo_status_t status;

    /*
     * XXX should take mask extents into account, but
     * that involves checking the transform and
     * _cairo_operator_bounded (operator)...  For now,
     * be lazy and just use the destination extents
     */
    status = _cairo_surface_get_extents (gstate->target, extents);
    if (status)
       return status;

    return _cairo_clip_intersect_to_rectangle (&gstate->clip, extents);
}

Here is the call graph for this function:

Here is the caller graph for this function: