Commit Graph

34 Commits

Author SHA1 Message Date
Julien Cristau
73ff58c119 Remove png file missing from the tarball 2013-07-26 14:36:14 +02:00
Søren Sandmann Pedersen
460faaa411 demos: Add linear-gradient demo program
This program displays a linear gradient from blue to yellow. Due to
limited precision in pixman-gradient-walker.c, it currently has some
ugly artefacts that gives it a 'brushed metal' appearance.

V2: Update .gitignore
2013-03-11 22:40:05 -04:00
Søren Sandmann Pedersen
2156fb51b3 gtk-utils.c: Use cairo in show_image() rather than GdkPixbuf
GdkPixbufs are not premultiplied, so when using them to display pixman
images, there is some unecessary conversions going on: First the image
is converted to non-premultiplied, and then GdkPixbuf premultiplies
before sending the result to the X server. These conversions may cause
the displayed image to not be exactly identical to the original.

This patch just uses a cairo image surface instead, which avoids these
conversions.

Also make the comment about sRGB a little more concise.
2013-02-15 18:57:24 -05:00
Søren Sandmann Pedersen
65fc1adb65 demo/scale: Add a spin button to set the number of subsample bits
For large upscalings the level of subsampling for the filter has a
quite visible effect, so make it settable in the UI so that people can
experiment with various values.
2013-01-27 23:06:28 -05:00
Matt Turner
61dacffaf4 Convert INCLUDES to AM_CPPFLAGS
INCLUDES has been deprecated starting with automake 1.13. Convert all
occurrences with the recommended AM_CPPFLAGS replacement.
2013-01-22 22:08:30 -08:00
Søren Sandmann Pedersen
526dc06e56 demos/radial-test: Add checkerboard to display the alpha channel 2012-12-11 09:05:58 -05:00
Søren Sandmann Pedersen
6402b2aa0c demos/conical-test: Use the draw_checkerboard() utility function
Instead of having its own copy.
2012-12-11 09:05:58 -05:00
Søren Sandmann Pedersen
54aca22058 demos/radial-test: Add zero-radius circles to demonstrate rendering bugs
Add two new gradient columns, one where the start circle is has radius
0 and one where the end circle has radius 0. All the new gradients
except for one are rendered with a bright dot in the middle. In most
but not all cases this is incorrect.

Cc: ranma42@gmail.com
2012-12-11 08:20:45 -05:00
Søren Sandmann Pedersen
4f18ba30ce Add demo program for conical gradients
This new test is derived from radial-test.c and displays conical
gradients at various angles.

It also demonstrates how PIXMAN_REPEAT_NORMAL is supposed to work when
used with a gradient specification where the first stop is not a 0.0:
In this case the gradient is supposed to have a smooth transition from
the last stop back to the first stop with no sharp transitions. It
also shows that the repeat mode is not ignored for conical gradients
as one might be tempted to think.
2012-12-08 10:50:51 -05:00
Søren Sandmann Pedersen
3a98787bdd Add demos/zone_plate.png
The zone plate image is a useful test case for image scalers because
it contains all representable frequencies, so any imperfection in
resampling filters will show up as Moire patterns.

This version is symmetric around the midpoint of the image, so since
rotating it is supposed to be a noop, it can also be used to verify
that the resampling filters don't shift the image.

V2: Run the file through OptiPNG to cut the size in half, as suggested
by Siarhei.
2012-12-08 10:50:51 -05:00
Søren Sandmann Pedersen
97491ed26c demos: Add new demo program, "scale"
This program allows interactively scaling and rotating images with
using various filters and repeat modes. It uses
pixman_filter_create_separate_convolution() to generate the filters.
2012-12-08 10:50:51 -05:00
Søren Sandmann Pedersen
7f5bb22d17 demos/gtk-utils.[ch]: Add pixman_image_from_file()
This function uses GdkPixbuf to load various common formats such as
.png and .jpg into a pixman image.
2012-12-08 10:50:51 -05:00
Siarhei Siamashka
b31a696263 test: Switch to the new PRNG instead of old LCG
Wallclock time for running pixman "make check" (compile time not included):

----------------------------+----------------+-----------------------------+
                            | old PRNG (LCG) |   new PRNG (Bob Jenkins)    |
       Processor type       +----------------+------------+----------------+
                            |    gcc 4.5     |  gcc 4.5   | gcc 4.7 (simd) |
