Commit graph

254 commits

Author SHA1 Message Date
Chris Wilson
5ec27eef95 [pixman] Free the old rects if we fail to allocate new.
During the pixman_op, a complicated dance is performed to handle
enlarging the rectangle array to accommodate the op. One consequence
of this is to, under certain circumstances, replace the current
rectangle array with emptyData and track the old array with oldData.
Hence if we fail to realloc the enlarged array we need to free oldData.
2007-05-03 13:46:25 +01:00
Carl Worth
d89d8e6b45 pixman.h: Add missing definition of WARN_UNUSED_RESULT
This was breaking the build on systems without support for the
__warn_unused_result__ attribute.
2007-04-28 07:45:26 -07:00
Jeff Muizelaar
0a1d2070e2 Fix bugs in fbCompositeSrc_8888x8x8888mmx and fbCompositeSrc_x888x8x8888mmx
And re-enable fbCompositeSrc_8888x8x8888mmx now that it should work.

This gives another little boost to the paint-with-alpha perf test:

image-rgba paint-with-alpha_image_rgba_over-512 11.76 -> 5.20: 1.85x speedup
▉
image-rgb  paint-with-alpha_image_rgba_over-512 11.76 -> 5.26: 1.84x speedup
▉
2007-04-25 16:27:04 -07:00
Carl Worth
fea5336e2d Allow fbCompositeSrc_x888x8x8888mmx when destination has alpha
Previously the check for this optimized function would only allow
the function to be called if the source and destination had
identical formats. But the function doesn't read the destination
alpha (if any) so can be used when it exists as well.

