Commit Graph

2096 Commits

Author SHA1 Message Date
Søren Sandmann Pedersen
08070759c3 Pre-release version bump to 0.24.2 2012-01-18 15:49:24 -05:00
Søren Sandmann Pedersen
a9b4fa378b Fix bugs with alpha maps
The alpha channel from the alpha map must be inserted as the new alpha
channel when a scanline is fetched from an image. Previously the alpha
map would overwrite the buffer instead. This wasn't caught be the
alpha map test because it would only verify that the resulting alpha
channel was correct, and not pay attention to incorrect color
channels.
2012-01-18 15:37:36 -05:00
Alan Coopersmith
7dd2b8ee7e Make mmx code compatible with Solaris Studio 12.3 compilers
Rearranged some of the existing gcc & Intel compiler checks to allow
easier sharing of common cases among the compilers.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-01-18 15:37:26 -05:00
Søren Sandmann Pedersen
ee500cb2b1 Reject trapezoids where top (botttom) is above (below) the edges
When a trapezoid has a top/bottom that is above/below the left/right
edges, degenerate trapezoids become possible. For example the edge
could be very short and close to horizontal. If the bottom edge is far
below the bottom point of such a short edge, the result is that the
lower right corner of the trapezoid will be extremely far to the left.

This kind of trapezoid causes overflows in the rasterization code, so
change pixman_trapezoid_valid() to reject them.
2012-01-18 15:37:08 -05:00
Søren Sandmann Pedersen
1398a2fae4 Fix some signed overflow bugs
In the macros for the PDF blend modes, two comp1_t variables are
multiplied together and then used as if the result were a
comp4_t. When comp1_t is a uint8_t, this is fine because they are
promoted to int, and the product of two uint8_ts fits in an
int. However, when comp1_t is uint16, the product does not necessarily
fit in an int, so casts are necessary.

Fix for bug 43906, reported by Siarhei Siamashka.
2012-01-18 15:36:50 -05:00
Søren Sandmann Pedersen
419820cce6 pixman-image.c: Fix typo in pixman_image_set_transform()
A parenthesis was misplaced so that the size argument to memcmp() was
always 0. The bug is harmless except that the flags might be
unnecessarily recomputed in some cases.

A bug reporting this in Mozilla's fork was discovered here:

    https://bugzilla.mozilla.org/show_bug.cgi?id=710992
2012-01-18 15:36:34 -05:00
Colin Walters
5bd74a7c96 autogen.sh: Support GNOME Build API
http://people.gnome.org/~walters/docs/build-api.txt
2012-01-18 15:36:22 -05:00
Søren Sandmann Pedersen
dbb6148158 gradient-walker: For NONE repeats, when x < 0 or x > 1, set both colors to 0
ec7c9c2b68 introduced a bug where NONE gradients would be
misrendered, causing the area outside the gradient to be treated as a
(very) long fade to transparent.The problem was that a check for
positions outside the gradients were dropped in favor of relying on
the sentinels.

Aside from misrendering, this also caused a signed integer overflow
when the code would compute a stepper size based on MIN_INT32.

This patches fixes the issue by reinstating a check for these cases
and setting both the right and left colors to transparent black.
2012-01-18 15:36:13 -05:00
Bobby Salazar
b14fd2ad60 Android Runtime Detection Support For ARM NEON
This patch adds runtime detection support for the ARM NEON fast paths
for code compiled with the Android NDK. This is the only code change
needed to enable the ARM NEON pixman fast paths for the ever growing
Android platform (200 million+ smartphones, tablets, etc.). Just make
sure to #define USE_ARM_NEON in your makefile.
2012-01-18 15:35:41 -05:00
Naohiro Aota
3c87d862d9 Don't use non-POSIX test
test "$test_CFLAGS" == "" &&         \