----------------------------+----------------+------------+----------------+
quad Intel Core i7  @2.8GHz |    0m49.494s   |  0m43.722s |    0m37.560s   |
dual ARM Cortex-A15 @1.7GHz |     5m8.465s   |  4m37.375s |    3m45.819s   |
     IBM Cell PPU   @3.2GHz |    23m0.821s   | 20m38.316s |   16m37.513s   |
----------------------------+----------------+------------+----------------+

But some tests got a particularly large boost. For example benchmarking and
profiling blitters-test on Core i7:

=== before ===

$ time ./blitters-test

real    0m10.907s
user    0m55.650s
sys     0m0.000s

  70.45%  blitters-test  blitters-test       [.] create_random_image
  15.81%  blitters-test  blitters-test       [.] compute_crc32_for_image_internal
   2.26%  blitters-test  blitters-test       [.] _pixman_implementation_lookup_composite
   1.07%  blitters-test  libc-2.15.so        [.] _int_free
   0.89%  blitters-test  libc-2.15.so        [.] malloc_consolidate
   0.87%  blitters-test  libc-2.15.so        [.] _int_malloc
   0.75%  blitters-test  blitters-test       [.] combine_conjoint_general_u
   0.61%  blitters-test  blitters-test       [.] combine_disjoint_general_u
   0.40%  blitters-test  blitters-test       [.] test_composite
   0.31%  blitters-test  libc-2.15.so        [.] _int_memalign
   0.31%  blitters-test  blitters-test       [.] _pixman_bits_image_setup_accessors
   0.28%  blitters-test  libc-2.15.so        [.] malloc

=== after ===

$ time ./blitters-test

real    0m3.655s
user    0m20.550s
sys     0m0.000s

  41.77%  blitters-test.n  blitters-test.new  [.] compute_crc32_for_image_internal
  15.77%  blitters-test.n  blitters-test.new  [.] prng_randmemset_r
   6.15%  blitters-test.n  blitters-test.new  [.] _pixman_implementation_lookup_composite
   3.09%  blitters-test.n  libc-2.15.so       [.] _int_free
   2.68%  blitters-test.n  libc-2.15.so       [.] malloc_consolidate
   2.39%  blitters-test.n  libc-2.15.so       [.] _int_malloc
   2.27%  blitters-test.n  blitters-test.new  [.] create_random_image
   2.22%  blitters-test.n  blitters-test.new  [.] combine_conjoint_general_u
   1.52%  blitters-test.n  blitters-test.new  [.] combine_disjoint_general_u
   1.40%  blitters-test.n  blitters-test.new  [.] test_composite
   1.02%  blitters-test.n  blitters-test.new  [.] prng_srand_r
   1.00%  blitters-test.n  blitters-test.new  [.] _pixman_image_validate
   0.96%  blitters-test.n  blitters-test.new  [.] _pixman_bits_image_setup_accessors
   0.90%  blitters-test.n  libc-2.15.so       [.] malloc
2012-12-06 17:20:35 +02:00
Søren Sandmann Pedersen
4760599ff3 Add combiner test
This test runs the new floating point combiners on random input with
divide-by-zero exceptions turned on.

With the floating point combiners the only thing we guarantee is that
divide-by-zero exceptions are not generated, so change
enable_fp_exceptions() to only enable those, and rename accordingly.
2012-10-01 12:56:09 -04:00
Søren Sandmann Pedersen
09cb1ae10b demos: Add srgb_trap_test.c
This demo program composites a bunch of trapezoids side by side with
and without gamma aware compositing.
2012-08-09 11:24:37 -04:00
Søren Sandmann Pedersen
04e878c231 Make show_image() cope with more formats
This makes show_image() deal with more formats than just a8r8g8b8, in
particular, a8r8g8b8_sRGB can now be handled.

Images that are passed to show_image with a format of a8r8g8b8_sRGB
are displayed without modification under the assumption that the
monitor is approximately sRGB.

Images with a format of a8r8g8b8 are also displayed without
modification since many other users of show_image() have been
generating essentially sRGB data with this format. Other formats are
also assumed to be gamma compressed; these are converted to a8r8g8b8
before being displayed.

With these changes, srgb-test.c doesn't need to do its own conversion
anymore.
2012-08-09 11:24:37 -04:00
Antti S. Lankila
a161a6ba23 Add sRGB blending demo program
Simple sRGB color blender test can be used to determine if the sRGB processing
works as expected. It blends alpha ramps of purple and green together such that
at midpoint of image, 50 % blend of both is realized. At that point, sRGB-aware
processing yields a result close to #bbb rather than #888, which is the linear
light blending result.