(Thanks to Jeff Muizelaar for pointing out this problem.)
2007-04-25 10:39:19 -07:00
Behdad Esfahbod
2a03895663 [pixman] Fix typo in Makefile.am 2007-04-20 00:55:03 -04:00
Behdad Esfahbod
f56582ef06 Put back __inline definition for MSC compilers, in both cairo and pixman
Apparently it's too much to expect people compiling on windows to fill
in sensible values for config.h... /sigh
2007-04-18 17:55:05 -04:00
Behdad Esfahbod
a54b6ed078 [pixman] Rename icint.h to pixmanint.h 2007-04-18 17:54:57 -04:00
Behdad Esfahbod
d3c7942fb2 [pixman] Mark some small functions that are called per-pixel inline
These uses were introduced in the previous commit.
2007-04-12 14:44:32 -04:00
David Reveman
e3b3d22999 [pixman] Fix fbcompose.c that was broken for some composite operations (#5777) 2007-04-12 14:44:32 -04:00
Chris Wilson
52435e99f3 Move pixman_format_t from heap to stack allocations.
pixman_format_t is a simple structure used in short-term allocations and
suitable for on-stack allocation.

Killing the pixman_format_create()/pixman_format_destroy() pairs avoid
around 6% of the allocations during cairo-perf (e.g. 426,158 allocs out
of a total of 7,063,469).
2007-04-12 00:28:03 +01:00
Chris Wilson
54134dd901 Only enable warn-unused-result for recent gcc
The attribute was introduced with gcc-3.4, but the ability to suppress
warnings from misapplied attributes (-Wno-attributes) was only introduced
later. Without the supression, gcc will emit tens of warnings for each
compilation completely drowning the real errors that the programmer
must see.
2007-04-11 14:39:50 -07:00
Chris Wilson
f53c2b418c _pixman_create_source_image() - check for malloc failure
Fix an unchecked malloc by propagating the NULL pointer up to its callers,
which were already checking for failures.
2007-04-11 14:33:53 -07:00
Chris Wilson
61b8e34613 Unexport fbSolidFillmmx and fbCopyAreammx.
By unexporting these function we have exact control over their call sites
and so can convert the initial guards into asserts which transforms the
two functions to return unconditional success and hence conversion to
void.
2007-04-11 13:06:29 -07:00
Chris Wilson
efee208738 Propagate errors up through pixman_composite_trapezoids()
Change the return type to indicate errors detected during
pixman_composite_trapezoids() and add checking for failures during
region ops.
2007-04-11 13:05:31 -07:00
Chris Wilson
bec097b5e2 Propagate region errors from pixman_color_rects().
Region operations within pixman_color_rects can fail, so cleanup and
propagate.
2007-04-11 13:04:53 -07:00
Chris Wilson
909334ee00 FbClipImage* should check for errors during region operations.
Propagate the error from pixman_region_intersect().
2007-04-11 13:03:38 -07:00
Chris Wilson
5b67efcbd8 Propagate region failures during pixman_image_set_clip_region().
Operating on regions can fail so check the status and return an error,
after any necessary cleanup.
2007-04-11 13:02:56 -07:00
Chris Wilson
46eab95698 Add attribute(warn_unused_result)
This adds a compiler check that the function result is used by the caller
and enables it by default for all cairo_private functions and for public
API that returns a cairo_status_t.

It has been discussed that to extend the warnings to all functions, a
new function type could been introduced to cover static functions:
cairo_static. This has not been done at the present time in order to
minimise the churn and focus on the more common errors.

In order to reduce the warning spew generated by gcc for invalid use of
this attribute, -Wno-attributes is added to CFLAGS. This has the
unfortunate side-effect of masking future warnings for all attributes -
be warned!
2007-04-09 15:01:58 +01:00
Behdad Esfahbod
6f93092217 Rename pixman_region_uninit to pixman_region_fini 2007-04-08 22:03:38 -04:00
Behdad Esfahbod
4f8a04b1c9 [pixman-image] Simply initialization given that there is no clip 2007-04-08 21:55:45 -04:00
Mathias Hasselmann
df9ea31df5 [pixman-region] Separate pixman_region_init
Most of the time pixman_region_init is called without any extents, and
followed by a pixman_region_union_rect, used to used to initialize
rectangular regions. pixman_region_union_rect is not that cheap, but
the sequence is called quite often. So it should be worth introducing
a specialized and fast function for this sequence.

This introduces pixman_region_init_rect.  This new function makes
_cairo_region_init_from_rectangle obsolete.

Also removes the extent argument from pixman_region_init as it was
called with NULL most of the time.  A pixman_region_init_with_extents
is added for the general case.
2007-04-08 21:49:46 -04:00
Mathias Hasselmann
9436959a83 Update function map 2007-04-08 21:36:34 -04:00
Mathias Hasselmann
99f4bfada8 Remove abdoned pixman_region_{create,destroy} 2007-04-08 21:36:06 -04:00
Mathias Hasselmann
4532c023e0 Make clientClip region static, remove abdoned CT_PIXMAP code paths 2007-04-08 21:35:58 -04:00
Mathias Hasselmann
65f269f3a4 Avoid pixman_region_create in pixman_composite{,General} 2007-04-08 21:34:10 -04:00
Mathias Hasselmann
82cc451148 Make clip regions of pixman_image_t static 2007-04-08 21:32:52 -04:00
Mathias Hasselmann
0413715337 Avoid pixman_region_create in pixman_color_rects 2007-04-08 21:27:34 -04:00
Mathias Hasselmann
5a6ca4794b Replace pixman_region_create_simple by pixman_region_init 2007-04-08 21:25:25 -04:00
Mathias Hasselmann
ced7b4a4ab Make pixman_region_{init,uninit} public 2007-04-08 20:38:32 -04:00
Mathias Hasselmann
4d9065fceb Move struct pixman_region16 to pixman.h 2007-04-08 20:38:17 -04:00
Chris Wilson
5c24711ee6 Restore gcov functionality
Add -lgcov to the shared library else the test programs fail to link.
Add a couple of lcov convenience targets to generate the coverage reports.
2007-04-04 10:13:13 +01:00
Behdad Esfahbod
a1287e483c [pixman/src/check-config.sh] Test that all source files #include <config.h>
as their first include.
2007-04-03 20:30:30 -04:00
Behdad Esfahbod
174ebc43fe [pixman] Make sure all source files include config.h
as their first include.
2007-04-03 20:02:48 -04:00
Behdad Esfahbod
313a6f7321 [pixman] Cleanup inline mess (#10150)
Simply use "inline" instead of "INLINE" or "__inline__" and let
configure figure out what to use.
2007-04-03 20:02:10 -04:00
Behdad Esfahbod
0263f18f84 [configure.in] Define PIXMAN_CFLAGS, to pass -fno-strict-aliasing to pixman 2007-03-20 08:50:38 -04:00
Gilles Dauphin
d02aa5b23e Don't use unsupported visibily attribute hidden on Solaris
Thanks to Thomas Klausner for passing the report along.
This fixes the following bug report:

	hidden attribute does not work with Solaris ld
	https://bugs.freedesktop.org/show_bug.cgi?id=10227

And as Behdad points out, an even better fix would be to
move checks for supported visibility attribute to configure.
2007-03-16 10:35:23 -07:00
Carl Worth
fe68e8aa32 Fix gradient walker to not reset needlessly
Previously the gradient walker was doing excessive resets, (such
as on every pixel in constant-colored regions or outside the
gradient with CAIRO_EXTEND_NONE). Don't do that.
2007-03-01 14:55:29 -08:00
Carl Worth
9a5dfe1415 Fix implementation of radial gradients for inner radius != 0
The previous implementation fell apart quite badly when neither radius
value was equal to 0.0. I derived the math from scratch, (much thanks to
Vincent Torri <vtorri@univ-evry.fr> for guiding me to a simpler derivation
than I was doing originally), and it's working much better now without
being any slower, (in fact, cairo-perf shows speedup of 1.05x to 1.58x on
my laptop here).

This work also provides groundwork for defining the behavior of radial
gradients where neither circle is wholly contained within the other, (though
we haven't done that definition yet---it will require a new test case and a
very little bit of work on the implementation).

This is a fix for the following bug report:

	Radial Gradients with nonzero inner radius misplace stops
	https://bugs.freedesktop.org/show_bug.cgi?id=7685
2007-03-01 14:53:48 -08:00
Carl Worth
0439f4c4f7 Rename radial gradient inner/outer to c1/c2
The inner/outer names were totally bogus. It is quite
legitimate to have the first circle's radius be larger than
that of the second.
2007-03-01 13:21:54 -08:00
Dan Amelang
01a133167c Update Win32 makefiles
Since the last time these makefiles were last updated some new source
files have been added and one renamed. In addition, a "clean" rule
needed to be added to the pixman makefile. And the "clean" rule in the
main cairo makefile wasn't working properly for me.
2007-02-13 16:53:12 -08:00
Soren Sandmann Pedersen
908469b5fc Apply patch from Marco Gritti and Jordan Crouse to correctly detect
AMD CPU's. Bug 9615.
2007-02-06 16:37:45 -05:00
Soren Sandmann Pedersen
9d3f537423 Remove left-over assert and some alpha checks from
fbCompositeSrc_8888x0565mmx(). Bug 9893.
2007-02-06 16:27:42 -05:00
David Turner
ae4f37e0a3 fixing gradient repeat mode computations
This fixes the regression of linear gradient as demonstrated
by the recently added linear-gradient-reflect test.
2007-02-02 16:42:43 -08:00
Vladimir Vukicevic
691f9d1c0c [mmx] avoid casts between int32 and __m64 types
The MS compiler doesn't like this; _mm_cvtsi32_si64 and _mm_cvtsi64_si32
must be used.
2007-01-25 12:01:50 -08:00
Behdad Esfahbod
3b7751279c [pixman/src/fbmmx.c] Add comment around M64
/* cast to void* in the middle to shut gcc up warning about
 * "dereferencing type-punned pointers".
 */
2007-01-22 14:42:48 -05:00
Behdad Esfahbod
6aa8e80cc7 [pixman/src/fbmmx.c] Hide "dereferencing type-punned pointer" warnings
The warning happens all the place when the code converts from ullong to __m64.
The way the conversion is done is a C idiom: 1) get a pointer to the value, 2)
convert it to the suitable pointer type for the target, 3) dereference it.
That is "*(__m64*)(&m)" in this case.  This is necessarily (as opposed to just
casting to target type) because the two types may not be "compatible" from the
compiler's point of view.  Example of types that are not compatbile is structs
vs anything.

