summaryrefslogtreecommitdiff
path: root/pixman/pixman-region.c
AgeCommit message (Collapse)AuthorFilesLines
2012-12-20Use more appropriate types and remove a magic constantSiarhei Siamashka1-1/+1
2012-10-11region: Remove overlap argument from pixman_op()Søren Sandmann Pedersen1-37/+14
This is used to compute whether the regions in question overlap, but nothing makes use of this information, so it can be removed.
2012-10-11region: Formatting fixSøren Sandmann Pedersen1-3/+1
The while part of a do/while loop was formatted as if it were a while loop with an empty body. Probably some indent tool misinterpreted the code at some point.
2012-07-08Changed the style of two function headersSebastian Bauer1-7/+7
Declare functions *_inverse() and *_contains_rectangle() in the same way as the other functions are declared. This doesn't imply any semantic changes. It's just a unification of coding styles.
2011-12-13region: Add pixman_region{,32}_clear() functions.Søren Sandmann Pedersen1-0/+10
These functions simply reset the region to empty. They are equivalent to pixman_region_fini (&region); pixman_region_init (&region);
2011-11-09Remove useless checks for NULL before freeingAndrea Canciani1-6/+3
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-08-29Workaround bug in llvm-gccAndrea Canciani1-0/+4
llvm-gcc (shipped in Apple XCode 4.1.1 as the default compiler or in the 2.9 release of LLVM) performs an invalid optimization which unifies the empty_region and the bad_region structures because they have the same content. A bugreport has been filed against Apple Developers Tool for this issue. This commit works around this bug by making one of the two structures volatile, so that it cannot be merged. Fixes region-contains-test.
2011-08-11Use find_box_for_y() in pixman_region_contains_point() tooSøren Sandmann Pedersen1-6/+6
The same binary search from the previous commit can be used in this function too. V2: Remove check from loop that is not needed anymore, pointed out by Andrea Canciani.
2011-08-11Speed up pixman_region{,32}_contains_rectangle()Søren Sandmann Pedersen1-6/+42
When someone selects some text in Firefox under a non-composited X server and initiates a drag, a shaped window is created with a complex shape corresponding to the outline of the text. Then, on every mouse movement pixman_region_contains_rectangle() is called many times on that complicated region. And pixman_region_contains_rectangle() is doing a linear scan through the rectangles in the region, although the scan does exit when it finds the first box that can't possibly intersect the passed-in rectangle. This patch changes the loop so that it uses a binary search to skip boxes that don't overlap the current y position. The performance improvement for the text dragging case is easily noticable. V2: Use the binary search for the "getting up to speed or skippping remainder of band" as well.
2011-01-20The code in 'bitmap_addrect' already assumes non-null 'reg->data'Siarhei Siamashka1-2/+3
So the check of 'reg->data' pointer can be safely removed.
2010-08-24region: Fix pixman_region_translate() clipping bugBenjamin Otte1-21/+21
Fixes the region-translate test case by clipping region translations to the newly defined PIXMAN_REGION_MIN/MAX and using the newly introduced type overflow_int_t to check for the overflow. Also uses INT16_MAX or INT32_MAX for these values instead of relying on the size of short and int types.
2010-05-03Add pixman_region{,32}_intersect_rect()Søren Sandmann Pedersen1-0/+18
2010-03-24Revert "Improve PIXREGION_NIL to return true on degenerated regions."Matthias Hopf1-5/+1
This reverts commit ebba1493136a5a0dd7667073165b2115de203eda. Scheduled for re-discussion after stable 0.18 has been released.
2010-03-24Improve PIXREGION_NIL to return true on degenerated regions.Matthias Hopf1-1/+5
Fixes Novell bug 568811.
2010-02-20Move all code to do debugging spew into pixman-private.Søren Sandmann Pedersen1-72/+26
Rather than the region code having its own little debug system, move all of it into pixman-private where there is already return_if_fail() macros etc. These macros are now enabled in development snapshots and nowhere else. Previously they were never enabled unless you modified the code. At the same time, remove all the asserts from the region code since we can never turn them on anyway, and replace them with critical_if_fail() macros that will print spew to standard error when DEBUG is defined. Finally, also change the debugging spew in pixman-bits-image.c to use return_val_if_fail() instead of its own fprintf().
2010-02-19Add pixman_region{32}_init_from_imageAlexander Larsson1-0/+256
This creates a region from an image in PIXMAN_a1 format.
2010-02-13Turn off asserts in development snapshots (bug 26314).Søren Sandmann Pedersen1-23/+12
There is not much real benefit in having asserts turned on in snapshots because it doesn't lead to any new bug reports, just to people not installing development snapshots since they case X server crashes. So just turn them off. While we are at it, limit the number of messages to stderr to 5 instead of 50.
2010-01-26Make region argument to pixman_region(32)_init_rects() constBenjamin Otte1-1/+1
No indenting of the header to keep git blame working
2009-12-17region: Enable or disable fatal errors and selfchecks based on version numberSøren Sandmann Pedersen1-5/+38
There is a couple of bugs in bugzilla where bugs in the X server triggered asserts in the pixman region code. It is probably better to let the X server survive this. (In fact, I thought I had disabled them for 0.16.0, but apparently not). The patch below uses these rules: - In _stable_ pixman releases, assertions and selfchecks are turned off. Assertions, so that the X server doesn't die. Selfchecks, for performance reasons. - In _unstable_ pixman releases, both assertions and selfcheck are turned on. These releases are what get added to development distributions such as rawhide, so we want as much self-checking as possible. - In _random git checkouts_, assertions are enabled, so that bugs are caught, but selfchecks are disabled so that you can use them for performance work without having to fiddle with turning selfchecks off.
2009-08-08Add a dirty bit to the image struct, and validate before using the image.Søren Sandmann Pedersen1-1/+1
This cuts down the number of property_changed calls significantly.
2009-07-23Don't warn for empty rectangles, only degenerate onesBenjamin Otte1-3/+7
2009-07-21Log errors for invalid rectangles passed to region codeBenjamin Otte1-0/+5
2009-07-21Simplify code that logs errorsBenjamin Otte1-5/+6
2009-07-21Make the text when reporting a broken region more usefulBenjamin Otte1-4/+5
2009-07-21Don't assert when malformed regions are detected.Søren Sandmann Pedersen1-2/+38
Instead print a message to stderr so that it will end up in the X log file.
2009-07-21Add a lot more sanity checks to region codeBenjamin Otte1-13/+15
- Introduce a GOOD_RECT() macro that checks that a pixman_box_t is not empty or degenerate an use it. - Use GOOD_RECT() instead of magic if statements for funtions that take x, y, width, height arguments - Use GOOD_RECT() in _reset(). The checks in the previous code seemed to allow an empty box, but then created a broken region from it. - Add GOOD(region) check at the end of _translate()
2009-07-20Handle degenerate case in pixman_init_extents()Benjamin Otte1-0/+5
Create an empty region instead
2009-07-17Handle degenerate case in pixman_init_rect()Benjamin Otte1-0/+6
Create an empty region in that case.
2009-07-13Reformat and reindent pixman-region.cSøren Sandmann Pedersen1-935/+1229
2009-07-09Fix bug in pixman-region.c where empty regions would not be properly ↵Søren Sandmann Pedersen1-3/+1
initialized. Also add a couple more tests to region-test.c.
2009-07-08Merge branch 'naming'Søren Sandmann Pedersen1-481/+480
2009-07-08Eliminate boxes with x1 > x2 or y1 > y2 in pixman_region_init_rects().Søren Sandmann Pedersen1-2/+2
2009-07-08Rename num_rects back to numRects.Søren Sandmann Pedersen1-104/+104
The name numRects is public API and can't be changed.
2009-07-08Convert CamelCase names to underscore_names.Søren Sandmann Pedersen1-446/+446
s/sizeRI/size_ri/g; s/numRI/num_ri/g; s/RepeatNone/REPEAT_NONE/g; s/fbOver/over/g; s/fbIn/in/g; s/iSrc/src_image/g; s/iMask/mask_image/g; s/iDst/dest_image/g; s/SaDa/Sa.Da/g; s/FbMaskBits/MASK_BITS/g; s/RenderSamplesX/RENDER_SAMPLES_X/g; s/MMXData/mmx_data_t/g; s/RegionInfo/region_info_t/g; s/([^0x])([a-z])([A-Z])/$1$2_\l$3/g; s/([^0x])([A-Z])([A-Z])([a-z])/$1$2_\l$3$4/g; s/([^0x])([A-Z])([a-z]+)_([a-z])/$1\l$2$3_$4/g; s/([a-z])_([A-Z])/$1_\l$2/g; s/su_sE/SuSE/g; s/X_Free86/XFree86/g; s/X_free86/XFree86/g; s/_ULL/ULL/g; s/_uLL/ULL/g; s/U_nc/UNc/g; s/combine ##/combine_ ##/g; s/## U/## _u/g; s/## C/## _c/g; s/UNc_aDD/UNc_ADD/g; s/BLEND_MODE \((.+)\)/BLEND_MODE (\l$1)/g; s/blend_(.+)/blend_\l$1/g; s/AN_ds/ANDs/g; s/O_rs/ORs/g; s/over565/over_565/g; s/8pix/8_pix/g; s/Over565/over_565/g; s/inU/in_u/g; s/inPart/in_part/g; s/inC/in_c/g; s/inreverse/in_reverse/g; s/get_exception_code/GetExceptionCode/g; # GetExceptionCode is WinCE API s/CP_us/CPUs/g; s/authentic_aMD/AuthenticAMD/g; s/op_sR_cx_mAS_kx_dST/op_src_mask_dest/g; s/no_VERBOSE/noVERBOSE/g; s/mc_cormack/McCormack/g; s/r1band/r1_band/g; s/r2band/r2_band/g; s/as GOOD things/as good things/g; s/brokendata/broken_data/g; s/X_render/XRender/g; s/__open_bSD__/__OpenBSD__/g; s/^Quick/quick/g; s/NextRect/next_rect/g; s/RectIn/rect_in/g; s/pboxout/pbox_out/g; s/F_sorted/FSorted/g; s/usse2/u_sse2/g; s/csse2/c_sse2/g; s/cPixelsse2/c_pixel_sse2/g; s/Mask565/mask_565/g; s/565fix_rB/565_fix_rb/g; s/565fix_g/565_fix_g/g; s/565r/565_r/g; s/565g/565_g/g; s/565b/565_b/g; s/uPixelsse2/u_pixel_sse2/g; s/Mask00ff/mask_00ff/g; s/Mask0080/mask_0080/g; s/Mask0101/mask_0101/g; s/Maskffff/mask_ffff/g; s/Maskff000000/mask_ff000000/g; s/load128Aligned/load_128_aligned/g; s/load128Unaligned/load_128_unaligned/g; s/save128Aligned/save_128_aligned/g; s/save128Unaligned/save_128_unaligned/g; s/fillsse2/fill_sse2/g; s/unpack565/unpack_565/g; s/pack565/pack_565/g; s/bltsse2/blt_sse2/g; s/x565Unpack/x565_unpack/g; s/r1End/r1_end/g; s/r2End/r2_end/g; s/argb8Pixels/argb8_pixels/g;
2009-07-08Uppercase some more macro namesSøren Sandmann Pedersen1-22/+22
2009-07-08Change some macro names to be all uppercaseSøren Sandmann Pedersen1-53/+52
2009-07-08Fix some more pFoo namesSøren Sandmann Pedersen1-38/+38
s/([^a-z])pReg/$1region/g; s/([^a-z])pY/$1y_line/g; s/([^a-z])pU/$1u_line/g; s/([^a-z])pV/$1v_line/g; s/([^a-z])p([A-Z])/$1\l$2/g;
2009-07-08Get rid of pFoo names.Søren Sandmann Pedersen1-24/+24
s/([^o])pSrc/$1src_image/g; s/([^o])pDst/$1dst_image/g; s/([^o])pMask/$1mask_image/g; s/pRegion/region/g; s/pNextRect/next_rect/g;
2009-07-08Eliminate empty rectangles in pixman_region_init_rects().Søren Sandmann Pedersen1-3/+47
Otherwise they show up in the validated regions.
2009-07-04Inlucde pixman-private.h in pixman-region.cSøren Sandmann Pedersen1-14/+1
Delete some duplicated macros.
2009-06-19Get rid of pixman_region_internal_set_static_pointers()Søren Sandmann Pedersen1-18/+0
Instead just define the function in pixman-region16.c
2009-03-17Check for allocation errors during pixman_op()Chris Wilson1-7/+24
Propagate the error returns from pixman_rect_alloc().
2008-12-20Allocate initial array of RegionInfo on the stack.Chris Wilson1-9/+18
The region validate() code is frequently called by cairo as it is used to extract regions from the trapezoids for fast-paths through the drawing code and also for fast-path clipping and the RegionInfo allocation (as well as the pixman_rect_alloc during the final union) appears as a hot spot on application memory profiles.
2008-09-18Inline fetch functions in pixman-transformed.cSøren Sandmann Pedersen1-2/+7
There was significant performance overhead associated with indirect call to the fetch functions, so inline them. Also, the old code assumed that if the number of rectangles in the source clip was 1, then the clip was identical to the image boundaries. Fix that by running a full region_contains_point() whenever the source clip is different from pict->common.full_region. Based on a patch from Antoine Azar.
2008-06-27Unexport or delete various functionsSøren Sandmann1-117/+4
- Delete pixman_region_append() - Delete pixman_region_empty() - Make pixman_region_validate() static and don't export it. Reported by Julien Cristau.
2008-06-27Only export the 16 bit version of pixman_region_set_static_pointers()Søren Sandmann1-4/+4
2008-06-09Add PIXMAN_EXPORT for pixman_region_equalJulien Cristau1-1/+1
This used to be exported, so removing the export broke ABI.
2008-06-09Fix uses of short variables in pixman-region.cSøren Sandmann1-12/+12
2008-06-08Use 32 bit regions internallySøren Sandmann1-8/+2
2008-06-08Move PIXMAN_EXPORT into pixman-region.cSøren Sandmann1-25/+25