The demo also contains the sample computation for sRGB premultiplied alpha.
2012-07-30 15:40:16 -04:00
Søren Sandmann Pedersen
74bf5dc2f9 demos: Add parrot.jpg to EXTRA_DIST
Pointed out by Cyril Brulebois.
2012-05-20 13:09:16 -04:00
Søren Sandmann Pedersen
b2c16aaadf demos/Makefile.am: Add parrot.c to EXTRA_DIST
To get 'make distcheck' to pass.
2012-05-15 13:19:19 -04:00
Søren Sandmann Pedersen
87ecec8d72 gtk-utils.c: In pixbuf_from_argb32() use a8r8g8b8_to_rgba_np()
Instead of inlining a copy of that functionality.
2012-04-02 15:25:00 -04:00
Søren Sandmann Pedersen
b16ddf1782 gtk-utils.c: Don't include pixman-private.h
Use pixman_image_get_format() instead of image->bits.format.
2012-04-02 14:59:02 -04:00
Søren Sandmann Pedersen
746291a19e Add the original parrot image.
This is the Parrot image that was downscaled and cropped before being
used in the composite-test.c demo.
2012-03-27 22:04:36 -04:00
Søren Sandmann Pedersen
451b25ae90 composite-test.c: Add a parrot image
Instead of the yellow square, use a parrot as the source image. This
demonstrates the various blend modes much better.

The parrot is a cropped version of finger painting by Rubens LP:

    http://www.flickr.com/photos/dorubens/4030604504/in/set-72157622586088192/

where the background has been removed. Used here under Creative
Commons Attribution. The artist's web site:

     http://www.rubenslp.com.br/
2012-03-27 22:04:32 -04:00
Søren Sandmann Pedersen
3aa45d62e4 composite-test.c: Use similar gradient to the one in the PDF spec. 2012-03-24 16:41:47 -04:00
Søren Sandmann Pedersen
e1b8969e78 demos: Add checkerboard demo
This is a simple demo that displays a checkboard with a projective
transformation.
2012-03-24 16:29:36 -04:00
Søren Sandmann Pedersen
41863fbabb demos: Add quad2quad program
This program can compute the projective transformation that transforms
one quadrilateral into another. The code is basically maxima[1] output
translated into C.

[1] http://maxima.sourceforge.net/
2012-03-24 16:29:27 -04:00
Søren Sandmann Pedersen
d0091a33fc Modify gradient-test to show a bug in NONE processing
This patch modifies demos/gradient-test to display a bug in gradients
with a repeat mode of NONE. With the current gradient code, the left
side will be a solid red (actually an extremely long fade from solid
red to transparent) instead of a sharp transition from red to green.
2012-01-03 11:36:31 -05:00
Andrea Canciani
b31da39f6f demos: Consistently use G_N_ELEMENTS()
Instead of open-coding G_N_ELEMENTS(), just use it.
2011-11-09 09:17:00 +01:00
Benjamin Otte
01c2dcbe69 build: replace @VAR@ with $(VAR) in makefiles 2011-09-28 01:48:02 +02:00
Benjamin Otte
100f16eae9 tests: Add PNG_CFLAGS/LIBS to tests
PNG flags were accidentally included by gdk-pixbuf. This has been fixed
recently, so we need to make sure to include it ourselves.
2011-09-28 01:48:01 +02:00
Søren Sandmann
6aceb767aa demos: Comment out some unused variables 2011-05-31 18:07:34 -04:00
Søren Sandmann Pedersen
b455496890 Offset rendering in pixman_composite_trapezoids() by (x_dst, y_dst)
Previously, this function would do coordinate calculations in such a
way that (x_dst, y_dst) would only affect the alignment of the source
image, but not of the traps, which would always be considered to be in
absolute destination coordinates. This is unlike the
pixman_image_composite() function which also registers the mask to the
destination.

This patch makes it so that traps are also offset by (x_dst, y_dst).

Also add a comment explaining how this function is supposed to
operate, and update tri-test.c and composite-trap-test.c to deal with
the new semantics.
2011-04-18 16:27:29 -04:00
Søren Sandmann Pedersen
0bc03482f1 Add a test program, tri-test
This program tests whether the new triangle support works.
2011-02-18 06:21:31 -05:00
Søren Sandmann Pedersen
7dfe845786 Move all the GTK+ based test programs to a new subdir, "demos"
This separates the test suite from the random gtk+ using test
programs. "demos" is somewhat misleading because the programs there
are not particularly exciting (with the possible exception of
composite-test which shows off all the compositing operators).
2011-02-15 09:25:17 -05:00