Hi. I have tested the example code below on Ubuntu 13.10 and 14.04 desktop amd64 on several machines such as laptops and Dell dual XEON multi core with the same trend being very slow on 14.04. I have also asked others to test the behaviour on various installation and they all report the same. I would be very surprised if you don't get the same result on your machine.
Save the code in the file cairotest.c and compile it using this command gcc -Wall -L/usr/lib/x86_64-linux-gnu cairotest.c -lcairo -o cairotest and run it using the command ./cairotest It clip/paint a scaled image onto a cairo surface although the image is emulated as a chunk of memory. If you do not scale, it runs as fast for for both 14.04 and 13.10, but I suspect it uses memcpy internally. #include <stdlib.h> #include <stdio.h> #include <cairo/cairo.h> #include <sys/time.h> int overlay_frame(cairo_t* pCr, u_int8_t* src, int width, int height, double scale_x, double scale_y) { double clip_w = width; double clip_h = height; if (!pCr || !src || !width || !height) return 1; cairo_surface_t* pSurface = cairo_image_surface_create_for_data(src, CAIRO_FORMAT_ARGB32, width, height, width*4); if (!pSurface) { fprintf(stderr, "Failed to allocate memory for frame\n"); return -1; } cairo_save(pCr); if (scale_x != 1.0 || scale_y != 1.0) cairo_scale(pCr, scale_x, scale_y); cairo_rectangle(pCr, 0.0, 0.0, clip_w, clip_h); cairo_clip(pCr); cairo_new_path(pCr); cairo_set_source_surface(pCr, pSurface, 0.0, 0.0); cairo_paint(pCr); if (scale_x != 1.0 || scale_y != 1.0) cairo_scale(pCr, 1/scale_x, 1/scale_y); cairo_reset_clip (pCr); cairo_restore(pCr); if (pSurface) cairo_surface_destroy(pSurface); return 0; } int main(int argc, char *argv[]) { int i = 0; int width =1280; int height = 720; struct timeval start, stop, time; u_int8_t* mixerframe = (u_int8_t*)malloc(width*height*4); u_int8_t* srcframe = (u_int8_t*)malloc(width*height*4); if (!mixerframe || !srcframe) { fprintf(stderr, "Failed to allocate memory for frame\n"); exit (1); } cairo_surface_t* pSurface = cairo_image_surface_create_for_data( mixerframe, CAIRO_FORMAT_ARGB32, width, height, width*4); if (!pSurface) { fprintf(stderr, "Failed to allocate cairo surface\n"); exit (1); } cairo_t* pCr = cairo_create(pSurface); if (!pCr) { fprintf(stderr, "Failed to allocate cairo context\n"); exit (1); } gettimeofday(&start,NULL); for (i=0 ; i < 1000; i++) overlay_frame(pCr, srcframe, width, height, 0.5, 0.5); gettimeofday(&stop,NULL); if (pCr) cairo_destroy(pCr); if (pSurface) cairo_surface_destroy(pSurface); timersub(&stop,&start,&time); fprintf(stdout, "Time spent : %ld.%06ld\n", time.tv_sec, time.tv_usec); return 0; } -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1360606 Title: libcairo.so for Ubuntu 14.04 is dead-slow compared to Ubuntu 13.10 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/1360606/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs