third_party/cairo/src/cairo-raster-source-pattern.c
cairo_pattern_t *
cairo_pattern_create_raster_source (void *user_data,
				    cairo_content_t content,
				    int width, int height)
{
    cairo_raster_source_pattern_t *pattern;

    CAIRO_MUTEX_INITIALIZE ();

    if (width < 0 || height < 0)
	return _cairo_pattern_create_in_error (CAIRO_STATUS_INVALID_SIZE);

    if (! CAIRO_CONTENT_VALID (content))
	return _cairo_pattern_create_in_error (CAIRO_STATUS_INVALID_CONTENT);

    pattern = calloc (1, sizeof (*pattern));
    if (unlikely (pattern == NULL))
	return _cairo_pattern_create_in_error (CAIRO_STATUS_NO_MEMORY);

    _cairo_pattern_init (&pattern->base,
			 CAIRO_PATTERN_TYPE_RASTER_SOURCE);
    CAIRO_REFERENCE_COUNT_INIT (&pattern->base.ref_count, 1);

    pattern->content = content;

    pattern->extents.x = 0;
    pattern->extents.y = 0;
    pattern->extents.width  = width;
    pattern->extents.height = height;

    pattern->user_data = user_data;

    return &pattern->base;
}
/**
 * cairo_pattern_create_raster_source:
 * @user_data: the user data to be passed to all callbacks
 * @content: content type for the pixel data that will be returned. Knowing
 * the content type ahead of time is used for analysing the operation and
 * picking the appropriate rendering path.
 * @width: maximum size of the sample area
 * @height: maximum size of the sample area
 *
 * Creates a new user pattern for providing pixel data.
 *
 * Use the setter functions to associate callbacks with the returned
 * pattern.  The only mandatory callback is acquire.
 *
 * Return value: a newly created #cairo_pattern_t. Free with
 *  cairo_pattern_destroy() when you are done using it.
 *
 * Since: 1.12
 **/
@user_data: the user data to be passed to all callbacks
@content: content type for the pixel data that will be returned. Knowing
the content type ahead of time is used for analysing the operation and
picking the appropriate rendering path.
@width: maximum size of the sample area
@height: maximum size of the sample area

Creates a new user pattern for providing pixel data.

Use the setter functions to associate callbacks with the returned
pattern.  The only mandatory callback is acquire.

Return value: a newly created #cairo_pattern_t. Free with
cairo_pattern_destroy() when you are done using it.


@user_data : the user data to be passed to all callbacks @content : content type for the pixel data that will be returned . Knowing the content type ahead of time is used for analysing the operation and picking the appropriate rendering path . @width : maximum size of the sample area @height : maximum size of the sample area Creates a new user pattern for providing pixel data . Use the setter functions to associate callbacks with the returned pattern . The only mandatory callback is acquire . Return value : a newly created #cairo_pattern_t . Free with cairo_pattern_destroy () when you are done using it .
cairo_pattern_t *
cairo_pattern_create_raster_source (void *user_data,
				    cairo_content_t content,
				    int width, int height)
{
    cairo_raster_source_pattern_t *pattern;
    CAIRO_MUTEX_INITIALIZE ();
    if (width < 0 || height < 0)
	return _cairo_pattern_create_in_error (CAIRO_STATUS_INVALID_SIZE);
    if (! CAIRO_CONTENT_VALID (content))
	return _cairo_pattern_create_in_error (CAIRO_STATUS_INVALID_CONTENT);
    pattern = calloc (1, sizeof (*pattern));
    if (unlikely (pattern == NULL))
	return _cairo_pattern_create_in_error (CAIRO_STATUS_NO_MEMORY);
    _cairo_pattern_init (&pattern->base,
			 CAIRO_PATTERN_TYPE_RASTER_SOURCE);
    CAIRO_REFERENCE_COUNT_INIT (&pattern->base.ref_count, 1);
    pattern->content = content;
    pattern->extents.x = 0;
    pattern->extents.y = 0;
    pattern->extents.width  = width;
    pattern->extents.height = height;
    pattern->user_data = user_data;
    return &pattern->base;
}
cairo_pattern_t * cairo_pattern_create_raster_source ( void * user_data , cairo_content_t content , int width , int height ) { cairo_raster_source_pattern_t * pattern ; CAIRO_MUTEX_INITIALIZE ( ) ; if ( width < 0 || height < 0 ) return _cairo_pattern_create_in_error ( CAIRO_STATUS_INVALID_SIZE ) ; if ( ! CAIRO_CONTENT_VALID ( content ) ) return _cairo_pattern_create_in_error ( CAIRO_STATUS_INVALID_CONTENT ) ; pattern = calloc ( 1 , sizeof ( * pattern ) ) ; if ( unlikely ( pattern == NULL ) ) return _cairo_pattern_create_in_error ( CAIRO_STATUS_NO_MEMORY ) ; _cairo_pattern_init ( & pattern -> base , CAIRO_PATTERN_TYPE_RASTER_SOURCE ) ; CAIRO_REFERENCE_COUNT_INIT ( & pattern -> base . ref_count , 1 ) ; pattern -> content = content ; pattern -> extents . x = 0 ; pattern -> extents . y = 0 ; pattern -> extents . width = width ; pattern -> extents . height = height ; pattern -> user_data = user_data ; return & pattern -> base ; }
cairo_pattern_create_raster_source:
 @user_data: the user data to be passed to all callbacks
 @content: content type for the pixel data that will be returned.
cairo_pattern_create_raster_source : @user_data : the user data to be passed to all callbacks @content : content type for the pixel data that will be returned .