Hello, this is a patch to pixman that optimize the PIXMAN_FILTER_NEAREST + PIXMAN_REPEAT_NORMAL + n_clip == 1 case. It turns out that this case is the fastest one when scaling images with cairo without rotating. On my computer, this speeds up pure non-rotating scales of ARGB surfaces where source is 64x64 and destination size is 1000x1000 from 49.60 ms to 13.20 ms. I have also attached a test program which is supposed to emulate GDK's gdk_pixbuf_color_composite() function with cairo. Using that program the speed up is from 62.08 ms to 31.88 ms. The downside is that the patch 153 lines of code. I think that all cases should be expanded in a similar way. If the for-statement that plot pixels contain an if-statement, then that if-statement should be moved out of the loop if possible. This increases the code size by a lot, but that should be possible to clean up using clever macros. Kind of like how the pixops library does it.
Created attachment 12039 [details] [review] Speed up NEAREST only scaling like 3x
Created attachment 12040 [details] [review] Test program to measure scaling performance with
Somehow this patch fell through the cracks. Sorry about that. These days we do have fast path support for NEAREST scaling, and this patch doesn't really apply anymore, so I'm marking this bug as FIXED.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.