may cause an error on some POSIX shells and uses a style which is not
consistent with the other tests in configure.ac

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=42588 and
https://bugs.gentoo.org/show_bug.cgi?id=387087
2012-01-18 15:35:30 -05:00
Søren Sandmann Pedersen
c19a09b314 Post-release version bump to 0.24.1 2012-01-18 15:35:09 -05:00
Søren Sandmann Pedersen
86ce180882 test: Port composite test over to use new pixel_checker_t object.
Also make some tweaks to the way the errors are printed.
2012-01-10 09:04:45 -05:00
Søren Sandmann Pedersen
f57034f678 test: Add a new "pixel_checker_t" object.
Add a new pixel_checker_t object to test/utils.[ch]. This object
should be initialized with a format and can then be used to check
whether a given "real" pixel in that format is close enough to a
"perfect" pixel given as a double precision ARGB struct.

The acceptable deviation is calcuated as follows. Each channel of the
perfect pixel has 0.004 subtracted from it and is then converted to
the format. The resulting value is the minimum value that will be
accepted. Similarly, to compute the maximum value, the channel has
0.004 added to it and is then converted to the given format. Checking
a pixel is then a matter of splitting it into channels and checking
that each is within the computed bounds.

The value of 0.004 was chosen because it is the minimum one that will
make the existing composite test pass (see next commit). A problem
with this value is that it causes 0xFE to be acceptable when the
correct value is 1.0, and 0x01 to be acceptable when the correct value
is 0. It would be better if, when the result is exactly 0 or exactly
1, an a8r8g8b8 pixel were required to produce exactly 0x00 or 0xff to
preserve full black and full white. A deviation value of 0.003 would
produce this, but currently this would cause tests with operators that
involve divisions to fail.
2012-01-10 09:04:45 -05:00
Søren Sandmann Pedersen
0053a9f869 Rename color_correct() to round_color()
And do the rounding from float to int in the same way cairo does: by
multiplying with (1 << width), then subtracting one when the input was 1.0.
2012-01-10 09:04:45 -05:00
Søren Sandmann Pedersen
55a010bf31 Move the color_correct() function from composite.c to utils.c 2012-01-10 09:04:45 -05:00
Søren Sandmann Pedersen
065666f33c Get rid of delegates for combiners
Add a new function _pixman_implementation_lookup_combiner() that will
find a usable combiner given an operator and information about whether
the combiner should apply component alpha and whether it should be 64
bit.

In pixman-general.c use this function to look up a combiner up front
instead of walking the delegate chain for every scanline.
2012-01-10 09:04:37 -05:00
Søren Sandmann Pedersen
ab584ab500 test/alphamap.c: Make dst and orig_dst more independent of each other
When making the copy of the destination, do so separately for the
image and the alpha map. This ensures that the alpha channel of the
alpha map will be different from the alpha channel of the actual
image.

Previously, orig_dst would be copied onto dst along with its alpha
map, which mean that the alpha map of orig_dst would become the new
alpha channel of *both* dst and dst's alpha map. This meant that test
didn't actually test that the alpha maps alpha channel was actually
fetched.
2012-01-10 09:04:36 -05:00
Søren Sandmann Pedersen
4613f2caac Fix bugs with alpha maps
The alpha channel from the alpha map must be inserted as the new alpha
channel when a scanline is fetched from an image. Previously the alpha
map would overwrite the buffer instead. This wasn't caught be the
alpha map test because it would only verify that the resulting alpha
channel was correct, and not pay attention to incorrect color
channels.
2012-01-10 09:04:36 -05:00
Søren Sandmann Pedersen
8bd63634cd test: In the alphamap test, also test that we get the right red value
There is a bug where the red channel of the alpha map of the
destination image is used instead of the red channel of the
destination image itself.
2012-01-10 09:04:36 -05:00
Alan Coopersmith
007d8b1813 Make mmx code compatible with Solaris Studio 12.3 compilers
Rearranged some of the existing gcc & Intel compiler checks to allow
easier sharing of common cases among the compilers.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-01-09 10:28:23 -08:00
Søren Sandmann Pedersen
3757245586 Fix rounding for DIV_UNc()
We need to compute floor (a/b * 255 + 0.5), not floor (a / b * 255),
so add b/2 to the numerator in the DIV_UNc() macro.
2012-01-09 05:40:34 -05:00
Søren Sandmann Pedersen
2437ae80e5 Reject trapezoids where top (botttom) is above (below) the edges
When a trapezoid has a top/bottom that is above/below the left/right
edges, degenerate trapezoids become possible. For example the edge
could be very short and close to horizontal. If the bottom edge is far
below the bottom point of such a short edge, the result is that the
lower right corner of the trapezoid will be extremely far to the left.