The "dereferencing type-punned pointer will break strict-aliasing rules" from
gcc exactly means: "some code may be assuming that pointers with different
types do not compare equal (or otherwise share the same target object).  If
you case a pointer to a different type and dereference it, it may happen
here."  However, in our usecase, it's clear that the compiler cannot make any
false assumptions.  So we just go ahead and hide it by using a middle cast to
"void *".  Since the compiler does not many any aliasing assumptions about
generic pointers, it will not warn either. (Though the problems if any, will
still occure.  So this is not an ideal solution to this problem and should be
used very carefully, to no hide useful warnings for when things go loose on
some weird architecture.)

Another solution would have been to use gcc's "may_alias" function attribute,
but trying to define a may_alias version of __m64 hit a bug in gcc.  That is,
try replacing "__m64" with "m64" and define:

  typedef __m64 m64 __attribute__((may_alias));

and see it fail to compile.  This seems to be because of the special vector
type that __m64 has.
2007-01-21 15:06:02 -05:00
Dan Williams
5c2136ea7c Implement pixman fbCompositeSrc_8888x0565mmx
MMX-accelerate for fbCompositeSrc_8888x0565.  Upstream X bug for the
same issue:

http://bugs.freedesktop.org/show_bug.cgi?id=9682
2007-01-17 12:48:51 -08:00
Pavel Roskin
a2ec383ff1 Clean up _fbOnes()
The implementation of _FbOnes in iccolor.c would not work on 64-bit
longs correctly.  Fortunately, it's only used on integers, so make it
explicit in the declaration.

Use an inline function for the gcc builtin implementation to make sure
that it's never used with arguments of incorrect size.

There is no __INT_MIN__ in gcc 4.1.1, but it's not an issue now because
the argument is 32-bit.

Signed-off-by: Pavel Roskin <proski@gnu.org>
2007-01-16 16:38:36 -08:00
Soeren Sandmann
cf1d95e714 Add SRC and IN implementations to avoid CompositeGeneral in some cases hit by PDF rendering
The patch implements a few more operations with special cases MMX
code. On my laptop, applying the patch to cairo speeds up the
benchmark (rendering page 14 of a PDF file[*]) from 20.9 seconds
to 14.9 seconds, which is an improvement of 28.6%.

[*] http://people.redhat.com/jakub/prelink.pdf

This also benefits the recently added unaligned_clip perf case:

image-rgb  unaligned_clip-100 0.11 -> 0.06: 1.65x speedup
▋
image-rgba unaligned_clip-100 0.11 -> 0.06: 1.64x speedup
▋
2007-01-09 15:37:26 -08:00
Alp Toker
caa3c2e1e7 Fix various code/comment typos 2007-01-07 01:35:15 -05:00