/* * Optimize the current operator based on opacity of source or destination * The output operator should be mathematically equivalent to the source.
*/ static pixman_op_t
optimize_operator (pixman_op_t op,
uint32_t src_flags,
uint32_t mask_flags,
uint32_t dst_flags)
{
pixman_bool_t is_source_opaque, is_dest_opaque;
/* * Computing composite region
*/ staticinline pixman_bool_t
clip_general_image (pixman_region32_t * region,
pixman_region32_t * clip, int dx, int dy)
{ if (pixman_region32_n_rects (region) == 1 &&
pixman_region32_n_rects (clip) == 1)
{
pixman_box32_t * rbox = pixman_region32_rectangles (region, NULL);
pixman_box32_t * cbox = pixman_region32_rectangles (clip, NULL); int v;
if (rbox->x1 < (v = cbox->x1 + dx))
rbox->x1 = v; if (rbox->x2 > (v = cbox->x2 + dx))
rbox->x2 = v; if (rbox->y1 < (v = cbox->y1 + dy))
rbox->y1 = v; if (rbox->y2 > (v = cbox->y2 + dy))
rbox->y2 = v; if (rbox->x1 >= rbox->x2 || rbox->y1 >= rbox->y2)
{
pixman_region32_init (region); returnFALSE;
}
} elseif (pixman_region32_empty (clip))
{ returnFALSE;
} else
{ if (dx || dy)
pixman_region32_translate (region, -dx, -dy);
if (!pixman_region32_intersect (region, region, clip)) returnFALSE;
if (dx || dy)
pixman_region32_translate (region, dx, dy);
}
return pixman_region32_not_empty (region);
}
staticinline pixman_bool_t
clip_source_image (pixman_region32_t * region,
pixman_image_t * image, int dx, int dy)
{ /* Source clips are ignored, unless they are explicitly turned on * and the clip in question was set by an X client. (Because if * the clip was not set by a client, then it is a hierarchy * clip and those should always be ignored for sources).
*/ if (!image->common.clip_sources || !image->common.client_clip) returnTRUE;
/* * returns FALSE if the final region is empty. Indistinguishable from * an allocation failure, but rendering ignores those anyways.
*/
pixman_bool_t
_pixman_compute_composite_region32 (pixman_region32_t * region,
pixman_image_t * src_image,
pixman_image_t * mask_image,
pixman_image_t * dest_image,
int32_t src_x,
int32_t src_y,
int32_t mask_x,
int32_t mask_y,
int32_t dest_x,
int32_t dest_y,
int32_t width,
int32_t height)
{
region->extents.x1 = dest_x;
region->extents.x2 = dest_x + width;
region->extents.y1 = dest_y;
region->extents.y2 = dest_y + height;
region->extents.x1 = MAX (region->extents.x1, 0);
region->extents.y1 = MAX (region->extents.y1, 0);
region->extents.x2 = MIN (region->extents.x2, dest_image->bits.width);
region->extents.y2 = MIN (region->extents.y2, dest_image->bits.height);
/* Some compositing functions walk one step * outside the destination rectangle, so we * check here that the expanded-by-one source * extents in destination space fits in 16 bits
*/ if (!IS_16BIT (extents->x1 - 1) ||
!IS_16BIT (extents->y1 - 1) ||
!IS_16BIT (extents->x2 + 1) ||
!IS_16BIT (extents->y2 + 1))
{ returnFALSE;
}
transform = image->common.transform; if (image->common.type == BITS)
{ /* During repeat mode calculations we might convert the * width/height of an image to fixed 16.16, so we need * them to be smaller than 16 bits.
*/ if (image->bits.width >= 0x7fff || image->bits.height >= 0x7fff) returnFALSE;
/* Check we don't overflow when the destination extents are expanded by one. * This ensures that compositing functions can simply walk the source space * using 16.16 variables without worrying about overflow.
*/
exp_extents = *extents;
exp_extents.x1 -= 1;
exp_extents.y1 -= 1;
exp_extents.x2 += 1;
exp_extents.y2 += 1;
if (!compute_transformed_extents (transform, &exp_extents, &transformed)) returnFALSE;
/* * Work around GCC bug causing crashes in Mozilla with SSE2 * * When using -msse, gcc generates movdqa instructions assuming that * the stack is 16 byte aligned. Unfortunately some applications, such * as Mozilla and Mono, end up aligning the stack to 4 bytes, which * causes the movdqa instructions to fail. * * The __force_align_arg_pointer__ makes gcc generate a prologue that * realigns the stack pointer to 16 bytes. * * On x86-64 this is not necessary because the standard ABI already * calls for a 16 byte aligned stack. * * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
*/ #ifdefined (USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
__attribute__((__force_align_arg_pointer__)) #endif
PIXMAN_EXPORT void
pixman_image_composite32 (pixman_op_t op,
pixman_image_t * src,
pixman_image_t * mask,
pixman_image_t * dest,
int32_t src_x,
int32_t src_y,
int32_t mask_x,
int32_t mask_y,
int32_t dest_x,
int32_t dest_y,
int32_t width,
int32_t height)
{
pixman_format_code_t src_format, mask_format, dest_format;
pixman_region32_t region;
pixman_box32_t extents;
pixman_implementation_t *imp;
pixman_composite_func_t func;
pixman_composite_info_t info; const pixman_box32_t *pbox; int n;
_pixman_image_validate (src); if (mask)
_pixman_image_validate (mask);
_pixman_image_validate (dest);
if (!analyze_extent (mask, &extents, &info.mask_flags)) goto out;
/* If the clip is within the source samples, and the samples are * opaque, then the source is effectively opaque.
*/ #define NEAREST_OPAQUE (FAST_PATH_SAMPLES_OPAQUE | \
FAST_PATH_NEAREST_FILTER | \
FAST_PATH_SAMPLES_COVER_CLIP_NEAREST) #define BILINEAR_OPAQUE (FAST_PATH_SAMPLES_OPAQUE | \
FAST_PATH_BILINEAR_FILTER | \
FAST_PATH_SAMPLES_COVER_CLIP_BILINEAR)
/* * Check if we can replace our operator by a simpler one * if the src or dest are opaque. The output operator should be * mathematically equivalent to the source.
*/
info.op = optimize_operator (op, info.src_flags, info.mask_flags, info.dest_flags);
PIXMAN_EXPORT pixman_bool_t
pixman_blt (uint32_t *src_bits,
uint32_t *dst_bits, int src_stride, int dst_stride, int src_bpp, int dst_bpp, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
{ return _pixman_implementation_blt (get_implementation(),
src_bits, dst_bits, src_stride, dst_stride,
src_bpp, dst_bpp,
src_x, src_y,
dest_x, dest_y,
width, height);
}
PIXMAN_EXPORT pixman_bool_t
pixman_fill (uint32_t *bits, int stride, int bpp, int x, int y, int width, int height,
uint32_t filler)
{ return _pixman_implementation_fill (
get_implementation(), bits, stride, bpp, x, y, width, height, filler);
}
if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_RGBA_FLOAT)
{ returnFALSE;
}
if (!(format == PIXMAN_a8r8g8b8 ||
format == PIXMAN_x8r8g8b8 ||
format == PIXMAN_a8b8g8r8 ||
format == PIXMAN_x8b8g8r8 ||
format == PIXMAN_b8g8r8a8 ||
format == PIXMAN_b8g8r8x8 ||
format == PIXMAN_r8g8b8a8 ||
format == PIXMAN_r8g8b8x8 ||
format == PIXMAN_r5g6b5 ||
format == PIXMAN_b5g6r5 ||
format == PIXMAN_a8 ||
format == PIXMAN_a1))
{ returnFALSE;
}
if (format == PIXMAN_a1)
c = c >> 31; elseif (format == PIXMAN_a8)
c = c >> 24; elseif (format == PIXMAN_r5g6b5 ||
format == PIXMAN_b5g6r5)
c = convert_8888_to_0565 (c);
/** * pixman_version: * * Returns the version of the pixman library encoded in a single * integer as per %PIXMAN_VERSION_ENCODE. The encoding ensures that * later versions compare greater than earlier versions. * * A run-time comparison to check that pixman's version is greater than * or equal to version X.Y.Z could be performed as follows: * * <informalexample><programlisting> * if (pixman_version() >= PIXMAN_VERSION_ENCODE(X,Y,Z)) {...} * </programlisting></informalexample> * * See also pixman_version_string() as well as the compile-time * equivalents %PIXMAN_VERSION and %PIXMAN_VERSION_STRING. * * Return value: the encoded version.
**/
PIXMAN_EXPORT int
pixman_version (void)
{ return PIXMAN_VERSION;
}
/** * pixman_version_string: * * Returns the version of the pixman library as a human-readable string * of the form "X.Y.Z". * * See also pixman_version() as well as the compile-time equivalents * %PIXMAN_VERSION_STRING and %PIXMAN_VERSION. * * Return value: a string containing the version.
**/
PIXMAN_EXPORT constchar*
pixman_version_string (void)
{ return PIXMAN_VERSION_STRING;
}
/** * pixman_format_supported_source: * @format: A pixman_format_code_t format * * Return value: whether the provided format code is a supported * format for a pixman surface used as a source in * rendering. * * Currently, all pixman_format_code_t values are supported.
**/
PIXMAN_EXPORT pixman_bool_t
pixman_format_supported_source (pixman_format_code_t format)
{ switch (format)
{ /* 32 bpp formats */ case PIXMAN_a2b10g10r10: case PIXMAN_x2b10g10r10: case PIXMAN_a2r10g10b10: case PIXMAN_x2r10g10b10: case PIXMAN_a8r8g8b8: case PIXMAN_a8r8g8b8_sRGB: case PIXMAN_r8g8b8_sRGB: case PIXMAN_x8r8g8b8: case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_b8g8r8a8: case PIXMAN_b8g8r8x8: case PIXMAN_r8g8b8a8: case PIXMAN_r8g8b8x8: case PIXMAN_r8g8b8: case PIXMAN_b8g8r8: case PIXMAN_r5g6b5: case PIXMAN_b5g6r5: case PIXMAN_x14r6g6b6: /* 16 bpp formats */ case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5: case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4: case PIXMAN_a4b4g4r4: case PIXMAN_x4b4g4r4: /* 8bpp formats */ case PIXMAN_a8: case PIXMAN_r3g3b2: case PIXMAN_b2g3r3: case PIXMAN_a2r2g2b2: case PIXMAN_a2b2g2r2: case PIXMAN_c8: case PIXMAN_g8: case PIXMAN_x4a4: /* Collides with PIXMAN_c8 case PIXMAN_x4c4:
*/ /* Collides with PIXMAN_g8 case PIXMAN_x4g4:
*/ /* 4bpp formats */ case PIXMAN_a4: case PIXMAN_r1g2b1: case PIXMAN_b1g2r1: case PIXMAN_a1r1g1b1: case PIXMAN_a1b1g1r1: case PIXMAN_c4: case PIXMAN_g4: /* 1bpp formats */ case PIXMAN_a1: case PIXMAN_g1: /* YUV formats */ case PIXMAN_yuy2: case PIXMAN_yv12: returnTRUE;
default: returnFALSE;
}
}
/** * pixman_format_supported_destination: * @format: A pixman_format_code_t format * * Return value: whether the provided format code is a supported * format for a pixman surface used as a destination in * rendering. * * Currently, all pixman_format_code_t values are supported * except for the YUV formats.
**/
PIXMAN_EXPORT pixman_bool_t
pixman_format_supported_destination (pixman_format_code_t format)
{ /* YUV formats cannot be written to at the moment */ if (format == PIXMAN_yuy2 || format == PIXMAN_yv12) returnFALSE;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.