This kind of trapezoid causes overflows in the rasterization code, so
change pixman_trapezoid_valid() to reject them.
2012-01-09 05:40:34 -05:00
Søren Sandmann Pedersen
6a8192b6dd In MUL_UNc() cast to comp2_t
Otherwise, when comp1_t is 16 bits wide, we can end up with a signed
integer overflow.
2012-01-09 05:40:33 -05:00
Søren Sandmann Pedersen
33ac0a9084 Fix a bunch of signed overflow issues
In pixman-fast-path.c: (1 << 31) - 1 causes a signed overflow, so
change to (1U << n) - 1.

In pixman-image.c: The check for whether m10 == -m01 will overflow
when -m01 == INT_MIN. Instead just check whether the variables are 1
and -1.

In pixman-utils.c: When the depth of the topmost channel is 0, we can
end up shifting by 32.

In blitters-test.c: Replicating the mask would end up shifting more
than 32.

In region-contains-test.c: Computing the average of two large integers
could overflow. Instead add half the difference between them to the
first integer.

In stress-test.c: Masking the value in fake_reader() would sometimes
shift by 32. Instead just use the most significant bits instead of
the least significant.

All these issues were found by the IOC tool:

    http://embed.cs.utah.edu/ioc/
2012-01-09 05:40:33 -05:00
Søren Sandmann Pedersen
d788f76278 Add missing cast in _pixman_edge_multi_init()
nx and e->dy are both 32 bit quantities, so a cast is needed to make
sure their product is 64 bit before subtracting it from a 64 bit
quantity.
2012-01-09 05:40:33 -05:00
Søren Sandmann Pedersen
4f3fe9c909 Fix some signed overflow bugs
In the macros for the PDF blend modes, two comp1_t variables are
multiplied together and then used as if the result were a
comp4_t. When comp1_t is a uint8_t, this is fine because they are
promoted to int, and the product of two uint8_ts fits in an
int. However, when comp1_t is uint16, the product does not necessarily
fit in an int, so casts are necessary.

Fix for bug 43906, reported by Siarhei Siamashka.
2012-01-09 05:40:33 -05:00
Søren Sandmann Pedersen
3e93bba3b0 pixman-image.c: Fix typo in pixman_image_set_transform()
A parenthesis was misplaced so that the size argument to memcmp() was
always 0. The bug is harmless except that the flags might be
unnecessarily recomputed in some cases.

A bug reporting this in Mozilla's fork was discovered here:

    https://bugzilla.mozilla.org/show_bug.cgi?id=710992
2012-01-09 05:40:33 -05:00
Colin Walters
ae651e7e73 autogen.sh: Support GNOME Build API
http://people.gnome.org/~walters/docs/build-api.txt
2012-01-05 10:14:52 -05:00
Søren Sandmann Pedersen
89498a1178 gradient-walker: For NONE repeats, when x < 0 or x > 1, set both colors to 0
ec7c9c2b68 introduced a bug where NONE gradients would be
misrendered, causing the area outside the gradient to be treated as a
(very) long fade to transparent.The problem was that a check for
positions outside the gradients were dropped in favor of relying on
the sentinels.

Aside from misrendering, this also caused a signed integer overflow
when the code would compute a stepper size based on MIN_INT32.

This patches fixes the issue by reinstating a check for these cases
and setting both the right and left colors to transparent black.
2012-01-03 11:37:12 -05: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
Søren Sandmann Pedersen
9db9805515 region: Add pixman_region{,32}_clear() functions.
These functions simply reset the region to empty. They are equivalent
to

      pixman_region_fini (&region);
      pixman_region_init (&region);
