Commit Graph

32 Commits

Author SHA1 Message Date
Søren Sandmann Pedersen
6a6c8c51ed pixman_composite_trapezoids(): Check for NULL return from create_bits()
A check is needed that the creation of the temporary image in
pixman_composite_trapezoids() succeeds.

Fixes crash in stress-test -s 0x313c on my system.
2012-12-13 16:13:11 -05:00
Søren Sandmann Pedersen
c2cb303d33 pixman_composite_trapezoids: Return early if mask_format is not of TYPE_ALPHA
stress-test -s 0x17ee crashes because pixman_composite_trapezoids() is
given a mask_format of PIXMAN_c8, which causes it to create a
temporary image with that format but without a palette. This causes
crashes later.

The only mask_format that we actually support are those of TYPE_ALPHA,
so this patch add a return_if_fail() to ensure this.

Similarly, although currently it won't crash if given an invalid
format, alpha-only formats have always been the only thing that made
sense for the pixman_rasterize_edges() functions, so add a
return_if_fail() ensuring that the destination format is of type
PIXMAN_TYPE_ALPHA.
2012-12-13 16:10:41 -05:00
Søren Sandmann Pedersen
31e5a0a393 pixman_composite_trapezoids(): don't clip to extents for some operators
pixman_composite_trapezoids() is supposed to composite across the
entire destination, but it actually only composites across the extent
of the trapezoids. For operators such as ADD or OVER this doesn't
matter since a zero source has no effect on the destination. But for
operators such as SRC or IN, it does matter.

So for such operators where a zero source has an effect, don't clip to
the trap extents.
2012-10-21 04:13:36 -04:00
Søren Sandmann Pedersen
65db2362e2 pixman_composite_trapezoids(): Factor out extents computation
The computation of the extents rectangle is moved to its own
function.
2012-10-21 04:13:36 -04:00
Søren Sandmann Pedersen
2e17b6dd4e Make pixman.h more const-correct
Add const to pointer arguments when the function doesn't change the
pointed-to data.

Also in add_glyphs() in pixman-glyph.c make 'white' in add_glyphs()
static and const.
2012-10-01 12:52:58 -04: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
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
3598ec26ec Add new public function pixman_add_triangles()
This allows some more code to be deleted from the X server. The
implementation consists of converting to trapezoids, and is shared
with pixman_composite_triangles().
2011-02-18 06:21:37 -05:00
Søren Sandmann Pedersen
964c7e7cd2 Optimize adding opaque trapezoids onto a8 destination.
When the source is opaque and the destination is alpha only, we can
avoid the temporary mask and just add the trapezoids directly.
2011-02-18 06:21:37 -05:00
Søren Sandmann Pedersen
79e69aac8c Add support for triangles to pixman.
The Render X extension can draw triangles as well as trapezoids, but
the implementation has always converted them to trapezoids. This patch
moves the X server's triangle conversion code into pixman, where we
can reuse the pixman_composite_trapezoid() code.
2011-02-15 09:25:18 -05:00
Søren Sandmann Pedersen
803272e38c Add pixman_composite_trapezoids().
This function is an implementation of the X server request
Trapezoids. That request is what the X backend of cairo is using all
the time; by moving it into pixman we can hopefully make it faster.
2011-02-15 09:25:18 -05:00
Rolland Dudemaine
fead9eb82a Fix "variable was set but never used" warnings
Removes useless variable declarations. This can only result in more
efficient code, as these variables where sometimes assigned, but
their values were never used.
2011-01-26 15:05:24 +02:00
Søren Sandmann Pedersen
f44431986f Fix rounding of top and bottom coordinates.
The rules for trap rasterization is that coordinates are rounded
towards north-west.

The pixman_sample_ceil() function is used to compute the first
(top-most) sample row included in the trap, so when the input
coordinate is already exactly on a sample row, no rounding should take
place.

On the other hand, pixman_sample_floor() is used to compute the final
(bottom-most) sample row, so if the input is precisely on a sample
row, it needs to be rounded down to the previous row.

This commit fixes the rounding computation. The idea of the
computation is like this:

Floor operation that rounds exact matches down: First subtract
pixman_fixed_e to make sure input already on a sample row gets rounded
down. Then find out how many small steps are between the input and the
first fraction. Then add those small steps to the first fraction.

The ceil operation first adds (small_step + pixman_e), then runs a
floor. This ensures that exact matches are not rounded off.

Based on a patch by M Joonas Pihlaja.
2009-11-17 01:58:01 -05:00
Søren Sandmann Pedersen
7b1df41b61 Add a dirty bit to the image struct, and validate before using the image.
This cuts down the number of property_changed calls significantly.
2009-08-08 16:52:38 -04:00
Søren Sandmann Pedersen
4f369faffa Various minor formatting changes 2009-07-16 09:45:32 -04:00
Søren Sandmann Pedersen
1d52ecbbe0 Reformat and reindent pixman-trap.c 2009-07-13 19:55:34 -04:00
Søren Sandmann Pedersen
233d8907ed Various minor changes
- Add underscores to the pixman_image_get_solid(),
  pixman_image_is_solid(), and pixman_is_opaque() names.

- A number of formatting fixes

- Move debug code to the end of pixman-private.h

- Collect all prototypes for image methods in one place
2009-06-22 06:51:04 -04:00
Søren Sandmann Pedersen
d18722cdb6 Use DIV instead of _div In pixman-trap.c. 2009-06-21 13:29:59 -04:00
Søren Sandmann Pedersen
81d6725f31 Move edge utilities into pixman-trap.c 2009-06-21 13:29:59 -04:00
Søren Sandmann Pedersen
216f46eb7e Remove commented-out fbAddTriangles 2009-06-19 13:07:35 -04:00
Søren Sandmann Pedersen
43f3825660 Remove useless FbBits typedef 2009-06-19 13:04:26 -04:00
Søren Sandmann
703f82cd02 Use 32 bit regions internally 2008-06-08 22:20:44 -04:00
Søren Sandmann
cb7cc369f5 Move all the PIXMAN_EXPORT into .c files 2008-06-08 21:41:54 -04:00
Aaron Plattner
d6143b8634 Get rid of fbPrepareAccess and fbFinishAccess, since the former was unused and neither one did anything anyway. 2008-03-21 17:13:32 -07:00
Kamalneet Singh
29a8ae4185 Fix computation of x_offset in pixman_add_traps. 2008-03-19 10:02:11 -04:00
Vladimir Vukicevic
9a0639650e Remove last CVS $Id$ tags 2008-01-15 13:33:57 -08:00
Vladimir Vukicevic
1b098ede19 [win32] Makefile and compilation fixes for win32 2007-09-06 11:51:55 -07:00
Søren Sandmann
596bd53020 Reset clip regions correctly when NULL is passed 2007-06-14 12:59:15 -04:00
Søren Sandmann
42192ad0fc Don't complain if users try to read non-existing data from images 2007-06-12 23:37:25 -04:00
Søren Sandmann
b6bdd8273c Add pixman_fill_rectangles() 2007-06-12 22:14:32 -04:00
Søren Sandmann
0ab81dc638 Add pixman_add_trapezoids() function 2007-06-12 15:32:27 -04:00
Søren Sandmann
4355cc5c57 Add pixman-trap with the trapezoid rasterization code from the X server.
Add two different trapezoid types that X makes use of.
2007-05-23 16:40:48 -04:00