本文整理汇总了C++中pixman_image_create_bits函数的典型用法代码示例。如果您正苦于以下问题:C++ pixman_image_create_bits函数的具体用法?C++ pixman_image_create_bits怎么用?C++ pixman_image_create_bits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pixman_image_create_bits函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: bench_composite
void
bench_composite (const char *testname,
int src_fmt,
int src_flags,
int op,
int mask_fmt,
int mask_flags,
int dst_fmt,
double npix)
{
pixman_image_t * src_img;
pixman_image_t * dst_img;
pixman_image_t * mask_img;
pixman_image_t * xsrc_img;
pixman_image_t * xdst_img;
pixman_image_t * xmask_img;
double t1, t2, t3, pix_cnt;
int64_t n, l1test_width, nlines;
double bytes_per_pix = 0;
pixman_bool_t bench_pixbuf = FALSE;
pixman_composite_func_t func = pixman_image_composite_wrapper;
if (!(src_flags & SOLID_FLAG))
{
bytes_per_pix += (src_fmt >> 24) / 8.0;
src_img = pixman_image_create_bits (src_fmt,
WIDTH, HEIGHT,
src,
WIDTH * 4);
xsrc_img = pixman_image_create_bits (src_fmt,
XWIDTH, XHEIGHT,
src,
XWIDTH * 4);
}
开发者ID:Distrotech,项目名称:pixman,代码行数:35,代码来源:lowlevel-blt-bench.c
示例2: create_image
static pixman_image_t *
create_image (pixman_image_t **clone)
{
pixman_format_code_t format = RANDOM_ELT (formats);
pixman_image_t *image;
int width = prng_rand_n (MAX_WIDTH);
int height = prng_rand_n (MAX_HEIGHT);
int stride = ((width * (PIXMAN_FORMAT_BPP (format) / 8)) + 3) & ~3;
uint32_t *bytes = malloc (stride * height);
prng_randmemset (bytes, stride * height, RANDMEMSET_MORE_00_AND_FF);
image = pixman_image_create_bits (
format, width, height, bytes, stride);
pixman_image_set_destroy_function (image, free_bits, NULL);
assert (image);
if (clone)
{
uint32_t *bytes_dup = malloc (stride * height);
memcpy (bytes_dup, bytes, stride * height);
*clone = pixman_image_create_bits (
format, width, height, bytes_dup, stride);
pixman_image_set_destroy_function (*clone, free_bits, NULL);
}
return image;
}
开发者ID:Distrotech,项目名称:pixman,代码行数:33,代码来源:tolerance-test.c
示例3: main
int
main (int argc, char **argv)
{
uint32_t dst[SIZE];
pixman_image_t *src_img;
pixman_image_t *dst_img;
int i, j, x, y;
int ret = 0;
for (i = 0; i < n_test_cases; ++i)
{
for (j = 0; j < 2; ++j)
{
src_img = pixman_image_create_bits (testcases[i].format,
testcases[i].width,
testcases[i].height,
testcases[i].src,
testcases[i].stride);
pixman_image_set_indexed(src_img, testcases[i].indexed);
dst_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
testcases[i].width,
testcases[i].height,
dst,
testcases[i].width*4);
if (j)
{
pixman_image_set_accessors (src_img, reader, writer);
pixman_image_set_accessors (dst_img, reader, writer);
}
pixman_image_composite (PIXMAN_OP_SRC, src_img, NULL, dst_img,
0, 0, 0, 0, 0, 0, testcases[i].width, testcases[i].height);
pixman_image_unref (src_img);
pixman_image_unref (dst_img);
for (y = 0; y < testcases[i].height; ++y)
{
for (x = 0; x < testcases[i].width; ++x)
{
int offset = y * testcases[i].width + x;
if (dst[offset] != testcases[i].dst[offset])
{
printf ("test %i%c: pixel mismatch at (x=%d,y=%d): %08x expected, %08x obtained\n",
i + 1, 'a' + j,
x, y,
testcases[i].dst[offset], dst[offset]);
ret = 1;
}
}
}
}
}
return ret;
}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:59,代码来源:fetch-test.c
示例4: main
int
main ()
{
int o, s, m, d;
enable_fp_exceptions();
for (o = 0; o < ARRAY_LENGTH (pdf_ops); ++o)
{
pixman_op_t op = pdf_ops[o];
for (s = 0; s < ARRAY_LENGTH (pixels); ++s)
{
pixman_image_t *src;
src = pixman_image_create_bits (
PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[s]), 4);
for (m = -1; m < ARRAY_LENGTH (pixels); ++m)
{
pixman_image_t *msk = NULL;
if (m >= 0)
{
msk = pixman_image_create_bits (
PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[m]), 4);
}
for (d = 0; d < ARRAY_LENGTH (pixels); ++d)
{
pixman_image_t *dst;
uint32_t dp = pixels[d];
dst = pixman_image_create_bits (
PIXMAN_a8r8g8b8, 1, 1, &dp, 4);
pixman_image_composite (op, src, msk, dst,
0, 0, 0, 0, 0, 0, 1, 1);
pixman_image_unref (dst);
}
if (msk)
pixman_image_unref (msk);
}
pixman_image_unref (src);
}
}
return 0;
}
开发者ID:Ashod,项目名称:WinCairoRequirements,代码行数:50,代码来源:pdf-op-test.c
示例5: Transform
static void
Transform(DataSourceSurface* aDest,
DataSourceSurface* aSource,
const gfx3DMatrix& aTransform,
const Point& aDestOffset)
{
IntSize destSize = aDest->GetSize();
pixman_image_t* dest = pixman_image_create_bits(PIXMAN_a8r8g8b8,
destSize.width,
destSize.height,
(uint32_t*)aDest->GetData(),
aDest->Stride());
IntSize srcSize = aSource->GetSize();
pixman_image_t* src = pixman_image_create_bits(PIXMAN_a8r8g8b8,
srcSize.width,
srcSize.height,
(uint32_t*)aSource->GetData(),
aSource->Stride());
MOZ_ASSERT(src !=0 && dest != 0, "Failed to create pixman images?");
pixman_transform pixTransform = Matrix3DToPixman(aTransform);
pixman_transform pixTransformInverted;
// If the transform is singular then nothing would be drawn anyway, return here
if (!pixman_transform_invert(&pixTransformInverted, &pixTransform)) {
pixman_image_unref(dest);
pixman_image_unref(src);
return;
}
pixman_image_set_transform(src, &pixTransformInverted);
pixman_image_composite32(PIXMAN_OP_SRC,
src,
nullptr,
dest,
aDestOffset.x,
aDestOffset.y,
0,
0,
0,
0,
destSize.width,
destSize.height);
pixman_image_unref(dest);
pixman_image_unref(src);
}
开发者ID:hoosteeno,项目名称:gecko-dev,代码行数:49,代码来源:BasicCompositor.cpp
示例6: pixman_image_create_bits
pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
int width)
{
pixman_image_t *image = pixman_image_create_bits(format, width, 1, NULL, 0);
assert(image != NULL);
return image;
}
开发者ID:hwc56,项目名称:qemu-2.3.94,代码行数:7,代码来源:qemu-pixman.c
示例7: pixman_image_create_bits
static XImage *create_temp_image(int screen, int width, int height,
pixman_image_t **pixman_image_out,
XShmSegmentInfo **shminfo_out)
{
XImage *image;
XShmSegmentInfo *shminfo;
RedDrawable::Format format;
pixman_image_t *pixman_image;
XVisualInfo *vinfo;
image = NULL;
shminfo = NULL;
vinfo = XPlatform::get_vinfo()[screen];
format = XPlatform::get_screen_format(screen);
image = XPlatform::create_x_image(format, width, height, vinfo->depth,
vinfo->visual, &shminfo);
pixman_image = pixman_image_create_bits(RedDrawable::format_to_pixman(format),
width, height,
(uint32_t *)image->data, image->bytes_per_line);
if (pixman_image == NULL) {
THROW("surf create failed");
}
*pixman_image_out = pixman_image;
*shminfo_out = shminfo;
return image;
}
开发者ID:SPICEorg,项目名称:spice,代码行数:29,代码来源:red_drawable.cpp
示例8: pixman_renderer_surface_copy_content
static int
pixman_renderer_surface_copy_content(struct weston_surface *surface,
void *target, size_t size,
int src_x, int src_y,
int width, int height)
{
const pixman_format_code_t format = PIXMAN_a8b8g8r8;
const size_t bytespp = 4; /* PIXMAN_a8b8g8r8 */
struct pixman_surface_state *ps = get_surface_state(surface);
pixman_image_t *out_buf;
if (!ps->image)
return -1;
out_buf = pixman_image_create_bits(format, width, height,
target, width * bytespp);
pixman_image_set_transform(ps->image, NULL);
pixman_image_composite32(PIXMAN_OP_SRC,
ps->image, /* src */
NULL, /* mask */
out_buf, /* dest */
src_x, src_y, /* src_x, src_y */
0, 0, /* mask_x, mask_y */
0, 0, /* dest_x, dest_y */
width, height);
pixman_image_unref(out_buf);
return 0;
}
开发者ID:Holusion,项目名称:weston,代码行数:31,代码来源:pixman-renderer.c
示例9: headless_compositor_create_output
static int
headless_compositor_create_output(struct headless_compositor *c,
struct headless_parameters *param)
{
struct headless_output *output;
struct wl_event_loop *loop;
output = zalloc(sizeof *output);
if (output == NULL)
return -1;
output->mode.flags =
WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
output->mode.width = param->width;
output->mode.height = param->height;
output->mode.refresh = 60000;
wl_list_init(&output->base.mode_list);
wl_list_insert(&output->base.mode_list, &output->mode.link);
output->base.current_mode = &output->mode;
weston_output_init(&output->base, &c->base, 0, 0, param->width,
param->height, param->transform, 1);
output->base.make = "weston";
output->base.model = "headless";
loop = wl_display_get_event_loop(c->base.wl_display);
output->finish_frame_timer =
wl_event_loop_add_timer(loop, finish_frame_handler, output);
output->base.start_repaint_loop = headless_output_start_repaint_loop;
output->base.repaint = headless_output_repaint;
output->base.destroy = headless_output_destroy;
output->base.assign_planes = NULL;
output->base.set_backlight = NULL;
output->base.set_dpms = NULL;
output->base.switch_mode = NULL;
if (c->use_pixman) {
output->image_buf = malloc(param->width * param->height * 4);
if (!output->image_buf)
return -1;
output->image = pixman_image_create_bits(PIXMAN_x8r8g8b8,
param->width,
param->height,
output->image_buf,
param->width * 4);
if (pixman_renderer_output_create(&output->base) < 0)
return -1;
pixman_renderer_output_set_buffer(&output->base,
output->image);
}
wl_list_insert(c->base.output_list.prev, &output->base.link);
return 0;
}
开发者ID:ntanibata,项目名称:weston-ivi-shell,代码行数:60,代码来源:compositor-headless.c
示例10: xrdp_server_shared_framebuffer
int xrdp_server_shared_framebuffer(xrdpModule* mod, XRDP_MSG_SHARED_FRAMEBUFFER* msg)
{
mod->framebuffer.fbWidth = msg->width;
mod->framebuffer.fbHeight = msg->height;
mod->framebuffer.fbScanline = msg->scanline;
mod->framebuffer.fbSegmentId = msg->segmentId;
mod->framebuffer.fbBitsPerPixel = msg->bitsPerPixel;
mod->framebuffer.fbBytesPerPixel = msg->bytesPerPixel;
printf("received shared framebuffer message: mod->framebuffer.fbAttached: %d msg->attach: %d\n",
mod->framebuffer.fbAttached, msg->attach);
if (!mod->framebuffer.fbAttached && msg->attach)
{
mod->framebuffer.fbSharedMemory = (BYTE*) shmat(mod->framebuffer.fbSegmentId, 0, 0);
mod->framebuffer.fbAttached = TRUE;
printf("attached segment %d to %p\n",
mod->framebuffer.fbSegmentId, mod->framebuffer.fbSharedMemory);
mod->framebuffer.image = (void*) pixman_image_create_bits(PIXMAN_x8r8g8b8,
mod->framebuffer.fbWidth, mod->framebuffer.fbHeight,
(uint32_t*) mod->framebuffer.fbSharedMemory, mod->framebuffer.fbScanline);
}
if (mod->framebuffer.fbAttached && !msg->attach)
{
shmdt(mod->framebuffer.fbSharedMemory);
mod->framebuffer.fbAttached = FALSE;
mod->framebuffer.fbSharedMemory = 0;
}
return 0;
}
开发者ID:dlinz,项目名称:xrdp-ng,代码行数:34,代码来源:xrdp_module.c
示例11: pixman_image_create_bits
static inline pixman_image_t *__surface_create_stride(pixman_format_code_t format, int width, int height,
int stride)
{
uint8_t *data;
uint8_t *stride_data;
pixman_image_t *surface;
PixmanData *pixman_data;
data = (uint8_t *)spice_malloc_n(abs(stride), height);
if (stride < 0) {
stride_data = data + (-stride) * (height - 1);
} else {
stride_data = data;
}
surface = pixman_image_create_bits(format, width, height, (uint32_t *)stride_data, stride);
if (surface == NULL) {
free(data);
spice_error("create surface failed, out of memory");
}
pixman_data = pixman_image_add_data(surface);
pixman_data->data = data;
pixman_data->format = format;
return surface;
}
开发者ID:elmarco,项目名称:spice-common,代码行数:28,代码来源:canvas_utils.c
示例12: _cairo_image_surface_create_with_pixman_format
cairo_surface_t *
_cairo_image_surface_create_with_pixman_format (unsigned char *data,
pixman_format_code_t pixman_format,
int width,
int height,
int stride)
{
cairo_surface_t *surface;
pixman_image_t *pixman_image;
if (! _cairo_image_surface_is_size_valid (width, height))
{
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
}
pixman_image = pixman_image_create_bits (pixman_format, width, height,
(uint32_t *) data, stride);
if (unlikely (pixman_image == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
surface = _cairo_image_surface_create_for_pixman_image (pixman_image,
pixman_format);
if (unlikely (surface->status)) {
pixman_image_unref (pixman_image);
return surface;
}
/* we can not make any assumptions about the initial state of user data */
surface->is_clear = data == NULL;
return surface;
}
开发者ID:CODECOMMUNITY,项目名称:cairo,代码行数:32,代码来源:cairo-image-surface.c
示例13: pixman_renderer_output_create
WL_EXPORT int
pixman_renderer_output_create(struct weston_output *output)
{
struct pixman_output_state *po = calloc(1, sizeof *po);
int w, h;
if (!po)
return -1;
/* set shadow image transformation */
w = output->current_mode->width;
h = output->current_mode->height;
po->shadow_buffer = malloc(w * h * 4);
if (!po->shadow_buffer) {
free(po);
return -1;
}
po->shadow_image =
pixman_image_create_bits(PIXMAN_x8r8g8b8, w, h,
po->shadow_buffer, w * 4);
if (!po->shadow_image) {
free(po->shadow_buffer);
free(po);
return -1;
}
output->renderer_state = po;
return 0;
}
开发者ID:evil0sheep,项目名称:motorweston,代码行数:34,代码来源:pixman-renderer.c
示例14: create_bits_picture
static pixman_image_t *
create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
{
PixmapPtr pixmap;
FbBits *bits;
FbStride stride;
int bpp;
pixman_image_t *image;
fbGetDrawablePixmap(pict->pDrawable, pixmap, *xoff, *yoff);
fbGetPixmapBitsData(pixmap, bits, stride, bpp);
image = pixman_image_create_bits((pixman_format_code_t) pict->format,
pixmap->drawable.width,
pixmap->drawable.height, (uint32_t *) bits,
stride * sizeof(FbStride));
if (!image)
return NULL;
#ifdef FB_ACCESS_WRAPPER
#if FB_SHIFT==5
pixman_image_set_accessors(image,
(pixman_read_memory_func_t) wfbReadMemory,
(pixman_write_memory_func_t) wfbWriteMemory);
#else
#error The pixman library only works when FbBits is 32 bits wide
#endif
#endif
/* pCompositeClip is undefined for source pictures, so
* only set the clip region for pictures with drawables
*/
if (has_clip) {
if (pict->clientClipType != CT_NONE)
pixman_image_set_has_client_clip(image, TRUE);
if (*xoff || *yoff)
pixman_region_translate(pict->pCompositeClip, *xoff, *yoff);
pixman_image_set_clip_region(image, pict->pCompositeClip);
if (*xoff || *yoff)
pixman_region_translate(pict->pCompositeClip, -*xoff, -*yoff);
}
/* Indexed table */
if (pict->pFormat->index.devPrivate)
pixman_image_set_indexed(image, pict->pFormat->index.devPrivate);
/* Add in drawable origin to position within the image */
*xoff += pict->pDrawable->x;
*yoff += pict->pDrawable->y;
return image;
}
开发者ID:Agnesa,项目名称:xserver,代码行数:60,代码来源:fbpict.c
示例15: process_image_data
static void process_image_data(struct fp_img_dev *dev, char **output, int *output_height)
{
//pixman stuff taken from libfprint/pixman.c, adapted for my purposes.
pixman_image_t *orig, *resized;
pixman_transform_t transform;
struct vfs0050_dev *vfs_dev = dev->priv;
struct vfs0050_line *line, *calibration_line;
char *buf = malloc(vfs_dev->scanbuf_idx);
int lines = vfs_dev->scanbuf_idx / VFS0050_FRAME_SIZE;
int i, x, sum, last_sum, diff;
int new_height;
//just grab one around middle, there should be 100
calibration_line = (struct vfs0050_line *) ((char *) vfs_dev->calbuf + (50 * VFS0050_FRAME_SIZE));
new_height = 0;
for (i = 0; i < lines; i++) {
line = (struct vfs0050_line *) ((char *) vfs_dev->scanbuf + (i * VFS0050_FRAME_SIZE));
if (!is_noise(line))
memcpy(buf + (new_height++ * VFS0050_IMG_WIDTH), line->row, VFS0050_IMG_WIDTH);
else
fp_dbg("removed noise at line: %d\n", i);
}
orig = pixman_image_create_bits(PIXMAN_a8, VFS0050_IMG_WIDTH, new_height, (uint32_t *) buf, VFS0050_IMG_WIDTH);
new_height *= VFS0050_SCALE_FACTOR; //scale for resized image
resized = pixman_image_create_bits(PIXMAN_a8, VFS0050_IMG_WIDTH, new_height, NULL, VFS0050_IMG_WIDTH);
pixman_transform_init_identity(&transform);
pixman_transform_scale(NULL, &transform, pixman_int_to_fixed(1), pixman_double_to_fixed(0.2));
pixman_image_set_transform(orig, &transform);
pixman_image_set_filter(orig, PIXMAN_FILTER_BEST, NULL, 0);
pixman_image_composite32(PIXMAN_OP_SRC,
orig,
NULL,
resized,
0, 0,
0, 0,
0, 0,
VFS0050_IMG_WIDTH, new_height
);
memcpy(buf, pixman_image_get_data(resized), VFS0050_IMG_WIDTH * new_height);
pixman_image_unref(orig);
pixman_image_unref(resized);
*output_height = new_height;
*output = buf;
}
开发者ID:Jack-Q,项目名称:libfprint,代码行数:47,代码来源:vfs0050.c
示例16: load_jpeg
static pixman_image_t *
load_jpeg(FILE *fp)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
pixman_image_t *pixman_image = NULL;
unsigned int i;
int stride, first;
JSAMPLE *data, *rows[4];
jmp_buf env;
cinfo.err = jpeg_std_error(&jerr);
jerr.error_exit = error_exit;
cinfo.client_data = env;
if (setjmp(env))
return NULL;
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, fp);
jpeg_read_header(&cinfo, TRUE);
cinfo.out_color_space = JCS_RGB;
jpeg_start_decompress(&cinfo);
stride = cinfo.output_width * 4;
data = malloc(stride * cinfo.output_height);
if (data == NULL) {
fprintf(stderr, "couldn't allocate image data\n");
return NULL;
}
while (cinfo.output_scanline < cinfo.output_height) {
first = cinfo.output_scanline;
for (i = 0; i < ARRAY_LENGTH(rows); i++)
rows[i] = data + (first + i) * stride;
jpeg_read_scanlines(&cinfo, rows, ARRAY_LENGTH(rows));
for (i = 0; first + i < cinfo.output_scanline; i++)
swizzle_row(rows[i], cinfo.output_width);
}
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
pixman_image = pixman_image_create_bits(PIXMAN_a8r8g8b8,
cinfo.output_width,
cinfo.output_height,
(uint32_t *) data, stride);
pixman_image_set_destroy_function(pixman_image,
pixman_image_destroy_func, data);
return pixman_image;
}
开发者ID:abhijitpotnis,项目名称:weston,代码行数:57,代码来源:image-loader.c
示例17: pixman_image_create_bits
pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format,
pixman_image_t *image)
{
return pixman_image_create_bits(format,
pixman_image_get_width(image),
pixman_image_get_height(image),
NULL,
pixman_image_get_stride(image));
}
开发者ID:AmesianX,项目名称:panda,代码行数:9,代码来源:qemu-pixman.c
示例18: main
int
main (int argc, char **argv)
{
#define WIDTH 400
#define HEIGHT 200
int y, x, p;
float alpha;
uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
uint32_t *src1 = malloc (WIDTH * HEIGHT * 4);
pixman_image_t *dest_img, *src1_img;
dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8_sRGB,
WIDTH, HEIGHT,
dest,
WIDTH * 4);
src1_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
WIDTH, HEIGHT,
src1,
WIDTH * 4);
for (y = 0; y < HEIGHT; y ++)
{
p = WIDTH * y;
for (x = 0; x < WIDTH; x ++)
{
alpha = (float) x / WIDTH;
src1[p + x] = linear_argb_to_premult_argb (alpha, 1, 0, 1);
dest[p + x] = linear_argb_to_premult_srgb_argb (1-alpha, 0, 1, 0);
}
}
pixman_image_composite (PIXMAN_OP_ADD, src1_img, NULL, dest_img,
0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
pixman_image_unref (src1_img);
free (src1);
show_image (dest_img);
pixman_image_unref (dest_img);
free (dest);
return 0;
}
开发者ID:AhmadQasim,项目名称:GPU-Virtualization,代码行数:43,代码来源:srgb-test.c
示例19: main
int
main ()
{
static const pixman_point_fixed_t inner = { 0x0000, 0x0000 };
static const pixman_point_fixed_t outer = { 0x0000, 0x0000 };
static const pixman_fixed_t r_inner = 0;
static const pixman_fixed_t r_outer = 64 << 16;
static const pixman_gradient_stop_t stops[] = {
{ 0x00000, { 0x6666, 0x6666, 0x6666, 0xffff } },
{ 0x10000, { 0x0000, 0x0000, 0x0000, 0xffff } }
};
static const pixman_transform_t transform = {
{ { 0x0, 0x26ee, 0x0},
{ 0xffffeeef, 0x0, 0x0},
{ 0x0, 0x0, 0x10000}
}
};
static const pixman_color_t z = { 0x0000, 0x0000, 0x0000, 0x0000 };
pixman_image_t *dest, *radial, *zero;
int i;
double before, after;
dest = pixman_image_create_bits (
PIXMAN_x8r8g8b8, 640, 429, NULL, -1);
zero = pixman_image_create_solid_fill (&z);
radial = pixman_image_create_radial_gradient (
&inner, &outer, r_inner, r_outer, stops, ARRAY_LENGTH (stops));
pixman_image_set_transform (radial, &transform);
pixman_image_set_repeat (radial, PIXMAN_REPEAT_PAD);
#define N_COMPOSITE 500
before = gettime();
for (i = 0; i < N_COMPOSITE; ++i)
{
before -= gettime();
pixman_image_composite (
PIXMAN_OP_SRC, zero, NULL, dest,
0, 0, 0, 0, 0, 0, 640, 429);
before += gettime();
pixman_image_composite32 (
PIXMAN_OP_OVER, radial, NULL, dest,
- 150, -158, 0, 0, 0, 0, 640, 361);
}
after = gettime();
write_png (dest, "radial.png");
printf ("Average time to composite: %f\n", (after - before) / N_COMPOSITE);
return 0;
}
开发者ID:AhmadQasim,项目名称:GPU-Virtualization,代码行数:55,代码来源:radial-perf-test.c
示例20: main
int
main (int argc, char **argv)
{
#define WIDTH 200
#define HEIGHT 200
#define d2f pixman_double_to_fixed
uint32_t *src = malloc (WIDTH * HEIGHT * 4);
uint32_t *mask = malloc (WIDTH * HEIGHT * 4);
uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
pixman_fixed_t convolution[] =
{
d2f (3), d2f (3),
d2f (0.5), d2f (0.5), d2f (0.5),
d2f (0.5), d2f (0.5), d2f (0.5),
d2f (0.5), d2f (0.5), d2f (0.5),
};
pixman_image_t *simg, *mimg, *dimg;
int i;
for (i = 0; i < WIDTH * HEIGHT; ++i)
{
src[i] = 0x7f007f00;
mask[i] = (i % 256) * 0x01000000;
dest[i] = 0;
}
simg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, src, WIDTH * 4);
mimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, mask, WIDTH * 4);
dimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
pixman_image_set_filter (mimg, PIXMAN_FILTER_CONVOLUTION,
convolution, 11);
pixman_image_composite (PIXMAN_OP_OVER, simg, mimg, dimg, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
show_image (dimg);
return 0;
}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:42,代码来源:convolution-test.c
注:本文中的pixman_image_create_bits函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论