2011-12-13 14:50:40 -05:00
Bobby Salazar
6b9d6a91ed Android Runtime Detection Support For ARM NEON
This patch adds runtime detection support for the ARM NEON fast paths
for code compiled with the Android NDK. This is the only code change
needed to enable the ARM NEON pixman fast paths for the ever growing
Android platform (200 million+ smartphones, tablets, etc.). Just make
sure to #define USE_ARM_NEON in your makefile.
2011-12-13 02:03:16 -05:00
Naohiro Aota
84450c411c Don't use non-POSIX test
test "$test_CFLAGS" == "" &&         \

may cause an error on some POSIX shells and uses a style which is not
consistent with the other tests in configure.ac

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=42588 and
https://bugs.gentoo.org/show_bug.cgi?id=387087
2011-11-24 14:23:29 +01:00
Andrea Canciani
9985febd78 test: Produce autotools-looking report in the win32 build system
Tweak the commands used to run the tests on win32 to make the output
look mostly like that produced by the autotools test system.

In addition to this, make sure that the exit status of the test target
is success (0) if and only if no failure occurred.
2011-11-09 09:43:06 +01: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
Andrea Canciani
1662c94348 test: Reuse the ARRAY_LENGTH() macro
It is provided by utils.h, there is no need to redefine it.
2011-11-09 09:17:00 +01:00
Andrea Canciani
97b9fa090c Use the ARRAY_LENGTH() macro when possible
This patch has been generated by the following Coccinelle semantic patch:

// Use the ARRAY_LENGTH() macro when possible
//
// Replace open-coded array length computations with the
// ARRAY_LENGTH() macro

@@
type T;
T[] E;
@@
- (sizeof(E)/sizeof(T))
+ ARRAY_LENGTH (E)
2011-11-09 09:17:00 +01:00
Andrea Canciani
06760f5cb0 test: Cleanup includes
All the tests are linked to libutil, hence it makes sence to always
include utils.h and reuse what it provides (config.h inclusion, access
to private pixman APIs, ARRAY_LENGTH, ...).
2011-11-09 09:17:00 +01:00
Andrea Canciani
cbd88a9416 Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic patch:

// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it

@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
-   free (E);
- }
2011-11-09 09:17:00 +01:00
Cyril Brulebois
70dac03d59 Upload to unstable. 2011-11-07 18:13:55 +01:00
Cyril Brulebois
9c9bf5de9c Bump changelogs. 2011-11-07 18:13:36 +01:00
Cyril Brulebois
1e5a59c905 Merge branch 'upstream-unstable' into debian-unstable 2011-11-07 18:12:45 +01:00
Søren Sandmann Pedersen
8d72d35b29 Post-release version bump to 0.25.1 2011-11-06 16:36:01 -05:00
Søren Sandmann Pedersen
973dc7d319 Pre-release version bump to 0.24.0 2011-11-06 16:10:33 -05:00
Alan Coopersmith
6bf590f385 Change MMX ldq_u to return _m64 instead of forcing all callers to cast
Sun/Oracle Studio compilers allow the pointers to be cast, but not the
non-pointer forms, causing pixman compiles to fail with many errors of:
"pixman-mmx.c", line 1411: invalid cast expression

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-04 13:41:30 -07:00
Jeff Muizelaar
5d7f5bc8ee Add definitions of INT64_MIN and INT64_MAX 2011-11-02 18:49:58 -04:00
Cyril Brulebois
afde156de5 Document what happened: pixman went to sid… 2011-11-01 16:06:39 +01:00
Cyril Brulebois
39102f8b3e Upload to experimental. 2011-11-01 12:29:25 +01:00
Cyril Brulebois
bfad5455b6 Bump changelogs. 2011-11-01 12:28:58 +01:00
Cyril Brulebois
eae1bc3667 Merge branch 'upstream-experimental' into debian-experimental 2011-11-01 12:28:26 +01:00