diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-04-08 19:00:27 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-04-08 19:00:27 +0000 |
commit | 92eb2266e0565a53725262a2a704705bfca9bd5b (patch) | |
tree | 37b58f9a16d9a3bd38f43261345af0da362b721d /lib | |
parent | c50bcebc3126035aac42fcef88935f7f77d7e37a (diff) |
Update to pixman 0.10, with one small fix to the sse2 test in configure.ac.
Diffstat (limited to 'lib')
25 files changed, 2521 insertions, 6574 deletions
diff --git a/lib/pixman/ChangeLog b/lib/pixman/ChangeLog index 6c22ff7ed..e69de29bb 100644 --- a/lib/pixman/ChangeLog +++ b/lib/pixman/ChangeLog @@ -1,1184 +0,0 @@ -commit b39ca42fce85248f6c19459388f71bf73a147792 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Wed Oct 24 15:48:45 2007 -0400 - - Bump version number - -commit 28532430efeb4a1aba8f3e30a790531d2a9e1472 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed Oct 17 20:01:27 2007 -0400 - - Only compile with -msse on x86-64. - -commit ab6743b17074dfedffb0ee32fe2e37cad03769bf -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed Oct 17 19:20:55 2007 -0400 - - Make stride signed in various places. This should fix some the - crashers that people have reported in bug 12398. - -commit aca8b610d9ab178fcbcfa4a44d87e52aa7918ea4 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed Oct 17 18:43:13 2007 -0400 - - Remove comma from enumerator list. Bug 12621, reported by Matt Kraai. - -commit 089c3e6ad00105b2f9a1118d15b4f381653ea6ff -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed Oct 17 18:40:28 2007 -0400 - - Add README file based on text from Bjorn Lindquist - -commit 39a67d35f05aa47cf50191e0837a2125593a7bbc -Author: Tilman Sauerbeck <tilman@code-monkey.de> -Date: Sat Sep 29 22:45:42 2007 +0200 - - Fixed the declaration of pixman_image_set_source_clipping(). - -commit 7f820e15070c9b9618d78425b8cb1a4df722eb22 -Author: Chris Wilson <chris@chris-wilson.co.uk> -Date: Thu Sep 27 12:46:46 2007 +0100 - - [pixman-image] [mlk] Free the locally allocated bits. - - If we fail to allocate the image, remember to free the bits if we have - created the buffer on behalf of the caller. - -commit b4f0cc6eeaff8d5ea114734fcfa293fce1904ce4 -Author: Chris Wilson <chris@chris-wilson.co.uk> -Date: Thu Sep 27 12:44:44 2007 +0100 - - [pixman-image] Avoid a potential malloc(0). - - Do not attempt to allocate bits if either the image width or height is - 0 - Cairo has a habit of attempting to create such surfaces when - generating glyphs. The malloc(0) may return a NULL pointer and be treated - as an out-of-memory error. - -commit 958a650b8eb1b61143122c3ad1f9b637b6467984 -Author: Chris Wilson <chris@chris-wilson.co.uk> -Date: Thu Sep 27 12:40:59 2007 +0100 - - [pixman-image] Avoid integer overflow when allocating bits. - - Check for potential overflows at every step of the calculation of the - buffer size required for the pixels. - - (Fixes https://bugs.freedesktop.org/show_bug.cgi?id=11627) - -commit 5b60c91fd6865021aa6027ee65fa8371a4e2d297 -Author: Jeff Muizelaar <jeff@freiheit.infidigm.net> -Date: Thu Sep 20 15:40:17 2007 -0400 - - Fix special case selection when the mask has a transform - - http://gitweb.freedesktop.org/?p=xorg/xserver.git;a=commitdiff;h=c19ece1d8c32dc81740a4036a642661f54064e75 - was a mismerge that avoided setting the maskTransform condition when the mask - has a transform. This allowed a special case routine to be chosen when the - mask had a transform, which is not expected by the special case routines. - -commit 3be35594c99b7abd2af43b66349ca53bfa1462d6 -Author: Carl Worth <cworth@cworth.org> -Date: Tue Sep 11 16:29:06 2007 +0100 - - Fix build breakage when under the influence of USE_MMX - - This was recently broken (dc7c047d1c68f343b66e81d9e79084e4171e2634) when - removing an assignment to noinst_LTLIBRARIES. - -commit dc7c047d1c68f343b66e81d9e79084e4171e2634 -Author: Vladimir Vukicevic <vladimir@pobox.com> -Date: Mon Sep 10 15:20:44 2007 -0700 - - [memlk] don't try to allocate new data for 0-rectangle regions - -commit 1b098ede1938d1225c32cf5639e4c7a891859897 -Author: Vladimir Vukicevic <vladimir@pobox.com> -Date: Tue Sep 4 11:19:33 2007 -0700 - - [win32] Makefile and compilation fixes for win32 - -commit 5fc4d5ab1fae8677f5a95f5eb0e4fad3a9e0bf82 -Author: Vladimir Vukicevic <vladimir@pobox.com> -Date: Tue Sep 4 11:18:40 2007 -0700 - - compilation: build edge/compose with accessors separately - - Simplify the build by creating a new file for pixman-compose and - pixman-edge built with accessor functions. - -commit 6b96b62ca419ac414d5715a4ba9f30664e510fcd -Author: Carl Worth <cworth@cworth.org> -Date: Tue Sep 4 17:24:04 2007 -0700 - - Don't copy unused bits to an alpha channel - - This bug was identified by cairo's rgb24-ignore-alpha test which - blends RGB24 over ARGB32 and notices that "alpha" values are - making it from the source to the destination. - -commit 8ff7213f39edc1b2b8b60d6b0cc5d5f14ca1928d -Author: Vladimir Vukicevic <vladimir@pobox.com> -Date: Sat Aug 25 23:30:41 2007 -0700 - - rasterize traps that extend outside of the image bounds correctly - - Traps that extend outside of the image bounds are rasterized incorrectly - currently; the problem is a signed vs. unsigned comparison that got - introduced when a width parameter went from int -> uint. This patch - puts it back to int (since it's stored as an int in the bits structure - to begin with), and also fixes a similar warning in the memset wrapper - -commit 028993aacb9ec48aa9d347d0d189250b464cf30f -Author: Søren Sandmann <sandmann@redhat.com> -Date: Fri Aug 24 16:49:29 2007 -0400 - - Set accessors for the destination image in composite-test.c - -commit 341be6a408e86d5b8976e63746e646ef973339bb -Author: Søren Sandmann <sandmann@redhat.com> -Date: Fri Aug 24 16:30:10 2007 -0400 - - Add missing comma in enum - -commit fb667257ab8f5cf9c6af399ac394b8aa7826fd96 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Fri Aug 24 16:19:31 2007 -0400 - - Remove trailing comma in enum - -commit c7dad7b9a038fbe94a2bdc67cc0a5f40f8a40d5c -Author: Søren Sandmann <sandmann@redhat.com> -Date: Fri Aug 24 16:12:30 2007 -0400 - - Add conjoint and disjoint operators to pixman.h - -commit 245a5e04eb4bf3b973d32ce5f21e6e2eac00b48b -Merge: 25846ed... 9c09561... -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Aug 21 16:31:45 2007 -0400 - - Merge branch 'master' of ssh+git://sandmann@git.freedesktop.org/git/pixman - -commit 25846ed93a87fcaefbfdb397343e986c8f53f997 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Aug 21 14:11:54 2007 -0400 - - Fix bug 12039, based on Chris Wilson's patch. - -commit 9c09561a91debfd7c77a39b337b51b2ab16d6da9 -Author: Eric Anholt <eric@anholt.net> -Date: Mon Aug 20 12:58:47 2007 -0700 - - Fix failure to set identity transform in pixman. - - While here, optimize out a free/malloc in the case where a transform - existed previously and the new transform is non-identity. - -commit 3e74bc431908dd42775d8e82ca2e4d589de820cb -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Fri Aug 17 18:01:09 2007 -0400 - - Add pixman_image_set_source_clipping() - -commit c7bec5898891f3077986c141b48e5ff77f1d5046 -Author: Carl Worth <cworth@cworth.org> -Date: Wed Aug 15 10:16:11 2007 -0700 - - Fix typo AC_MAJOR -> PIXMAN_MAJOR - - This typo was causing build failures for some. Thanks to David Sharp for - pointing out the problem. - -commit d9b989c890724480d27aec471d5f5fbcc09c0a61 -Author: Aaron Plattner <aplattner@nvidia.com> -Date: Tue Aug 14 16:16:27 2007 -0700 - - Remove redundant defines. - -commit 7bdb9840eb414b41ad41871864baa4f2445d8c05 -Author: Arcady Goldmints-Orlov <arcadyg@nvidia.com> -Date: Mon Aug 13 17:37:59 2007 -0700 - - One more minor wrapping fix - - Signed-off-by: Aaron Plattner <aplattner@nvidia.com> - -commit 166b78295683d9bcf688702e98259e62f9b25c86 -Author: Arcady Goldmints-Orlov <arcadyg@nvidia.com> -Date: Mon Aug 13 15:20:18 2007 -0700 - - Remove unnecessary wrapping from fbFetch/fbStore. - - These functions fetch from a picture to a scanline buffer, or store - from a scanline buffer to a picture. Since pixman allocates its own - scanline buffer, we don't need to wrap accesses to it. - - Signed-off-by: Aaron Plattner <aplattner@nvidia.com> - -commit 7b1d0c091dd5ae8797b6f7a0ab3d40d5c3676fe9 -Author: Aaron Plattner <aplattner@nvidia.com> -Date: Mon Aug 13 17:26:51 2007 -0700 - - Don't skip fbFetch/fbStore when PIXMAN_FB_ACCESSORS is enabled. - - pixman_composite_rect_general_accessors skips the fetch / store steps by setting - store to NULL when the op is ADD or OVER and the dest format is [ax]8r8g8b8. - This optimization is only valid when no accessors are in play. - -commit 43370d1ce793ef2754c2e6f0fc08e534d4247793 -Author: Eric Anholt <eric@anholt.net> -Date: Mon Aug 6 20:06:48 2007 -0700 - - Update .pc file for library version name change. - -commit 778a3f9d7136de062806473dd3604eb03ba5d866 -Author: Aaron Plattner <aplattner@nvidia.com> -Date: Wed Aug 1 14:16:55 2007 -0700 - - Return a bool from pixman_image_unref. - - Returns TRUE when the refcount reaches 0 and the image is freed. - -commit 4838e2e9d9635883841e692a7074bcb2be96dcf5 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Aug 6 17:28:06 2007 -0400 - - Bump version number; fix typo in configure.ac - -commit 7b3c9cef49cdedef03112054925005fa21120bd5 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Aug 6 17:24:44 2007 -0400 - - Change the library name to pixman-1 - Set the soname to something based on the library version. - -commit 19c46bf18b9cf6694fa3de9c836a3d1eed6c6dac -Author: Vladimir Vukicevic <vladimir@pobox.com> -Date: Fri Aug 3 15:24:03 2007 -0700 - - Fix OpenSolaris compilation - -commit 0c80a0cd84f30616563cef5910df9deb4f8ed687 -Author: Alan Coopersmith <alanc@sun.com> -Date: Mon Jul 16 15:06:23 2007 -0400 - - Build fixes for Solaris. - -commit 0f392d81748ab1338d294de96e28c43270f24180 -Author: Jinghua Luo <sunmoon1997@gmail.com> -Date: Tue Jul 10 14:47:28 2007 +0800 - - Fix bug in rasterizeEdges() where the stride should be signed. - -commit bbef73192e558695933d7f05befaa8c18550bb63 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Mon Jul 2 12:18:42 2007 -0400 - - Port Vlad's fixes for integer overflows with malloc(). - -commit 2e61f30e4c8d0e01e175495e13a5f132521ad6f2 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Fri Jun 22 13:37:46 2007 -0400 - - Revert "Add a cache of images to reduce malloc/free time" - - Revert the image cache since it isn't thread safe. - - This reverts commit deb09d769ae4fc55cde595c170f417692284b3e8. - -commit 64e3146c5ddfad415663fa5f87f7b9ff327a8c56 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Fri Jun 22 00:58:05 2007 -0400 - - Don't treat void as a value. Bug 11322, Alan Coopersmith. - -commit 8216ba1cbd27c5428970b8d393722d0f4343efed -Author: Vladimir Vukicevic <vladimir@pobox.com> -Date: Wed Jun 20 15:13:30 2007 -0400 - - Add pixman_region_init_rects() - -commit f1194a8bc0599e3ecceb785795ad8283a7c04dc0 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Wed Jun 20 12:12:43 2007 -0400 - - Fix typo - -commit 3dbb2a56bd1918595091006c6e0de5260d43af09 -Author: Alex Larsson <alexl@redhat.com> -Date: Wed Jun 20 12:01:12 2007 -0400 - - Add non-mmx fast paths for In_8x8 and In_nx8x8. Bug 4191, patch by - Alex Larsson. - -commit 658acaad4e73ac705f705f947a42a2cd0979042c -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Wed Jun 20 11:36:22 2007 -0400 - - Add fbCompositeSrc_8888xx888(); comment out - fbCompositeOver_x888x8x8888{mmx} since they are not actually faster - than the generic code. - -commit 440ed1da1c7ac600865c615cf257173cac2af214 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 19 14:41:04 2007 -0400 - - Optimize pixman_fill_rectangles() in a few more cases - -commit deb09d769ae4fc55cde595c170f417692284b3e8 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 19 12:41:21 2007 -0400 - - Add a cache of images to reduce malloc/free time - -commit 6cb74dfe3d395051f9a2e4b850979a018ac340ca -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 19 11:23:05 2007 -0400 - - Also store the g3 part correctly - -commit 07e73371ef096b42d3a983266105b71ea01b4cc8 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 19 11:19:43 2007 -0400 - - Fix fbStore_b2g3r3(). Pointed out by Dan Amelang - -commit d7f426806d25a9cea93a4c43a3f23e7ae9d67383 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 19 10:46:36 2007 -0400 - - Smplify the 1x1r optimization for the general compositing and fix the - 1xn and nx1 cases. - -commit 9ebec1f7dbe5576d572fede28d7560ea6000b566 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 19 10:40:58 2007 -0400 - - Fix pixman_fill() to return TRUE when it succeeded - -commit 15b5960bcb7cadfe6fe92036dc0f08a85a2009f1 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 19 00:57:33 2007 -0400 - - Add in 0xff alpha channel in Over_x888x8x8888mmx - -commit e73e000d5bd44a198e35b6d0c421a735d00e0b3f -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 19 00:35:58 2007 -0400 - - Fix solid fill optimization to compute the src correctly - -commit edbe099ad3906d7626de854d144fc23d78408357 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 18 14:29:02 2007 -0400 - - Add non-mmx solid fills. Update TODO - -commit f9454b3423b948022f36b7191db8c5f988f46273 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 18 13:37:20 2007 -0400 - - Make sure the output of fbCompositeOver_x888x8x8888 is actually stored - -commit 0e4292666de736a584a3d4e0bcfc6db7d2c6538d -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sun Jun 17 23:10:23 2007 -0400 - - Also use this function in the xBGR case - -commit 80a61bfb3dcf26271766e36aa31d454889ee43a5 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sun Jun 17 22:57:47 2007 -0400 - - Add new fbCompositeOver_x888x8x8888mmx() operation - -commit 19360d0df2ba55d34963101a662dd0ab51d84836 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sun Jun 17 22:43:55 2007 -0400 - - Add fbCompositeOver_x888x8x8888() fast path - -commit ff4004f3fbd3c576f1c931c680ad293c5038846d -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sun Jun 17 22:24:46 2007 -0400 - - Rename fbCompositeSrc_x888x8x8888 to x888xnx8888 - -commit 30f198fe53949da59821d2f394f0cecb5bdaa646 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sun Jun 17 18:50:00 2007 -0400 - - Remove accidentally committed use of TIMER_BEGIN/END - -commit e71844095ea75b4f9f66c85c87b4b3b6c287e02f -Merge: 4f9f7ae... 647852d... -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sun Jun 17 18:49:02 2007 -0400 - - Merge branch 'master' of ssh+git://sandmann@git.freedesktop.org/git/pixman - -commit 647852d714ddfe6e1d71af1f4aea0e272c459fc6 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sun Jun 17 18:55:37 2007 -0400 - - Add timer macros - -commit 4f9f7ae47ad258a1605a6b38c5ec268c9ee17150 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sun Jun 17 18:02:06 2007 -0400 - - Update TODO - -commit ad80d4d2bc8c4e37a8266b98a2241c0ebd7f0e43 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sun Jun 17 01:00:07 2007 -0400 - - Optimize fill rectangles in the op=PIXMAN_OP_CLEAR case - -commit 9deaaae3f61f1701b022fe7daa1823a99fda7d00 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat Jun 16 23:08:53 2007 -0400 - - Use the general code in some cases even when a fast path is available - - If src or mask are repeating 1x1 images and srcRepeat or - maskRepeat are still TRUE, it means the fast path we - selected does not actually handle repeating images. - So rather than call the "fast path" with a zillion - 1x1 requests, we just use the general code (which does - do something sensible with 1x1 repeating images). - -commit e0a501d9b7e5c4ca07115552a16c4c4953ec5702 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat Jun 16 22:10:36 2007 -0400 - - Remove ACCESS_MEM macro; define READ and WRITE to directly use the wrapper functions - -commit 9b3cfcc13d0613cfb9d15b21a6b90e4a91a1666f -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat Jun 16 21:40:43 2007 -0400 - - Move some utility functions from pixman-edge.c to pixman-utils.c - Set up so pixman-edge.c is compiled twice. - -commit 3cd36dae288ac0923f214b8ae81dbfc0f4d5b1b0 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat Jun 16 21:23:20 2007 -0400 - - Slight tweak to the definition of pixman_composeFunctions - -commit 68d6c68adaba3a1d538bceca7d7955129d6075de -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat Jun 16 21:19:51 2007 -0400 - - Add #defines etc to compile pixman-compose.c twice - -commit b5d07147fba7085d52966aa162db5d38164dfebf -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sat Jun 16 15:13:04 2007 -0400 - - Make fbCompositeSrc_8888x8888mmx() check if the mask is 0 - -commit 5122f2b28bfbf08479cc88ff9ddfeb371f92264f -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sat Jun 16 14:56:25 2007 -0400 - - Unroll loop in fbComposite_x888x8x8888() - -commit 8fc40c3b0076e99cc996bd27a2479db4c94cc77b -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sat Jun 16 14:49:11 2007 -0400 - - Optimize 1x1 repeating images in the general case - - Reinstate checks for empty masks in mmxCombineOverU() and mmxCombineMaskU() - -commit 15e5cf16a9770da682addeaff5df8b1793cf4b73 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sat Jun 16 12:55:59 2007 -0400 - - Add a few optimizations for solid fills - -commit 10854b9d63afe6893ac15fb67714eb98b7a8eca6 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sat Jun 16 01:40:07 2007 -0400 - - Plug leak of the gradient stops - -commit e365aaf7f34d9257fc53e8f180a84fa243edcb2c -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Sat Jun 16 01:15:05 2007 -0400 - - Plug leak in the bits=NULL case for pixman_image_create_bits() - -commit 451a0510324491e82269d8e0d997ee4707ba8df8 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Fri Jun 15 14:33:57 2007 -0400 - - When setting identity transformations store them as NULL to prevent - - hitting the general compositing code. - -commit cd9c484f0d8cef0cc243a73de5a8d742b8678230 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Fri Jun 15 01:45:04 2007 -0400 - - Turn off debug spew for incorrect arguments - -commit e1dd17451cbe2c7d36205fe2fc4cea0092ee4141 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Fri Jun 15 00:15:03 2007 -0400 - - Disable source clipping by default - -commit 1426483f8af21553bd8b2ad997617680944be420 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Thu Jun 14 17:37:12 2007 -0400 - - Update TODO - -commit 7a8877bc0800ffcfe18bedec49068049c877fa5d -Author: Søren Sandmann <sandmann@redhat.com> -Date: Thu Jun 14 17:35:28 2007 -0400 - - Update TODO - -commit a0e161ca9aa562a0f4b55b15b1ab3b9380f0d9bb -Author: Søren Sandmann <sandmann@redhat.com> -Date: Thu Jun 14 17:34:42 2007 -0400 - - Update TODO - -commit 596bd530205e9835ede0bc8816c9b2dfff75e921 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Thu Jun 14 12:59:15 2007 -0400 - - Reset clip regions correctly when NULL is passed - -commit e8dfb54ccea26b7e7948ca9806c97194892f0791 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue Jun 12 23:50:04 2007 -0400 - - Make default clip region the full image - -commit 42192ad0fc7fe0fa7600f879646de867691351bb -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue Jun 12 23:37:25 2007 -0400 - - Don't complain if users try to read non-existing data from images - -commit 0e77667851869849cbddc30466db99ff5dc02b19 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue Jun 12 22:53:35 2007 -0400 - - Don't require rowstride to be a multiple of 4 when bits is NULL - -commit b6bdd8273cc3500d1f69402f39c3d6e718920a66 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue Jun 12 22:14:32 2007 -0400 - - Add pixman_fill_rectangles() - -commit 0ab81dc6383e843aa3fa78da289820a55f4a08f0 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue Jun 12 15:32:27 2007 -0400 - - Add pixman_add_trapezoids() function - -commit 756b54f6e45bb423ffabfcad2b6d8574130c6e53 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue Jun 12 15:27:31 2007 -0400 - - Add boolean returns to various setters - -commit 6d62986ee0be7191ad6ef938d82cbadbe995c377 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue Jun 12 14:30:53 2007 -0400 - - Allow bits to be NULL when bit images are created - -commit d466cf1d2f09f78baaafac713d6bc7d4f003b860 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue Jun 12 14:24:40 2007 -0400 - - Add various accessors; remove composite_rect - -commit b62b769c0da8d8eae68bd41a53f390c1f0917be0 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 11 22:02:03 2007 -0400 - - Bump version number - -commit c663029510c8a329dc87246cc895b21f0af79eb6 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 11 21:39:24 2007 -0400 - - Make use of pixman_fill_mmx() in various places. Delete #if0'ed code - -commit 3dca89a677528845ccaee7ff6d355207c631ddd2 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 11 21:35:14 2007 -0400 - - Add pixman_fill_mmx() function - -commit cf6b8f63d4dd2d96efcde673696e1703856a3787 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 11 14:55:31 2007 -0400 - - Forgotten fbHaveMMX() - -commit 02f6129400eda40167e91e0ff4724d7a5ae5a80d -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 11 14:54:44 2007 -0400 - - Rename fbHaveMMX() pixman_have_mmx() - Guard pixman_blt_mmx() with pixman_have_mmx() - -commit 105d398c4d061eb102747f824e6c04ab897cb5e1 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 11 14:41:01 2007 -0400 - - Add pixman_blt_mmx() based on fbBltmmx() from the X server. - - Implement fbCompositeAreammx() in terms of it. - - Uncomment calls to fbCompositeAreammx() in pixman-pict.c - - Add public pixman_blt() that just returns false if not using mmx. - -commit 6a64eb109449806186164332383be1235ab9c21c -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 11 09:15:05 2007 -0400 - - Bump version number - -commit 30499e2e88985df2cd1ece82227802a316e31a32 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Mon Jun 11 00:22:19 2007 -0400 - - Add a version of miComputeCompositeRegion; call it from - pixman_image_composite(). Remove const from return value of - pixman_region_rectangles(). - -commit 5ca61dc99b198243f08e6f1f3f96e3c87ff818b9 -Author: Søren Sandmann Pedersen <sandmann@redhat.com> -Date: Tue Jun 5 11:33:17 2007 -0400 - - Fix bug in pixman_image_set_filter() where only the parameters were - updated, not the filter type. Reported by Michel Dänzer. - -commit 808e2de3a6270b32a026722f59a49736d224d46c -Author: Daniel Stone <daniel@fooishbar.org> -Date: Thu May 24 16:24:39 2007 +0300 - - Add .gitignore file - -commit d1ce3f95509bd86c0aa850d6b58c8a065517c84f -Author: Daniel Stone <daniel@fooishbar.org> -Date: Thu May 24 16:19:40 2007 +0300 - - Use canonical autogen.sh - - Use the standard autogen.sh, which allows for srcdir != builddir. - -commit 8129984603de569e01563d810a334765c2ec5062 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 23 16:38:38 2007 -0400 - - Declare the two new trapezoid functions in pixman.h - -commit 4355cc5c57f3e402af9a508762c8ed3a5ac9f2ca -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed May 23 16:40:23 2007 -0400 - - Add pixman-trap with the trapezoid rasterization code from the X server. - - Add two different trapezoid types that X makes use of. - -commit 35f99a530de11bcf0e98c372bc49b9bf0f2ecf37 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 23 16:09:49 2007 -0400 - - Make sure gradient-test.c builds when srcdir != buildir. Patch from - Julien Cristau <jcristau@debian.org>. - -commit d5e8a7b8bdd4b18e504859059683cb9723503b3c -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed May 23 15:39:03 2007 -0400 - - Fix bug in rasterizeEdges() where the stride was treated as if in - bytes, when it was in uint32_t's. Formatting fixes. Delete misleading - comment from pixman-private.h - -commit ee37469d6adad32cb31e52a95abafa32943b3e8d -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 23 12:18:09 2007 -0400 - - Fix function name - -commit 727b77983bd8b684764e69cdea38ce6290c60467 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 22 13:39:25 2007 -0400 - - Add more edge functions - -commit 4600c6823e4dea52a34fe881f5374691bc76f555 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 22 12:52:52 2007 -0400 - - Add implementation of edge rasterization - -commit 1413bb7a5ddc2d49109a1e9669fab155352bc3c7 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 22 11:58:46 2007 -0400 - - Add edge data types - -commit e32b240145ee7bbc2e69020b0bb00c33c68acf15 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue May 22 10:00:46 2007 -0400 - - Detect endianness - -commit e5cf135170198a33429b00f7c506a84054f0297e -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue May 22 09:54:19 2007 -0400 - - Include string.h in pixman-pict.c - -commit 097de78d135259c64c5cf8789680bfdc354c12f9 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue May 22 09:51:54 2007 -0400 - - Check for getisax() support - -commit 37f90ba0b2d9797de93477aaa9e113329e50f93d -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue May 22 09:49:23 2007 -0400 - - Check for MMX in the build system - -commit 56623268a76ab65228c41dba5fbf27463b1a5691 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue May 22 00:04:39 2007 -0400 - - Update TODO - -commit ed184ebb7c2f12010207ffa210975a9b22b152ef -Author: Søren Sandmann <sandmann@redhat.com> -Date: Tue May 22 00:03:31 2007 -0400 - - Make the mmx code compile - -commit 2db377de616c4c0826d1a56777d7a4f858049758 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Mon May 21 23:46:24 2007 -0400 - - Add pixman-mmx.[ch] and move macros around to make it compile. - Not yet hooked up. - -commit ce506999e6dc6ad07d2665277d0250e7d9e0b6a8 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Mon May 21 20:03:37 2007 -0400 - - Use the general code if the images have read/write functions - -commit a54096d554414dd88a3c6a7a53816552844a5b08 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Mon May 21 17:51:41 2007 -0400 - - Update TODO - -commit ccef70a685191bb3cd4b7891f1ebde1881b3aa13 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Mon May 21 15:03:41 2007 -0400 - - Fix bug in fbCompositeGetSolid() where a format was compared to a format type - -commit 154c4dd97896178cd54bdb1057bef2eab3870c0c -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Mon May 21 14:27:40 2007 -0400 - - Make pixman_image_composite() take a region parameter; comment out non-implemented functions from the switch of doom - -commit 4518de9fec813bcb19facbc944821e882a91671a -Author: Søren Sandmann <sandmann@redhat.com> -Date: Mon May 21 10:00:05 2007 -0400 - - Add slightly changed copy of miComputeCompositeRegion() to pixman-pict.c - -commit 4df446bb73b1ab89e119d6714a3feae8a384e113 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 19 17:19:39 2007 -0400 - - Move mod and div macros to pixman-private.h - -commit bcb4c8f02137178096473191a05c3b84e4ce5116 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 19 17:13:02 2007 -0400 - - Add fbComposeGetStart() macro - -commit e9e326eafe3e4ed221eefbb7ddbd46d5d983505d -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 19 17:05:23 2007 -0400 - - Add fbComposeGetSolid() macro - -commit 456ebbbb27381d5fff4d2426a261c4760eb0b8df -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 19 16:44:40 2007 -0400 - - Add implementation of can_get_solid() - -commit eabc2f48f07decb5fa15db985fffa9e648506568 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 19 16:40:10 2007 -0400 - - Various formatting/style tweaks - -commit bdb307ac4a6ad20e687f286491a3d9df6807567f -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 19 15:53:37 2007 -0400 - - Add macro FUNC that expands to __PRETTY_FUNCTION__ or __func__ - depending on the compiler. - -commit 4c15a7838eadf9b608b28ebafccceb0aa25a83dc -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 19 12:04:21 2007 -0400 - - Include limits.h in pixman-compose.c; patch from Alan Coopersmith - -commit 595ca53c094b8dee6747670aaa471fb19f1a6d94 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 18 15:21:51 2007 -0400 - - Add pixman-pict.c which is a version of fbpict.c. It compiles, but - isn't hooked up to anything. - -commit e1328980457ce6f51ce2649d79feefa616408ce9 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 18 13:38:26 2007 -0400 - - Make pixman_image_set_indexed() not copy its argument - -commit e12ca669af9143581c4af4c8c885273fc6b12c2d -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 18 12:04:16 2007 -0400 - - Free the indexed table when the image is freed - -commit ff2e0e9636b1dd3690b5ab5e1dff04ff5c9a07ab -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 18 11:54:01 2007 -0400 - - Add new function pixman_image_set_indexed() - -commit 74b76ad9fefd39d7d60a059f2f8537b5f6b94652 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Thu May 17 10:19:29 2007 -0400 - - Fix wrong type in composite-test.c - -commit d25d77852d253042b859468f64b228d11c2a0f82 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Thu May 17 09:12:09 2007 -0400 - - Add a TODO file. Indent pixman-compose.c - -commit db3c13c8fea0e3d0be382d55d58fc9d0d01bba44 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed May 16 19:35:55 2007 -0400 - - Add macro magic in pixman-private.h to allow reading and writing to - happen through functions. Use them in pixman-compose.c; also delete - unnecessary READ and WRITE macros that always operate on host memory. - Add accessor functions to composite-test.c - -commit 57d6894ab06d2ac07e17108c01e8ba282fc51384 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 16 11:13:11 2007 -0400 - - Add an image argument to all the store functions - - Some tweaks to composite-test.c - -commit 0cfb66104cc553ba365df546d7ba9b0e8415e30f -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 16 11:07:54 2007 -0400 - - Add an image argument to all the fetch functions - -commit a49e425933e3ccd1ae59c0e60ddbab8a88282639 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 16 11:03:09 2007 -0400 - - Move some macros from pixman-compose.c to pixman-private.h - -commit 24f8cfce32d3c5dcd3ff6d9ebd513c35cdacc972 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 16 10:56:08 2007 -0400 - - Add API to have accessor functions on pixman - -commit 195100527f6c678bf9848dc6c2a08658ed39a17d -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 15 16:40:40 2007 -0400 - - Various formatting fixes - - Rename pixman_image_composite() to pixman_image_composite_rect() - -commit 97a4ce541c9fc72aeee0f05b8529d0ca87fb7863 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 15 12:15:46 2007 -0400 - - Fix typo in pixman.h - -commit 322659703d7c52d45ba3962b8386ac5f61e403db -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 15 12:13:01 2007 -0400 - - Replace hack to get standard integer types with #if/#elif construction - -commit ffbb4a6b1fb52dc46639d18bf0dd769fe53d3e88 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 15 11:08:24 2007 -0400 - - Don't build GTK+ test programs if GTK+ is not available - -commit b8d223d6837d37bc09efdf3c4d957ff24337004a -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 12 19:24:42 2007 -0400 - - Export pixman_region_reset - -commit 38c4ac5a1d25d96087bfe1e3d02816feaa6b8bf9 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 12 17:58:50 2007 -0400 - - Export a pixman_region_selfcheck - -commit f226c2b4f2465aba5f9e1f3fed48f0840d0b67c0 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 12 17:55:48 2007 -0400 - - Export pixman_region_equal() - -commit ecf9d36f6a62f4d77e2c025ee3109ac46f13f15d -Author: Søren Sandmann <sandmann@redhat.com> -Date: Sat May 12 17:32:43 2007 -0400 - - Add new pixman_region_set_static_pointers - -commit ffab43129163de418c324cffcf602e6254024f95 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Thu May 10 22:15:57 2007 -0400 - - Make the region data struct public - -commit e126ef091151372ed29562f3ff1a964774583b9b -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Thu May 10 16:14:40 2007 -0400 - - Make the pixman_transform_point_3d() function public - -commit f267e4dce73819a4a511ffaebd0cca9dcb3bd5fb -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Thu May 10 16:08:12 2007 -0400 - - Change the names of a few functions to prevent them from clashing with the X names - -commit c976db965862c0b2ba940122dc7e690cd23b5fa3 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Thu May 10 10:13:54 2007 -0400 - - Use a radial gradient in the gradien-test - -commit 7ad923eb6ff71b3865ea43b2ee247715607146da -Author: Søren Sandmann <sandmann@redhat.com> -Date: Thu May 10 09:30:17 2007 -0400 - - Make sure 64 bit fixed point types are signed - -commit a5a11df9024f9b7ee6194e0b842cd430f4fb5697 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Thu May 10 09:16:34 2007 -0400 - - Add a transformation to the gradient test - -commit 1a58e8478f6f87de3ffe31b0fd2b1ee06d08fe6c -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed May 9 18:18:38 2007 -0400 - - Use fixpoint instead of double in gradient test - -commit 0ebb7e31db85a179afdcd731fcc6b0e311084cb1 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Wed May 9 18:10:30 2007 -0400 - - Remove AM_MAINTAINER_MODE ; add new gradient-test - -commit dd670c29bf1de3e951f936dba834e4bfe07a9bd4 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 9 14:20:57 2007 -0400 - - Fix various stupid mistakes, such as inverted return_if_fail() tests - and only allocating space for a pointer instead of an image. - -commit 271c830eb0b817bd892704fb15856b19b0458d07 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 9 11:22:56 2007 -0400 - - Remove *error from solid fill constructor - -commit e9b1be0151d7bc677bd74f0a5a6836672c1ad9dd -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 9 11:12:21 2007 -0400 - - Various formatting fixes - -commit 059f62f3b02b6244b866e58d248bc8e6869f506e -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 9 11:09:59 2007 -0400 - - Handle setting of NULL properties - -commit 7529b47ee5f55e7b16bdfa750dd18dac11194210 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 9 11:00:06 2007 -0400 - - Make images ref counted. Memory management. - -commit 8bdb8b1d93bbbffafe111b4fc4dac0df9bbb6fe5 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 9 09:47:33 2007 -0400 - - Export pixman_gradient_stop; get rid of *error argument from init functions. - - Add return_if_fail macros to pixman-private.h - -commit 4ea0d782092d9bd7c1570bcfccf3fe340a3d258a -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Wed May 9 08:20:43 2007 -0400 - - Change to use malloced image instead of stack allocated - -commit 45c261d75ae348cb4afc6c97d4daa90cfd50e890 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 8 17:02:44 2007 -0400 - - Apply bad hack to avoid including config.h - -commit 59df25cbe403112c3c301dd212cfaa7b8f848499 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 8 14:24:32 2007 -0400 - - Install header file in pixman/pixman.h - -commit 2f882e03614608a2a39690cf4e7105e4dde25e21 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 8 14:00:13 2007 -0400 - - Fix libpixman.pc.in - -commit 0c01cbedbaf068a9db4edefbb130c58f1f1c85ac -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 8 13:37:03 2007 -0400 - - Add setters for various properties - -commit e36c6a5eb4cc89da8cf8d66dd45d02b75584e243 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 8 13:19:51 2007 -0400 - - Make the test program test something useful. - - Also add a check that the public image struct is big enough to contain the - private union. - -commit 4bd9ebc83d5a25141b5c9868513b918befd433d0 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 8 10:48:27 2007 -0400 - - Add a simple test program; fix linking problems - -commit 50289aace6a8699c08593a8cb93bf8dfc30ed818 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Tue May 8 10:32:54 2007 -0400 - - Implement pixman_image_composite() in terms of fbCompositeRect(). - -commit df7570f0ad6b903d7b910734f1906d423928c048 -Author: Søren Sandmann <sandmann@redhat.com> -Date: Mon May 7 22:36:15 2007 -0400 - - Add a version of fbcompose.c. Fixes and additions to make it compile - -commit 589604bfa36524809f3f44b96f624f7c7bedbee0 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Sun May 6 12:46:42 2007 -0400 - - Fix copyright notice - -commit c2602792aa8d5d4a376beb9557f544b78735c210 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 23:45:19 2007 -0400 - - Add fixed point macros, add declarations for image init functions - -commit da2510138584c4dd80b011f3bc767923c6ee443e -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 22:34:54 2007 -0400 - - Run configure from autogen.sh - -commit 560a2f52ade892526d5d64a1fb36471ade57ed45 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 22:34:22 2007 -0400 - - Don't run configure from autogen.sh - -commit eb90370859435390d0276d0c2c5f3251b32e431a -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 22:18:33 2007 -0400 - - Make autogen.sh run configure - -commit 97cdcabe18a2e910dbfa4892dd8f32354fb02463 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 22:16:40 2007 -0400 - - Changes to autogen.sh - -commit 261a293555d45245f34214e646131a410e8fd4a7 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 22:11:49 2007 -0400 - - Make autogen.sh run configure - -commit 9f40d13e9f9e23f62280375605f4234e71642c24 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 22:08:40 2007 -0400 - - Add pixman.pc.in - -commit 7f0b18c94cf84750b097fe96aa3c8ac9e1b406e3 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 22:07:19 2007 -0400 - - Add code to initialize images, based on picture.c from the X server - -commit af13f449087a5dd72abf5f1178234e85add33632 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 19:44:13 2007 -0400 - - Change autogen.sh to call autoreconf. Remove reference to libcomp.h - -commit 565f410a1c420da875cd9d13efa22126ad5fa567 -Author: Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> -Date: Fri May 4 19:13:57 2007 -0400 - - Add the files. diff --git a/lib/pixman/Makefile.am b/lib/pixman/Makefile.am index 70035a191..542603eec 100644 --- a/lib/pixman/Makefile.am +++ b/lib/pixman/Makefile.am @@ -4,3 +4,124 @@ pkgconfigdir=$(libdir)/pkgconfig pkgconfig_DATA=pixman-1.pc $(pkgconfig_DATA): pixman-1.pc.in + +snapshot: + distdir="$(distdir)-`date '+%Y%m%d'`"; \ + test -d "$(srcdir)/.git" && distdir=$$distdir-`cd "$(srcdir)" && git-rev-parse HEAD | cut -c 1-6`; \ + $(MAKE) $(AM_MAKEFLAGS) distdir="$$distdir" dist + +USERNAME=$$USER +RELEASE_OR_SNAPSHOT = $$(if test "x$(CAIRO_VERSION_MINOR)" = "x$$(echo "$(CAIRO_VERSION_MINOR)/2*2" | bc)" ; then echo release; else echo snapshot; fi) +RELEASE_CAIRO_HOST = $(USERNAME)@cairographics.org +RELEASE_CAIRO_DIR = /srv/cairo.freedesktop.org/www/releases +RELEASE_CAIRO_URL = http://cairographics.org/releases +RELEASE_XORG_URL = http://xorg.freedesktop.org/archive/individual/lib +RELEASE_XORG_HOST = $(USERNAME)@xorg.freedesktop.org +RELEASE_XORG_DIR = /srv/xorg.freedesktop.org/archive/individual/lib +RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org, xorg-announce@lists.freedesktop.org + +tar_gz = $(PACKAGE)-$(VERSION).tar.gz +tar_bz2 = $(PACKAGE)-$(VERSION).tar.bz2 + +sha1_tgz = $(tar_gz).sha1 +md5_tgz = $(tar_gz).md5 + +sha1_tbz2 = $(tar_bz2).sha1 +md5_tbz2 = $(tar_bz2).md5 + +gpg_file = $(sha1_tgz).asc + +$(sha1_tgz): $(tar_gz) + sha1sum $^ > $@ + +$(md5_tgz): $(tar_gz) + md5sum $^ > $@ + +$(sha1_tbz2): $(tar_bz2) + sha1sum $^ > $@ + +$(md5_tbz2): $(tar_bz2) + md5sum $^ > $@ + +$(gpg_file): $(sha1_tgz) + @echo "Please enter your GPG password to sign the checksum." + gpg --armor --sign $^ + +release-verify-newer: + @echo -n "Checking that no $(VERSION) release already exists at $(RELEASE_XORG_HOST)..." + @ssh $(RELEASE_XORG_HOST) test ! -e $(RELEASE_XORG_DIR)/$(tar_gz) \ + || (echo "Ouch." && echo "Found: $(RELEASE_XORG_HOST):$(RELEASE_XORG_DIR)/$(tar_gz)" \ + && echo "Refusing to try to generate a new release of the same name." \ + && false) + @ssh $(RELEASE_CAIRO_HOST) test ! -e $(RELEASE_CAIRO_DIR)/$(tar_gz) \ + || (echo "Ouch." && echo "Found: $(RELEASE_CAIRO_HOST):$(RELEASE_CAIRO_DIR)/$(tar_gz)" \ + && echo "Refusing to try to generate a new release of the same name." \ + && false) + @echo "Good." + +release-remove-old: + $(RM) $(tar_gz) $(tar_bz2) $(sha1_tgz) $(gpg_file) + +ensure-prev: + @if [[ "$(PREV)" == "" ]]; then \ + echo "" && \ + echo "You must set the PREV variable on the make command line to" && \ + echo "the git tag of the last release." && \ + echo "" && \ + echo "For example:" && \ + echo " make PREV=pixman-0.7.3" && \ + echo "" && \ + false; \ + fi + +release-check: ensure-prev release-verify-newer release-remove-old distcheck + +release-upload: release-check $(tar_gz) $(tar_bz2) $(sha1_tgz) $(gpg_file) + mkdir -p releases + scp $(tar_gz) $(sha1_tgz) $(gpg_file) $(RELEASE_CAIRO_HOST):$(RELEASE_CAIRO_DIR) + scp $(tar_gz) $(tar_bz2) $(RELEASE_XORG_HOST):$(RELEASE_XORG_DIR) + ssh $(RELEASE_CAIRO_HOST) "rm -f $(RELEASE_CAIRO_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(tar_gz) $(RELEASE_CAIRO_DIR)/LATEST-$(PACKAGE)-$(VERSION)" + git-tag -s -m "$(PACKAGE) $(VERSION) release" $(PACKAGE)-$(VERSION) + +release-publish-message: $(sha1_tgz) $(md5_tgz) $(sha1_tbz2) $(md5_tbz2) ensure-prev + @echo "Please follow the instructions in RELEASING to push stuff out and" + @echo "send out the announcement mails. Here is the excerpt you need:" + @echo "" + @echo "Lists: $(RELEASE_ANNOUNCE_LIST)" + @echo "Subject: [ANNOUNCE] $(PACKAGE) release $(VERSION) now available" + @echo "============================== CUT HERE ==============================" + @echo "A new $(PACKAGE) release $(VERSION) is now available" + @echo "" + @echo "tar.gz:" + @echo " $(RELEASE_CAIRO_URL)/$(tar_gz)" + @echo " $(RELEASE_XORG_URL)/$(tar_gz)" + @echo "" + @echo "tar.bz2:" + @echo " $(RELEASE_XORG_URL)/$(tar_bz2)" + @echo "" + @echo "Hashes:" + @echo -n " MD5: " + @cat $(md5_tgz) + @echo -n " MD5: " + @cat $(md5_tbz2) + @echo -n " SHA1: " + @cat $(sha1_tgz) + @echo -n " SHA1: " + @cat $(sha1_tbz2) + @echo "" + @echo "GPG signature:" + @echo " $(RELEASE_CAIRO_URL)/$(gpg_file)" + @echo " (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)" + @echo "" + @echo "Git:" + @echo " git://git.freedesktop.org/git/pixman" + @echo " tag: $(PACKAGE)-$(VERSION)" + @echo "" + @echo "Log:" + @git-log --no-merges "$(PACKAGE)-$(PREV)".."$(PACKAGE)-$(VERSION)" | git shortlog | awk '{ printf "\t"; print ; }' | cut -b0-80 + @echo "============================== CUT HERE ==============================" + @echo "" + +release-publish: release-upload release-publish-message + +.PHONY: release-upload release-publish release-publish-message diff --git a/lib/pixman/Makefile.bsd-wrapper b/lib/pixman/Makefile.bsd-wrapper index ca87d923f..a8d4aaa8a 100644 --- a/lib/pixman/Makefile.bsd-wrapper +++ b/lib/pixman/Makefile.bsd-wrapper @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.4 2007/12/10 21:30:21 matthieu Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2008/04/08 19:00:25 matthieu Exp $ -SHARED_LIBS= pixman-1 10.0 +SHARED_LIBS= pixman-1 11.0 .include <bsd.xorg.mk> diff --git a/lib/pixman/Makefile.in b/lib/pixman/Makefile.in index 38c1bc26c..ddcae2103 100644 --- a/lib/pixman/Makefile.in +++ b/lib/pixman/Makefile.in @@ -138,13 +138,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PIXMAN_MAJOR = @PIXMAN_MAJOR@ +PIXMAN_VERSION_MAJOR = @PIXMAN_VERSION_MAJOR@ +PIXMAN_VERSION_MICRO = @PIXMAN_VERSION_MICRO@ +PIXMAN_VERSION_MINOR = @PIXMAN_VERSION_MINOR@ +PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SSE_CFLAGS = @SSE_CFLAGS@ STRIP = @STRIP@ USE_MMX_FALSE = @USE_MMX_FALSE@ USE_MMX_TRUE = @USE_MMX_TRUE@ +USE_SSE2_FALSE = @USE_SSE2_FALSE@ +USE_SSE2_TRUE = @USE_SSE2_TRUE@ USE_SSE_FALSE = @USE_SSE_FALSE@ USE_SSE_TRUE = @USE_SSE_TRUE@ VERSION = @VERSION@ @@ -154,6 +160,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -194,6 +201,22 @@ target_alias = @target_alias@ SUBDIRS = pixman test pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = pixman-1.pc +USERNAME = $$USER +RELEASE_OR_SNAPSHOT = $$(if test "x$(CAIRO_VERSION_MINOR)" = "x$$(echo "$(CAIRO_VERSION_MINOR)/2*2" | bc)" ; then echo release; else echo snapshot; fi) +RELEASE_CAIRO_HOST = $(USERNAME)@cairographics.org +RELEASE_CAIRO_DIR = /srv/cairo.freedesktop.org/www/releases +RELEASE_CAIRO_URL = http://cairographics.org/releases +RELEASE_XORG_URL = http://xorg.freedesktop.org/archive/individual/lib +RELEASE_XORG_HOST = $(USERNAME)@xorg.freedesktop.org +RELEASE_XORG_DIR = /srv/xorg.freedesktop.org/archive/individual/lib +RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org, xorg-announce@lists.freedesktop.org +tar_gz = $(PACKAGE)-$(VERSION).tar.gz +tar_bz2 = $(PACKAGE)-$(VERSION).tar.bz2 +sha1_tgz = $(tar_gz).sha1 +md5_tgz = $(tar_gz).md5 +sha1_tbz2 = $(tar_bz2).sha1 +md5_tbz2 = $(tar_bz2).md5 +gpg_file = $(sha1_tgz).asc all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -413,7 +436,7 @@ distclean-tags: distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) - $(mkdir_p) $(distdir)/. + $(mkdir_p) $(distdir)/. $(distdir)/pixman @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ @@ -655,6 +678,106 @@ uninstall-info: uninstall-info-recursive $(pkgconfig_DATA): pixman-1.pc.in + +snapshot: + distdir="$(distdir)-`date '+%Y%m%d'`"; \ + test -d "$(srcdir)/.git" && distdir=$$distdir-`cd "$(srcdir)" && git-rev-parse HEAD | cut -c 1-6`; \ + $(MAKE) $(AM_MAKEFLAGS) distdir="$$distdir" dist + +$(sha1_tgz): $(tar_gz) + sha1sum $^ > $@ + +$(md5_tgz): $(tar_gz) + md5sum $^ > $@ + +$(sha1_tbz2): $(tar_bz2) + sha1sum $^ > $@ + +$(md5_tbz2): $(tar_bz2) + md5sum $^ > $@ + +$(gpg_file): $(sha1_tgz) + @echo "Please enter your GPG password to sign the checksum." + gpg --armor --sign $^ + +release-verify-newer: + @echo -n "Checking that no $(VERSION) release already exists at $(RELEASE_XORG_HOST)..." + @ssh $(RELEASE_XORG_HOST) test ! -e $(RELEASE_XORG_DIR)/$(tar_gz) \ + || (echo "Ouch." && echo "Found: $(RELEASE_XORG_HOST):$(RELEASE_XORG_DIR)/$(tar_gz)" \ + && echo "Refusing to try to generate a new release of the same name." \ + && false) + @ssh $(RELEASE_CAIRO_HOST) test ! -e $(RELEASE_CAIRO_DIR)/$(tar_gz) \ + || (echo "Ouch." && echo "Found: $(RELEASE_CAIRO_HOST):$(RELEASE_CAIRO_DIR)/$(tar_gz)" \ + && echo "Refusing to try to generate a new release of the same name." \ + && false) + @echo "Good." + +release-remove-old: + $(RM) $(tar_gz) $(tar_bz2) $(sha1_tgz) $(gpg_file) + +ensure-prev: + @if [[ "$(PREV)" == "" ]]; then \ + echo "" && \ + echo "You must set the PREV variable on the make command line to" && \ + echo "the git tag of the last release." && \ + echo "" && \ + echo "For example:" && \ + echo " make PREV=pixman-0.7.3" && \ + echo "" && \ + false; \ + fi + +release-check: ensure-prev release-verify-newer release-remove-old distcheck + +release-upload: release-check $(tar_gz) $(tar_bz2) $(sha1_tgz) $(gpg_file) + mkdir -p releases + scp $(tar_gz) $(sha1_tgz) $(gpg_file) $(RELEASE_CAIRO_HOST):$(RELEASE_CAIRO_DIR) + scp $(tar_gz) $(tar_bz2) $(RELEASE_XORG_HOST):$(RELEASE_XORG_DIR) + ssh $(RELEASE_CAIRO_HOST) "rm -f $(RELEASE_CAIRO_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(tar_gz) $(RELEASE_CAIRO_DIR)/LATEST-$(PACKAGE)-$(VERSION)" + git-tag -s -m "$(PACKAGE) $(VERSION) release" $(PACKAGE)-$(VERSION) + +release-publish-message: $(sha1_tgz) $(md5_tgz) $(sha1_tbz2) $(md5_tbz2) ensure-prev + @echo "Please follow the instructions in RELEASING to push stuff out and" + @echo "send out the announcement mails. Here is the excerpt you need:" + @echo "" + @echo "Lists: $(RELEASE_ANNOUNCE_LIST)" + @echo "Subject: [ANNOUNCE] $(PACKAGE) release $(VERSION) now available" + @echo "============================== CUT HERE ==============================" + @echo "A new $(PACKAGE) release $(VERSION) is now available" + @echo "" + @echo "tar.gz:" + @echo " $(RELEASE_CAIRO_URL)/$(tar_gz)" + @echo " $(RELEASE_XORG_URL)/$(tar_gz)" + @echo "" + @echo "tar.bz2:" + @echo " $(RELEASE_XORG_URL)/$(tar_bz2)" + @echo "" + @echo "Hashes:" + @echo -n " MD5: " + @cat $(md5_tgz) + @echo -n " MD5: " + @cat $(md5_tbz2) + @echo -n " SHA1: " + @cat $(sha1_tgz) + @echo -n " SHA1: " + @cat $(sha1_tbz2) + @echo "" + @echo "GPG signature:" + @echo " $(RELEASE_CAIRO_URL)/$(gpg_file)" + @echo " (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)" + @echo "" + @echo "Git:" + @echo " git://git.freedesktop.org/git/pixman" + @echo " tag: $(PACKAGE)-$(VERSION)" + @echo "" + @echo "Log:" + @git-log --no-merges "$(PACKAGE)-$(PREV)".."$(PACKAGE)-$(VERSION)" | git shortlog | awk '{ printf "\t"; print ; }' | cut -b0-80 + @echo "============================== CUT HERE ==============================" + @echo "" + +release-publish: release-upload release-publish-message + +.PHONY: release-upload release-publish release-publish-message # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/lib/pixman/TODO b/lib/pixman/TODO index 6649c698a..7ff58def8 100644 --- a/lib/pixman/TODO +++ b/lib/pixman/TODO @@ -1,3 +1,43 @@ + - Update the RLEASING file + + - Things to keep in mind if breaking ABI: + + - There should be a guard #ifndef I_AM_EITHER_CAIRO_OR_THE_X_SERVER + + - X server will require 16.16 essentially forever. Can we get + the required precision by simply adding offset_x/y to the + relevant rendering API? + + - pixman_image_set_indexed() should copy its argument, and X + should be ported over to use a pixman_image as the + representation of a Picture, rather than creating one on each + operation. + + - We should get rid of pixman_set_static_pointers() + + - We should get rid of the various trapezoid helper functions(). + (They only exist because they are theoretically available to + drivers). + + - Regions should become 32 bit + + - There should only be one trap rasterization API. + + - The PIXMAN_g8/c8/etc formats should use the A channel + to indicate the actual depth. That way PIXMAN_x4c4 and PIXMAN_c8 + won't collide. + + - Make pixman_region_point_in() survive a NULL box, then fix up + pixman-compose.c + + - Test suite + + - Add a general way of dealing with architecture specific + fast-paths. The current idea is to have each operation that can + be optimized is called through a function pointer that is + initially set to an initialization function that is responsible for + setting the function pointer to the appropriate fast-path. + - Go through things marked FIXME - Add calls to prepare and finish access where necessary. grep for @@ -22,21 +62,23 @@ IC_SHIFT to 5 for all machines. - Consider whether calling regions region16 is really such a great - idea Vlad wants 32 bit regions for Cairo. This will break X server + idea. Vlad wants 32 bit regions for Cairo. This will break X server ABI, but should otherwise be mostly harmless, though a pixman_region_get_boxes16() may be useful. - - Make source clipping optional. - - done: source clipping happens through an indirection. - still needs to make the indirection settable. (And call it - from X) - - Consider optimizing the 8/16 bit solid fills in pixman-util.c by storing more than one value at a time. - Add an image cache to prevent excessive malloc/free. Note that pixman needs to be thread safe when used from cairo. + - Moving to 24.8 coordinates. This is tricky because X is still + defined as 16.16 and will be basically forever. It's possible we + could do this by adding extra offset_x/y parameters to the + trapezoid calls. The X server could then just call the API with + (0, 0). Cairo would have to make sure that the delta *within* a + batch of trapezoids does not exceed 16 bit. + - Review the pixman_format_code_t enum to make sure it will support future formats. Some formats we will probably need: @@ -78,11 +120,26 @@ It may make sense to have a PIXMAN_TYPE_YUV, and then use the channel bits to specify the exact subtype. - What about color spaces such a linear vs. srGB etc.? + Another possibility is to add + PIXMAN_TYPE_ARGB_W + PIXMAN_TYPE_ARGB_WW + + where the channel widths would get 16 and 32 added to them, + respectively. + + What about color spaces such a linear vs. srGB etc.? done: +- Get rid of the switch-of-doom; replace it with a big table + describing the various fast paths. + +- Make source clipping optional. + - done: source clipping happens through an indirection. + still needs to make the indirection settable. (And call it + from X) + - Run cairo test suite; fix bugs - one bug in source-scale-clip diff --git a/lib/pixman/aclocal.m4 b/lib/pixman/aclocal.m4 index bdd1fe98f..bfbf5e1d9 100644 --- a/lib/pixman/aclocal.m4 +++ b/lib/pixman/aclocal.m4 @@ -6396,6 +6396,164 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation diff --git a/lib/pixman/config.h.in b/lib/pixman/config.h.in index 1665dd013..cdcf61ba3 100644 --- a/lib/pixman/config.h.in +++ b/lib/pixman/config.h.in @@ -57,6 +57,12 @@ /* use MMX compiler intrinsics */ #undef USE_MMX +/* use SSE compiler intrinsics */ +#undef USE_SSE + +/* use SSE compiler intrinsics */ +#undef USE_SSE2 + /* Version number of package */ #undef VERSION diff --git a/lib/pixman/configure b/lib/pixman/configure index 7314b7107..1535e84a0 100644 --- a/lib/pixman/configure +++ b/lib/pixman/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for pixman 0.9.6. +# Generated by GNU Autoconf 2.59 for pixman 0.10.0. # # Report bugs to <"sandmann@daimi.au.dk">. # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='pixman' PACKAGE_TARNAME='pixman' -PACKAGE_VERSION='0.9.6' -PACKAGE_STRING='pixman 0.9.6' +PACKAGE_VERSION='0.10.0' +PACKAGE_STRING='pixman 0.10.0' PACKAGE_BUGREPORT='"sandmann@daimi.au.dk"' # Factoring default headers for most tests. @@ -464,7 +464,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PIXMAN_MAJOR LT_VERSION_INFO USE_MMX_TRUE USE_MMX_FALSE USE_SSE_TRUE USE_SSE_FALSE MMX_CFLAGS HAVE_GTK_TRUE HAVE_GTK_FALSE GTK_CFLAGS GTK_LIBS DEP_CFLAGS DEP_LIBS LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PIXMAN_VERSION_MAJOR PIXMAN_VERSION_MINOR PIXMAN_VERSION_MICRO LT_VERSION_INFO USE_MMX_TRUE USE_MMX_FALSE USE_SSE_TRUE USE_SSE_FALSE USE_SSE2_TRUE USE_SSE2_FALSE MMX_CFLAGS SSE_CFLAGS PKG_CONFIG ac_pt_PKG_CONFIG GTK_CFLAGS GTK_LIBS HAVE_GTK_TRUE HAVE_GTK_FALSE DEP_CFLAGS DEP_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -945,6 +945,18 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG +ac_env_GTK_CFLAGS_set=${GTK_CFLAGS+set} +ac_env_GTK_CFLAGS_value=$GTK_CFLAGS +ac_cv_env_GTK_CFLAGS_set=${GTK_CFLAGS+set} +ac_cv_env_GTK_CFLAGS_value=$GTK_CFLAGS +ac_env_GTK_LIBS_set=${GTK_LIBS+set} +ac_env_GTK_LIBS_value=$GTK_LIBS +ac_cv_env_GTK_LIBS_set=${GTK_LIBS+set} +ac_cv_env_GTK_LIBS_value=$GTK_LIBS # # Report the --help message. @@ -953,7 +965,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pixman 0.9.6 to adapt to many kinds of systems. +\`configure' configures pixman 0.10.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1019,7 +1031,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pixman 0.9.6:";; + short | recursive ) echo "Configuration of pixman 0.10.0:";; esac cat <<\_ACEOF @@ -1058,6 +1070,9 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags + PKG_CONFIG path to pkg-config utility + GTK_CFLAGS C compiler flags for GTK, overriding pkg-config + GTK_LIBS linker flags for GTK, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1158,7 +1173,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -pixman configure 0.9.6 +pixman configure 0.10.0 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1172,7 +1187,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pixman $as_me 0.9.6, which was +It was created by pixman $as_me 0.10.0, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1770,7 +1785,7 @@ fi # Define the identity of the package. PACKAGE='pixman' - VERSION='0.9.6' + VERSION='0.10.0' cat >>confdefs.h <<_ACEOF @@ -3628,7 +3643,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3631 "configure"' > conftest.$ac_ext + echo '#line 3646 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5227,7 +5242,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5230:" \ +echo "$as_me:5245:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 @@ -6290,11 +6305,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6293: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6308: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6297: \$? = $ac_status" >&5 + echo "$as_me:6312: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6558,11 +6573,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6561: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6576: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6565: \$? = $ac_status" >&5 + echo "$as_me:6580: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6662,11 +6677,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6665: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6680: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6669: \$? = $ac_status" >&5 + echo "$as_me:6684: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9011,7 +9026,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9014 "configure" +#line 9029 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9111,7 +9126,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9114 "configure" +#line 9129 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11455,11 +11470,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11458: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11473: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11462: \$? = $ac_status" >&5 + echo "$as_me:11477: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11559,11 +11574,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11562: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11577: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11566: \$? = $ac_status" >&5 + echo "$as_me:11581: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13129,11 +13144,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13132: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13147: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13136: \$? = $ac_status" >&5 + echo "$as_me:13151: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13233,11 +13248,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13236: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13251: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13240: \$? = $ac_status" >&5 + echo "$as_me:13255: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15440,11 +15455,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15443: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15458: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15447: \$? = $ac_status" >&5 + echo "$as_me:15462: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15708,11 +15723,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15711: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15726: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15715: \$? = $ac_status" >&5 + echo "$as_me:15730: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15812,11 +15827,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15815: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15830: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15819: \$? = $ac_status" >&5 + echo "$as_me:15834: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18826,9 +18841,13 @@ esac -LT_VERSION_INFO="9:6:9" +LT_VERSION_INFO="10:0:10" -PIXMAN_MAJOR=0 +PIXMAN_VERSION_MAJOR=0 + +PIXMAN_VERSION_MINOR=10 + +PIXMAN_VERSION_MICRO=0 @@ -18842,6 +18861,55 @@ if test "x$GCC" = "xyes"; then *) CFLAGS="$CFLAGS -Wall" ;; esac fi +have_gcc4=no +echo "$as_me:$LINENO: checking for -fvisibility" >&5 +echo $ECHO_N "checking for -fvisibility... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF + +#if defined(__GNUC__) && (__GNUC__ >= 4) +#else +#error Need GCC 4.0 for visibility +#endif +int main () { return 0; } + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + have_gcc4=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test "x$have_gcc4" = "xyes"; then + CFLAGS="$CFLAGS -fvisibility=hidden" +fi +echo "$as_me:$LINENO: result: $have_gcc4" >&5 +echo "${ECHO_T}$have_gcc4" >&6 + + MMX_CFLAGS="-mmmx -Winline --param inline-unit-growth=10000 --param large-function-growth=10000" have_mmx_intrinsics=no @@ -18990,8 +19058,255 @@ fi -#PKG_CHECK_MODULES(GTK, [gtk+-2.0], [HAVE_GTK=yes], [HAVE_GTK=no]) -HAVE_GTK=no +SSE_CFLAGS="-mmmx -msse2 -Winline --param inline-unit-growth=10000 --param large-function-growth=10000" + +have_sse2_intrinsics=no +echo "$as_me:$LINENO: checking whether to use SSE2 intrinsics" >&5 +echo $ECHO_N "checking whether to use SSE2 intrinsics... $ECHO_C" >&6 +xserver_save_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS -msse2 $SSE_CFLAGS" + +cat >conftest.$ac_ext <<_ACEOF + +#include <mmintrin.h> +#include <xmmintrin.h> +int main () { + __m128i a, b, c; + c = _mm_xor_si128 (a, b); + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + have_sse2_intrinsics=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +CFLAGS=$xserver_save_CFLAGS +echo "$as_me:$LINENO: result: $have_sse2_intrinsics" >&5 +echo "${ECHO_T}$have_sse2_intrinsics" >&6 + +if test $have_sse2_intrinsics = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define USE_SSE2 1 +_ACEOF + +fi + + + +if test $have_sse2_intrinsics = yes; then + USE_SSE2_TRUE= + USE_SSE2_FALSE='#' +else + USE_SSE2_TRUE='#' + USE_SSE2_FALSE= +fi + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi + +fi + +pkg_failed=no +echo "$as_me:$LINENO: checking for GTK" >&5 +echo $ECHO_N "checking for GTK... $ECHO_C" >&6 + +if test -n "$PKG_CONFIG"; then + if test -n "$GTK_CFLAGS"; then + pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "gtk+-2.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$GTK_LIBS"; then + pkg_cv_GTK_LIBS="$GTK_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "gtk+-2.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "gtk+-2.0"` + else + GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtk+-2.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTK_PKG_ERRORS" >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + HAVE_GTK=no +elif test $pkg_failed = untried; then + HAVE_GTK=no +else + GTK_CFLAGS=$pkg_cv_GTK_CFLAGS + GTK_LIBS=$pkg_cv_GTK_LIBS + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + HAVE_GTK=yes +fi if test "x$HAVE_GTK" = xyes; then @@ -19008,7 +19323,7 @@ fi - ac_config_files="$ac_config_files pixman-1.pc Makefile pixman/Makefile test/Makefile" + ac_config_files="$ac_config_files pixman-1.pc Makefile pixman/Makefile pixman/pixman-version.h test/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -19135,6 +19450,13 @@ echo "$as_me: error: conditional \"USE_SSE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${USE_SSE2_TRUE}" && test -z "${USE_SSE2_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"USE_SSE2\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"USE_SSE2\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${HAVE_GTK_TRUE}" && test -z "${HAVE_GTK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -19413,7 +19735,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by pixman $as_me 0.9.6, which was +This file was extended by pixman $as_me 0.10.0, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19476,7 +19798,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -pixman config.status 0.9.6 +pixman config.status 0.10.0 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -19589,6 +19911,7 @@ do "pixman-1.pc" ) CONFIG_FILES="$CONFIG_FILES pixman-1.pc" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "pixman/Makefile" ) CONFIG_FILES="$CONFIG_FILES pixman/Makefile" ;; + "pixman/pixman-version.h" ) CONFIG_FILES="$CONFIG_FILES pixman/pixman-version.h" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; @@ -19742,17 +20065,24 @@ s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t -s,@PIXMAN_MAJOR@,$PIXMAN_MAJOR,;t t +s,@PIXMAN_VERSION_MAJOR@,$PIXMAN_VERSION_MAJOR,;t t +s,@PIXMAN_VERSION_MINOR@,$PIXMAN_VERSION_MINOR,;t t +s,@PIXMAN_VERSION_MICRO@,$PIXMAN_VERSION_MICRO,;t t s,@LT_VERSION_INFO@,$LT_VERSION_INFO,;t t s,@USE_MMX_TRUE@,$USE_MMX_TRUE,;t t s,@USE_MMX_FALSE@,$USE_MMX_FALSE,;t t s,@USE_SSE_TRUE@,$USE_SSE_TRUE,;t t s,@USE_SSE_FALSE@,$USE_SSE_FALSE,;t t +s,@USE_SSE2_TRUE@,$USE_SSE2_TRUE,;t t +s,@USE_SSE2_FALSE@,$USE_SSE2_FALSE,;t t s,@MMX_CFLAGS@,$MMX_CFLAGS,;t t -s,@HAVE_GTK_TRUE@,$HAVE_GTK_TRUE,;t t -s,@HAVE_GTK_FALSE@,$HAVE_GTK_FALSE,;t t +s,@SSE_CFLAGS@,$SSE_CFLAGS,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t s,@GTK_LIBS@,$GTK_LIBS,;t t +s,@HAVE_GTK_TRUE@,$HAVE_GTK_TRUE,;t t +s,@HAVE_GTK_FALSE@,$HAVE_GTK_FALSE,;t t s,@DEP_CFLAGS@,$DEP_CFLAGS,;t t s,@DEP_LIBS@,$DEP_LIBS,;t t s,@LIBOBJS@,$LIBOBJS,;t t diff --git a/lib/pixman/configure.ac b/lib/pixman/configure.ac index edbc8c7af..18c744cea 100644 --- a/lib/pixman/configure.ac +++ b/lib/pixman/configure.ac @@ -24,25 +24,40 @@ AC_PREREQ([2.57]) # Pixman versioning scheme # -# - If the changes don't affect API or ABI, then increment pixman_micro -# - If API is added, then increment PIXMAN_MINOR, and set MICRO to 0 +# - The git version must at all times have an odd MICRO version +# number. # -# - If you break ABI, then -# - In the first development release where you break ABI, find all instances of -# "pixman-n" and change it to pixman-(n+1) +# - If you add API, increment the MICRO version to the next largest +# odd number. +# +# - If you release a version that contains new API, then increment +# MINOR and set MICRO to 0. +# +# - If you release a new version that does not contain new API, then +# increment MICRO to the next even number. +# +# - After doing a release, increment MICRO again to make the version +# number in git odd. +# +# - If you break the ABI, then +# +# - increment MAJOR +# +# - In the first development release where you break ABI, find +# all instances of "pixman-n" and change them to pixman-(n+1) # # This needs to be done at least in # configure.ac # all Makefile.am's # pixman-n.pc.in # -# This ensures that binary incompatible versions can be installed in parallel. -# See http://www106.pair.com/rhp/parallel.html for more information -# +# This ensures that binary incompatible versions can be installed +# in parallel. See http://www106.pair.com/rhp/parallel.html for +# more information m4_define([pixman_major], 0) -m4_define([pixman_minor], 9) -m4_define([pixman_micro], 6) +m4_define([pixman_minor], 10) +m4_define([pixman_micro], 0) m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro]) @@ -68,8 +83,12 @@ m4_define([lt_age], [pixman_minor]) LT_VERSION_INFO="lt_current:lt_revision:lt_age" -PIXMAN_MAJOR=pixman_major -AC_SUBST(PIXMAN_MAJOR) +PIXMAN_VERSION_MAJOR=pixman_major() +AC_SUBST(PIXMAN_VERSION_MAJOR) +PIXMAN_VERSION_MINOR=pixman_minor() +AC_SUBST(PIXMAN_VERSION_MINOR) +PIXMAN_VERSION_MICRO=pixman_micro() +AC_SUBST(PIXMAN_VERSION_MICRO) AC_SUBST(LT_VERSION_INFO) @@ -83,6 +102,24 @@ if test "x$GCC" = "xyes"; then *) CFLAGS="$CFLAGS -Wall" ;; esac fi changequote([,])dnl +dnl ========================================================================= +dnl -fvisibility stuff + +have_gcc4=no +AC_MSG_CHECKING(for -fvisibility) +AC_COMPILE_IFELSE([ +#if defined(__GNUC__) && (__GNUC__ >= 4) +#else +#error Need GCC 4.0 for visibility +#endif +int main () { return 0; } +], have_gcc4=yes) + +if test "x$have_gcc4" = "xyes"; then + CFLAGS="$CFLAGS -fvisibility=hidden" +fi +AC_MSG_RESULT($have_gcc4) + dnl =========================================================================== dnl Check for MMX @@ -147,11 +184,39 @@ fi AM_CONDITIONAL(USE_SSE, test $have_sse_intrinsics = yes) + +dnl =========================================================================== +dnl Check for SSE2 + +SSE_CFLAGS="-mmmx -msse2 -Winline --param inline-unit-growth=10000 --param large-function-growth=10000" + +have_sse2_intrinsics=no +AC_MSG_CHECKING(whether to use SSE2 intrinsics) +xserver_save_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS -msse2 $SSE_CFLAGS" + +AC_COMPILE_IFELSE([ +#include <mmintrin.h> +#include <xmmintrin.h> +int main () { + __m128i a, b, c; + c = _mm_xor_si128 (a, b); + return 0; +}], have_sse2_intrinsics=yes) +CFLAGS=$xserver_save_CFLAGS +AC_MSG_RESULT($have_sse2_intrinsics) + +if test $have_sse2_intrinsics = yes ; then + AC_DEFINE(USE_SSE2, 1, [use SSE compiler intrinsics]) +fi + +AM_CONDITIONAL(USE_SSE2, test $have_sse2_intrinsics = yes) + dnl ======================================================== AC_SUBST(MMX_CFLAGS) +AC_SUBST(SSE_CFLAGS) -#PKG_CHECK_MODULES(GTK, [gtk+-2.0], [HAVE_GTK=yes], [HAVE_GTK=no]) -HAVE_GTK=no +PKG_CHECK_MODULES(GTK, [gtk+-2.0], [HAVE_GTK=yes], [HAVE_GTK=no]) AM_CONDITIONAL(HAVE_GTK, [test "x$HAVE_GTK" = xyes]) AC_SUBST(GTK_CFLAGS) @@ -162,4 +227,5 @@ AC_SUBST(DEP_LIBS) AC_OUTPUT([pixman-1.pc Makefile pixman/Makefile + pixman/pixman-version.h test/Makefile]) diff --git a/lib/pixman/pixman/Makefile.am b/lib/pixman/pixman/Makefile.am index 708e0dd89..190df4c57 100644 --- a/lib/pixman/pixman/Makefile.am +++ b/lib/pixman/pixman/Makefile.am @@ -1,31 +1,33 @@ lib_LTLIBRARIES = libpixman-1.la libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -libpixman_1_la_LIBADD = @DEP_LIBS@ -lm libpixmanwrapper.la +libpixman_1_la_LIBADD = @DEP_LIBS@ -lm libpixman_1_la_SOURCES = \ - pixman.h \ - pixman-region.c \ - pixman-private.h \ - pixman-image.c \ - pixman-compose.c \ - pixman-pict.c \ - pixman-utils.c \ - pixman-edge.c \ - pixman-edge-imp.h \ - pixman-trap.c \ - pixman-compute-region.c \ + pixman.h \ + pixman-access.c \ + pixman-access-accessors.c \ + pixman-region.c \ + pixman-private.h \ + pixman-image.c \ + pixman-combine.c \ + pixman-compose.c \ + pixman-compose-accessors.c \ + pixman-pict.c \ + pixman-source.c \ + pixman-transformed.c \ + pixman-transformed-accessors.c \ + pixman-utils.c \ + pixman-edge.c \ + pixman-edge-accessors.c \ + pixman-edge-imp.h \ + pixman-trap.c \ + pixman-compute-region.c \ pixman-timer.c libpixmanincludedir = $(includedir)/pixman-1/ -libpixmaninclude_HEADERS = pixman.h - -# wrapper library -noinst_LTLIBRARIES = libpixmanwrapper.la -libpixmanwrapper_la_SOURCES = \ - pixman-compose.c \ - pixman-edge.c -libpixmanwrapper_la_CFLAGS = $(DEP_CFLAGS) -DPIXMAN_FB_ACCESSORS - +libpixmaninclude_HEADERS = pixman.h pixman-version.h +noinst_LTLIBRARIES = +EXTRA_DIST = Makefile.win32 # mmx code if USE_MMX @@ -37,3 +39,16 @@ libpixman_mmx_la_CFLAGS = $(DEP_CFLAGS) $(MMX_CFLAGS) libpixman_mmx_la_LIBADD = $(DEP_LIBS) libpixman_1_la_LIBADD += libpixman-mmx.la endif + + +# sse2 code +if USE_SSE2 +noinst_LTLIBRARIES += libpixman-sse.la +libpixman_sse_la_SOURCES = \ + pixman-sse.c \ + pixman-sse.h +libpixman_sse_la_CFLAGS = $(DEP_CFLAGS) $(SSE_CFLAGS) +libpixman_sse_la_LIBADD = $(DEP_LIBS) +libpixman_1_la_LIBADD += libpixman-sse.la +endif + diff --git a/lib/pixman/pixman/Makefile.in b/lib/pixman/pixman/Makefile.in index 9405ac53f..d8e122e6e 100644 --- a/lib/pixman/pixman/Makefile.in +++ b/lib/pixman/pixman/Makefile.in @@ -37,17 +37,24 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ + +# mmx code @USE_MMX_TRUE@am__append_1 = libpixman-mmx.la +@USE_MMX_TRUE@am__append_2 = libpixman-mmx.la + +# sse2 code +@USE_SSE2_TRUE@am__append_3 = libpixman-sse.la +@USE_SSE2_TRUE@am__append_4 = libpixman-sse.la subdir = pixman DIST_COMMON = $(libpixmaninclude_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in + $(srcdir)/Makefile.in $(srcdir)/pixman-version.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = pixman-version.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -59,19 +66,30 @@ am__installdirs = "$(DESTDIR)$(libdir)" \ libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) @USE_MMX_TRUE@am__DEPENDENCIES_1 = libpixman-mmx.la -libpixman_1_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_libpixman_1_la_OBJECTS = pixman-region.lo pixman-image.lo \ - pixman-compose.lo pixman-compose-accessors.lo pixman-pict.lo \ +@USE_SSE2_TRUE@am__DEPENDENCIES_2 = libpixman-sse.la +libpixman_1_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) +am_libpixman_1_la_OBJECTS = pixman-access.lo \ + pixman-access-accessors.lo pixman-region.lo pixman-image.lo \ + pixman-combine.lo pixman-compose.lo \ + pixman-compose-accessors.lo pixman-pict.lo pixman-source.lo \ + pixman-transformed.lo pixman-transformed-accessors.lo \ pixman-utils.lo pixman-edge.lo pixman-edge-accessors.lo \ pixman-trap.lo pixman-compute-region.lo pixman-timer.lo libpixman_1_la_OBJECTS = $(am_libpixman_1_la_OBJECTS) -am__DEPENDENCIES_2 = -@USE_MMX_TRUE@libpixman_mmx_la_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__DEPENDENCIES_3 = +@USE_MMX_TRUE@libpixman_mmx_la_DEPENDENCIES = $(am__DEPENDENCIES_3) am__libpixman_mmx_la_SOURCES_DIST = pixman-mmx.c pixman-mmx.h @USE_MMX_TRUE@am_libpixman_mmx_la_OBJECTS = \ @USE_MMX_TRUE@ libpixman_mmx_la-pixman-mmx.lo libpixman_mmx_la_OBJECTS = $(am_libpixman_mmx_la_OBJECTS) @USE_MMX_TRUE@am_libpixman_mmx_la_rpath = +@USE_SSE2_TRUE@libpixman_sse_la_DEPENDENCIES = $(am__DEPENDENCIES_3) +am__libpixman_sse_la_SOURCES_DIST = pixman-sse.c pixman-sse.h +@USE_SSE2_TRUE@am_libpixman_sse_la_OBJECTS = \ +@USE_SSE2_TRUE@ libpixman_sse_la-pixman-sse.lo +libpixman_sse_la_OBJECTS = $(am_libpixman_sse_la_OBJECTS) +@USE_SSE2_TRUE@am_libpixman_sse_la_rpath = DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -83,9 +101,11 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libpixman_1_la_SOURCES) $(libpixman_mmx_la_SOURCES) +SOURCES = $(libpixman_1_la_SOURCES) $(libpixman_mmx_la_SOURCES) \ + $(libpixman_sse_la_SOURCES) DIST_SOURCES = $(libpixman_1_la_SOURCES) \ - $(am__libpixman_mmx_la_SOURCES_DIST) + $(am__libpixman_mmx_la_SOURCES_DIST) \ + $(am__libpixman_sse_la_SOURCES_DIST) libpixmanincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(libpixmaninclude_HEADERS) ETAGS = etags @@ -147,13 +167,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PIXMAN_MAJOR = @PIXMAN_MAJOR@ +PIXMAN_VERSION_MAJOR = @PIXMAN_VERSION_MAJOR@ +PIXMAN_VERSION_MICRO = @PIXMAN_VERSION_MICRO@ +PIXMAN_VERSION_MINOR = @PIXMAN_VERSION_MINOR@ +PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SSE_CFLAGS = @SSE_CFLAGS@ STRIP = @STRIP@ USE_MMX_FALSE = @USE_MMX_FALSE@ USE_MMX_TRUE = @USE_MMX_TRUE@ +USE_SSE2_FALSE = @USE_SSE2_FALSE@ +USE_SSE2_TRUE = @USE_SSE2_TRUE@ USE_SSE_FALSE = @USE_SSE_FALSE@ USE_SSE_TRUE = @USE_SSE_TRUE@ VERSION = @VERSION@ @@ -163,6 +189,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -202,34 +229,45 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ lib_LTLIBRARIES = libpixman-1.la libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -libpixman_1_la_LIBADD = @DEP_LIBS@ -lm $(am__append_1) +libpixman_1_la_LIBADD = @DEP_LIBS@ -lm $(am__append_2) $(am__append_4) libpixman_1_la_SOURCES = \ - pixman.h \ - pixman-region.c \ - pixman-private.h \ - pixman-image.c \ - pixman-compose.c \ + pixman.h \ + pixman-access.c \ + pixman-access-accessors.c \ + pixman-region.c \ + pixman-private.h \ + pixman-image.c \ + pixman-combine.c \ + pixman-compose.c \ pixman-compose-accessors.c \ - pixman-pict.c \ - pixman-utils.c \ - pixman-edge.c \ + pixman-pict.c \ + pixman-source.c \ + pixman-transformed.c \ + pixman-transformed-accessors.c \ + pixman-utils.c \ + pixman-edge.c \ pixman-edge-accessors.c \ - pixman-edge-imp.h \ - pixman-trap.c \ - pixman-compute-region.c \ + pixman-edge-imp.h \ + pixman-trap.c \ + pixman-compute-region.c \ pixman-timer.c libpixmanincludedir = $(includedir)/pixman-1/ -libpixmaninclude_HEADERS = pixman.h - -# mmx code -@USE_MMX_TRUE@noinst_LTLIBRARIES = libpixman-mmx.la +libpixmaninclude_HEADERS = pixman.h pixman-version.h +noinst_LTLIBRARIES = $(am__append_1) $(am__append_3) +EXTRA_DIST = Makefile.win32 @USE_MMX_TRUE@libpixman_mmx_la_SOURCES = \ @USE_MMX_TRUE@ pixman-mmx.c \ @USE_MMX_TRUE@ pixman-mmx.h @USE_MMX_TRUE@libpixman_mmx_la_CFLAGS = $(DEP_CFLAGS) $(MMX_CFLAGS) @USE_MMX_TRUE@libpixman_mmx_la_LIBADD = $(DEP_LIBS) +@USE_SSE2_TRUE@libpixman_sse_la_SOURCES = \ +@USE_SSE2_TRUE@ pixman-sse.c \ +@USE_SSE2_TRUE@ pixman-sse.h + +@USE_SSE2_TRUE@libpixman_sse_la_CFLAGS = $(DEP_CFLAGS) $(SSE_CFLAGS) +@USE_SSE2_TRUE@libpixman_sse_la_LIBADD = $(DEP_LIBS) all: all-am .SUFFIXES: @@ -263,6 +301,8 @@ $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +pixman-version.h: $(top_builddir)/config.status $(srcdir)/pixman-version.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @@ -303,6 +343,8 @@ libpixman-1.la: $(libpixman_1_la_OBJECTS) $(libpixman_1_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libpixman_1_la_LDFLAGS) $(libpixman_1_la_OBJECTS) $(libpixman_1_la_LIBADD) $(LIBS) libpixman-mmx.la: $(libpixman_mmx_la_OBJECTS) $(libpixman_mmx_la_DEPENDENCIES) $(LINK) $(am_libpixman_mmx_la_rpath) $(libpixman_mmx_la_LDFLAGS) $(libpixman_mmx_la_OBJECTS) $(libpixman_mmx_la_LIBADD) $(LIBS) +libpixman-sse.la: $(libpixman_sse_la_OBJECTS) $(libpixman_sse_la_DEPENDENCIES) + $(LINK) $(am_libpixman_sse_la_rpath) $(libpixman_sse_la_LDFLAGS) $(libpixman_sse_la_OBJECTS) $(libpixman_sse_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -311,6 +353,10 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpixman_mmx_la-pixman-mmx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpixman_sse_la-pixman-sse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-access-accessors.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-access.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-combine.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-compose-accessors.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-compose.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-compute-region.Plo@am__quote@ @@ -319,7 +365,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-image.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-pict.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-region.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-source.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-timer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-transformed-accessors.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-transformed.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-trap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-utils.Plo@am__quote@ @@ -351,6 +400,13 @@ libpixman_mmx_la-pixman-mmx.lo: pixman-mmx.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpixman_mmx_la_CFLAGS) $(CFLAGS) -c -o libpixman_mmx_la-pixman-mmx.lo `test -f 'pixman-mmx.c' || echo '$(srcdir)/'`pixman-mmx.c +libpixman_sse_la-pixman-sse.lo: pixman-sse.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpixman_sse_la_CFLAGS) $(CFLAGS) -MT libpixman_sse_la-pixman-sse.lo -MD -MP -MF "$(DEPDIR)/libpixman_sse_la-pixman-sse.Tpo" -c -o libpixman_sse_la-pixman-sse.lo `test -f 'pixman-sse.c' || echo '$(srcdir)/'`pixman-sse.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libpixman_sse_la-pixman-sse.Tpo" "$(DEPDIR)/libpixman_sse_la-pixman-sse.Plo"; else rm -f "$(DEPDIR)/libpixman_sse_la-pixman-sse.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pixman-sse.c' object='libpixman_sse_la-pixman-sse.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpixman_sse_la_CFLAGS) $(CFLAGS) -c -o libpixman_sse_la-pixman-sse.lo `test -f 'pixman-sse.c' || echo '$(srcdir)/'`pixman-sse.c + mostlyclean-libtool: -rm -f *.lo diff --git a/lib/pixman/pixman/pixman-compose.c b/lib/pixman/pixman/pixman-compose.c index b48251d54..6f524d6f8 100644 --- a/lib/pixman/pixman/pixman-compose.c +++ b/lib/pixman/pixman/pixman-compose.c @@ -23,7 +23,9 @@ * SOFTWARE. */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #include <stdlib.h> #include <string.h> @@ -33,19 +35,32 @@ #include "pixman-private.h" -/* - * FIXME: - * The stuff here is added just to get it to compile. Something sensible needs to - * be done before this can be used. - * - * we should go through this code and clean up some of the weird stuff that have - * resulted from unmacro-ifying it. - * - */ -#define INLINE inline +#ifdef PIXMAN_FB_ACCESSORS +#define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_accessors +#define PIXMAN_COMPOSE_FUNCTIONS pixman_composeFunctions_accessors + +#define FETCH_PROC_FOR_PICTURE pixman_fetchProcForPicture_accessors +#define FETCH_PIXEL_PROC_FOR_PICTURE pixman_fetchPixelProcForPicture_accessors +#define STORE_PROC_FOR_PICTURE pixman_storeProcForPicture_accessors + +#define FB_FETCH_TRANSFORMED fbFetchTransformed_accessors +#define FB_FETCH_EXTERNAL_ALPHA fbFetchExternalAlpha_accessors +#define FB_STORE_EXTERNAL_ALPHA fbStoreExternalAlpha_accessors + +#else + +#define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_no_accessors +#define PIXMAN_COMPOSE_FUNCTIONS pixman_composeFunctions -/* End of stuff added to get it to compile - */ +#define FETCH_PROC_FOR_PICTURE pixman_fetchProcForPicture +#define FETCH_PIXEL_PROC_FOR_PICTURE pixman_fetchPixelProcForPicture +#define STORE_PROC_FOR_PICTURE pixman_storeProcForPicture + +#define FB_FETCH_TRANSFORMED fbFetchTransformed +#define FB_FETCH_EXTERNAL_ALPHA fbFetchExternalAlpha +#define FB_STORE_EXTERNAL_ALPHA fbStoreExternalAlpha + +#endif static unsigned int SourcePictureClassify (source_image_t *pict, @@ -66,7 +81,7 @@ SourcePictureClassify (source_image_t *pict, pixman_fixed_48_16_t dx, dy, a, b, off; pixman_fixed_48_16_t factors[4]; int i; - + dx = linear->p2.x - linear->p1.x; dy = linear->p2.y - linear->p1.y; l = dx * dx + dy * dy; @@ -79,2824 +94,53 @@ SourcePictureClassify (source_image_t *pict, { a = b = 0; } - + off = (-a * linear->p1.x -b * linear->p1.y) >> 16; - + for (i = 0; i < 3; i++) { v.vector[0] = pixman_int_to_fixed ((i % 2) * (width - 1) + x); v.vector[1] = pixman_int_to_fixed ((i / 2) * (height - 1) + y); v.vector[2] = pixman_fixed_1; - + if (pict->common.transform) { if (!pixman_transform_point_3d (pict->common.transform, &v)) return SOURCE_IMAGE_CLASS_UNKNOWN; } - + factors[i] = ((a * v.vector[0] + b * v.vector[1]) >> 16) + off; } - + if (factors[2] == factors[0]) pict->class = SOURCE_IMAGE_CLASS_HORIZONTAL; else if (factors[1] == factors[0]) pict->class = SOURCE_IMAGE_CLASS_VERTICAL; } - - return pict->class; -} - -#define SCANLINE_BUFFER_LENGTH 2048 - -typedef FASTCALL void (*fetchProc)(pixman_image_t *image, - const uint32_t *bits, - int x, int width, - uint32_t *buffer, - const pixman_indexed_t * indexed); - -/* - * All of the fetch functions - */ - -static FASTCALL void -fbFetch_a8r8g8b8 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - MEMCPY_WRAPPED(buffer, (const uint32_t *)bits + x, - width*sizeof(uint32_t)); -} - -static FASTCALL void -fbFetch_x8r8g8b8 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - const uint32_t *pixel = (const uint32_t *)bits + x; - const uint32_t *end = pixel + width; - while (pixel < end) { - *buffer++ = READ(pixel++) | 0xff000000; - } -} - -static FASTCALL void -fbFetch_a8b8g8r8 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - const uint32_t *pixel = (uint32_t *)bits + x; - const uint32_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - *buffer++ = (p & 0xff00ff00) | - ((p >> 16) & 0xff) | - ((p & 0xff) << 16); - } -} - -static FASTCALL void -fbFetch_x8b8g8r8 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - const uint32_t *pixel = (uint32_t *)bits + x; - const uint32_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - *buffer++ = 0xff000000 | - (p & 0x0000ff00) | - ((p >> 16) & 0xff) | - ((p & 0xff) << 16); - } -} - -static FASTCALL void -fbFetch_r8g8b8 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - const uint8_t *pixel = (const uint8_t *)bits + 3*x; - const uint8_t *end = pixel + 3*width; - while (pixel < end) { - uint32_t b = Fetch24(pixel) | 0xff000000; - pixel += 3; - *buffer++ = b; - } -} - -static FASTCALL void -fbFetch_b8g8r8 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - const uint8_t *pixel = (const uint8_t *)bits + 3*x; - const uint8_t *end = pixel + 3*width; - while (pixel < end) { - uint32_t b = 0xff000000; -#if IMAGE_BYTE_ORDER == MSBFirst - b |= (READ(pixel++)); - b |= (READ(pixel++) << 8); - b |= (READ(pixel++) << 16); -#else - b |= (READ(pixel++) << 16); - b |= (READ(pixel++) << 8); - b |= (READ(pixel++)); -#endif - *buffer++ = b; - } -} - -static FASTCALL void -fbFetch_r5g6b5 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, - const pixman_indexed_t * indexed) -{ - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - uint32_t r = (((p) << 3) & 0xf8) | - (((p) << 5) & 0xfc00) | - (((p) << 8) & 0xf80000); - r |= (r >> 5) & 0x70007; - r |= (r >> 6) & 0x300; - *buffer++ = 0xff000000 | r; - } -} - -static FASTCALL void -fbFetch_b5g6r5 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, - const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - b = ((p & 0xf800) | ((p & 0xe000) >> 5)) >> 8; - g = ((p & 0x07e0) | ((p & 0x0600) >> 6)) << 5; - r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; - *buffer++ = 0xff000000 | r | g | b; - } -} - -static FASTCALL void -fbFetch_a1r5g5b5 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b, a; - - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - a = (uint32_t) ((uint8_t) (0 - ((p & 0x8000) >> 15))) << 24; - r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; - g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; - b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; - *buffer++ = a | r | g | b; - } -} - -static FASTCALL void -fbFetch_x1r5g5b5 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; - g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; - b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; - *buffer++ = 0xff000000 | r | g | b; - } -} - -static FASTCALL void -fbFetch_a1b5g5r5 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b, a; - - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - a = (uint32_t) ((uint8_t) (0 - ((p & 0x8000) >> 15))) << 24; - b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7; - g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; - r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; - *buffer++ = a | r | g | b; - } -} - -static FASTCALL void -fbFetch_x1b5g5r5 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7; - g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; - r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; - *buffer++ = 0xff000000 | r | g | b; - } -} - -static FASTCALL void -fbFetch_a4r4g4b4 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b, a; - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; - r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; - g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; - b = ((p & 0x000f) | ((p & 0x000f) << 4)); - *buffer++ = a | r | g | b; - } -} - -static FASTCALL void -fbFetch_x4r4g4b4 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; - g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; - b = ((p & 0x000f) | ((p & 0x000f) << 4)); - *buffer++ = 0xff000000 | r | g | b; - } -} - -static FASTCALL void -fbFetch_a4b4g4r4 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b, a; - - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; - b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4; - g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; - r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16; - *buffer++ = a | r | g | b; - } -} - -static FASTCALL void -fbFetch_x4b4g4r4 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - - const uint16_t *pixel = (const uint16_t *)bits + x; - const uint16_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4; - g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; - r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16; - *buffer++ = 0xff000000 | r | g | b; - } -} - -static FASTCALL void -fbFetch_a8 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - const uint8_t *pixel = (const uint8_t *)bits + x; - const uint8_t *end = pixel + width; - while (pixel < end) { - *buffer++ = READ(pixel++) << 24; - } -} - -static FASTCALL void -fbFetch_r3g3b2 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - - const uint8_t *pixel = (const uint8_t *)bits + x; - const uint8_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - r = ((p & 0xe0) | ((p & 0xe0) >> 3) | ((p & 0xc0) >> 6)) << 16; - g = ((p & 0x1c) | ((p & 0x18) >> 3) | ((p & 0x1c) << 3)) << 8; - b = (((p & 0x03) ) | - ((p & 0x03) << 2) | - ((p & 0x03) << 4) | - ((p & 0x03) << 6)); - *buffer++ = 0xff000000 | r | g | b; - } -} - -static FASTCALL void -fbFetch_b2g3r3 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - - const uint8_t *pixel = (const uint8_t *)bits + x; - const uint8_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - b = (((p & 0xc0) ) | - ((p & 0xc0) >> 2) | - ((p & 0xc0) >> 4) | - ((p & 0xc0) >> 6)); - g = ((p & 0x38) | ((p & 0x38) >> 3) | ((p & 0x30) << 2)) << 8; - r = (((p & 0x07) ) | - ((p & 0x07) << 3) | - ((p & 0x06) << 6)) << 16; - *buffer++ = 0xff000000 | r | g | b; - } -} - -static FASTCALL void -fbFetch_a2r2g2b2 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - const uint8_t *pixel = (const uint8_t *)bits + x; - const uint8_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - a = ((p & 0xc0) * 0x55) << 18; - r = ((p & 0x30) * 0x55) << 12; - g = ((p & 0x0c) * 0x55) << 6; - b = ((p & 0x03) * 0x55); - *buffer++ = a|r|g|b; - } -} - -static FASTCALL void -fbFetch_a2b2g2r2 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - const uint8_t *pixel = (const uint8_t *)bits + x; - const uint8_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - - a = ((p & 0xc0) * 0x55) << 18; - b = ((p & 0x30) * 0x55) >> 6; - g = ((p & 0x0c) * 0x55) << 6; - r = ((p & 0x03) * 0x55) << 16; - *buffer++ = a|r|g|b; - } -} - -static FASTCALL void -fbFetch_c8 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - const uint8_t *pixel = (const uint8_t *)bits + x; - const uint8_t *end = pixel + width; - while (pixel < end) { - uint32_t p = READ(pixel++); - *buffer++ = indexed->rgba[p]; - } -} - -static FASTCALL void -fbFetch_x4a4 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - const uint8_t *pixel = (const uint8_t *)bits + x; - const uint8_t *end = pixel + width; - while (pixel < end) { - uint8_t p = READ(pixel++) & 0xf; - *buffer++ = (p | (p << 4)) << 24; - } -} - -#define Fetch8(l,o) (READ((uint8_t *)(l) + ((o) >> 2))) -#if IMAGE_BYTE_ORDER == MSBFirst -#define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4) -#else -#define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) >> 4 : Fetch8(l,o) & 0xf) -#endif - -static FASTCALL void -fbFetch_a4 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t p = Fetch4(bits, i + x); - - p |= p << 4; - *buffer++ = p << 24; - } -} - -static FASTCALL void -fbFetch_r1g2b1 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - int i; - for (i = 0; i < width; ++i) { - uint32_t p = Fetch4(bits, i + x); - - r = ((p & 0x8) * 0xff) << 13; - g = ((p & 0x6) * 0x55) << 7; - b = ((p & 0x1) * 0xff); - *buffer++ = 0xff000000|r|g|b; - } -} - -static FASTCALL void -fbFetch_b1g2r1 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - int i; - for (i = 0; i < width; ++i) { - uint32_t p = Fetch4(bits, i + x); - - b = ((p & 0x8) * 0xff) >> 3; - g = ((p & 0x6) * 0x55) << 7; - r = ((p & 0x1) * 0xff) << 16; - *buffer++ = 0xff000000|r|g|b; - } -} - -static FASTCALL void -fbFetch_a1r1g1b1 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - int i; - for (i = 0; i < width; ++i) { - uint32_t p = Fetch4(bits, i + x); - - a = ((p & 0x8) * 0xff) << 21; - r = ((p & 0x4) * 0xff) << 14; - g = ((p & 0x2) * 0xff) << 7; - b = ((p & 0x1) * 0xff); - *buffer++ = a|r|g|b; - } -} - -static FASTCALL void -fbFetch_a1b1g1r1 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - int i; - for (i = 0; i < width; ++i) { - uint32_t p = Fetch4(bits, i + x); - - a = ((p & 0x8) * 0xff) << 21; - r = ((p & 0x4) * 0xff) >> 3; - g = ((p & 0x2) * 0xff) << 7; - b = ((p & 0x1) * 0xff) << 16; - *buffer++ = a|r|g|b; - } -} - -static FASTCALL void -fbFetch_c4 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t p = Fetch4(bits, i + x); - - *buffer++ = indexed->rgba[p]; - } -} - - -static FASTCALL void -fbFetch_a1 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t p = READ(bits + ((i + x) >> 5)); - uint32_t a; -#if BITMAP_BIT_ORDER == MSBFirst - a = p >> (0x1f - ((i+x) & 0x1f)); -#else - a = p >> ((i+x) & 0x1f); -#endif - a = a & 1; - a |= a << 1; - a |= a << 2; - a |= a << 4; - *buffer++ = a << 24; - } -} - -static FASTCALL void -fbFetch_g1 (pixman_image_t *image, - const uint32_t *bits, int x, int width, uint32_t *buffer, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t p = READ(bits + ((i+x) >> 5)); - uint32_t a; -#if BITMAP_BIT_ORDER == MSBFirst - a = p >> (0x1f - ((i+x) & 0x1f)); -#else - a = p >> ((i+x) & 0x1f); -#endif - a = a & 1; - *buffer++ = indexed->rgba[a]; - } -} - -static fetchProc fetchProcForPicture (bits_image_t * pict) -{ - switch(pict->format) { - case PIXMAN_a8r8g8b8: return fbFetch_a8r8g8b8; - case PIXMAN_x8r8g8b8: return fbFetch_x8r8g8b8; - case PIXMAN_a8b8g8r8: return fbFetch_a8b8g8r8; - case PIXMAN_x8b8g8r8: return fbFetch_x8b8g8r8; - - /* 24bpp formats */ - case PIXMAN_r8g8b8: return fbFetch_r8g8b8; - case PIXMAN_b8g8r8: return fbFetch_b8g8r8; - - /* 16bpp formats */ - case PIXMAN_r5g6b5: return fbFetch_r5g6b5; - case PIXMAN_b5g6r5: return fbFetch_b5g6r5; - - case PIXMAN_a1r5g5b5: return fbFetch_a1r5g5b5; - case PIXMAN_x1r5g5b5: return fbFetch_x1r5g5b5; - case PIXMAN_a1b5g5r5: return fbFetch_a1b5g5r5; - case PIXMAN_x1b5g5r5: return fbFetch_x1b5g5r5; - case PIXMAN_a4r4g4b4: return fbFetch_a4r4g4b4; - case PIXMAN_x4r4g4b4: return fbFetch_x4r4g4b4; - case PIXMAN_a4b4g4r4: return fbFetch_a4b4g4r4; - case PIXMAN_x4b4g4r4: return fbFetch_x4b4g4r4; - - /* 8bpp formats */ - case PIXMAN_a8: return fbFetch_a8; - case PIXMAN_r3g3b2: return fbFetch_r3g3b2; - case PIXMAN_b2g3r3: return fbFetch_b2g3r3; - case PIXMAN_a2r2g2b2: return fbFetch_a2r2g2b2; - case PIXMAN_a2b2g2r2: return fbFetch_a2b2g2r2; - case PIXMAN_c8: return fbFetch_c8; - case PIXMAN_g8: return fbFetch_c8; - case PIXMAN_x4a4: return fbFetch_x4a4; - - /* 4bpp formats */ - case PIXMAN_a4: return fbFetch_a4; - case PIXMAN_r1g2b1: return fbFetch_r1g2b1; - case PIXMAN_b1g2r1: return fbFetch_b1g2r1; - case PIXMAN_a1r1g1b1: return fbFetch_a1r1g1b1; - case PIXMAN_a1b1g1r1: return fbFetch_a1b1g1r1; - case PIXMAN_c4: return fbFetch_c4; - case PIXMAN_g4: return fbFetch_c4; - - /* 1bpp formats */ - case PIXMAN_a1: return fbFetch_a1; - case PIXMAN_g1: return fbFetch_g1; - } - - return NULL; -} - -/* - * Pixel wise fetching - */ - -typedef FASTCALL uint32_t (*fetchPixelProc)(pixman_image_t *image, - const uint32_t *bits, int offset, - const pixman_indexed_t * indexed); - -static FASTCALL uint32_t -fbFetchPixel_a8r8g8b8 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - return READ((uint32_t *)bits + offset); -} - -static FASTCALL uint32_t -fbFetchPixel_x8r8g8b8 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - return READ((uint32_t *)bits + offset) | 0xff000000; -} - -static FASTCALL uint32_t -fbFetchPixel_a8b8g8r8 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = READ((uint32_t *)bits + offset); - - return ((pixel & 0xff000000) | - ((pixel >> 16) & 0xff) | - (pixel & 0x0000ff00) | - ((pixel & 0xff) << 16)); -} - -static FASTCALL uint32_t -fbFetchPixel_x8b8g8r8 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = READ((uint32_t *)bits + offset); - - return ((0xff000000) | - ((pixel >> 16) & 0xff) | - (pixel & 0x0000ff00) | - ((pixel & 0xff) << 16)); -} - -static FASTCALL uint32_t -fbFetchPixel_r8g8b8 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint8_t *pixel = ((uint8_t *) bits) + (offset*3); -#if IMAGE_BYTE_ORDER == MSBFirst - return (0xff000000 | - (READ(pixel + 0) << 16) | - (READ(pixel + 1) << 8) | - (READ(pixel + 2))); -#else - return (0xff000000 | - (READ(pixel + 2) << 16) | - (READ(pixel + 1) << 8) | - (READ(pixel + 0))); -#endif -} - -static FASTCALL uint32_t -fbFetchPixel_b8g8r8 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint8_t *pixel = ((uint8_t *) bits) + (offset*3); -#if IMAGE_BYTE_ORDER == MSBFirst - return (0xff000000 | - (READ(pixel + 2) << 16) | - (READ(pixel + 1) << 8) | - (READ(pixel + 0))); -#else - return (0xff000000 | - (READ(pixel + 0) << 16) | - (READ(pixel + 1) << 8) | - (READ(pixel + 2))); -#endif -} - -static FASTCALL uint32_t -fbFetchPixel_r5g6b5 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8; - g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; - b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; - return (0xff000000 | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_b5g6r5 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8; - g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; - r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; - return (0xff000000 | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_a1r5g5b5 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24; - r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; - g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; - b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; - return (a | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_x1r5g5b5 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; - g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; - b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; - return (0xff000000 | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_a1b5g5r5 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24; - b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; - g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; - r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; - return (a | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_x1b5g5r5 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; - g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; - r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; - return (0xff000000 | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_a4r4g4b4 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; - r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; - g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; - b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); - return (a | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_x4r4g4b4 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; - g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; - b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); - return (0xff000000 | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_a4b4g4r4 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; - b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4; - g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; - r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16; - return (a | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_x4b4g4r4 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = READ((uint16_t *) bits + offset); - - b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4; - g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; - r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16; - return (0xff000000 | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_a8 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = READ((uint8_t *) bits + offset); - - return pixel << 24; -} - -static FASTCALL uint32_t -fbFetchPixel_r3g3b2 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = READ((uint8_t *) bits + offset); - - r = ((pixel & 0xe0) | ((pixel & 0xe0) >> 3) | ((pixel & 0xc0) >> 6)) << 16; - g = ((pixel & 0x1c) | ((pixel & 0x18) >> 3) | ((pixel & 0x1c) << 3)) << 8; - b = (((pixel & 0x03) ) | - ((pixel & 0x03) << 2) | - ((pixel & 0x03) << 4) | - ((pixel & 0x03) << 6)); - return (0xff000000 | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_b2g3r3 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = READ((uint8_t *) bits + offset); - - b = (((pixel & 0xc0) ) | - ((pixel & 0xc0) >> 2) | - ((pixel & 0xc0) >> 4) | - ((pixel & 0xc0) >> 6)); - g = ((pixel & 0x38) | ((pixel & 0x38) >> 3) | ((pixel & 0x30) << 2)) << 8; - r = (((pixel & 0x07) ) | - ((pixel & 0x07) << 3) | - ((pixel & 0x06) << 6)) << 16; - return (0xff000000 | r | g | b); -} - -static FASTCALL uint32_t -fbFetchPixel_a2r2g2b2 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - uint32_t pixel = READ((uint8_t *) bits + offset); - - a = ((pixel & 0xc0) * 0x55) << 18; - r = ((pixel & 0x30) * 0x55) << 12; - g = ((pixel & 0x0c) * 0x55) << 6; - b = ((pixel & 0x03) * 0x55); - return a|r|g|b; -} - -static FASTCALL uint32_t -fbFetchPixel_a2b2g2r2 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - uint32_t pixel = READ((uint8_t *) bits + offset); - - a = ((pixel & 0xc0) * 0x55) << 18; - b = ((pixel & 0x30) * 0x55) >> 6; - g = ((pixel & 0x0c) * 0x55) << 6; - r = ((pixel & 0x03) * 0x55) << 16; - return a|r|g|b; -} - -static FASTCALL uint32_t -fbFetchPixel_c8 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = READ((uint8_t *) bits + offset); - return indexed->rgba[pixel]; -} - -static FASTCALL uint32_t -fbFetchPixel_x4a4 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = READ((uint8_t *) bits + offset); - - return ((pixel & 0xf) | ((pixel & 0xf) << 4)) << 24; -} - -static FASTCALL uint32_t -fbFetchPixel_a4 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = Fetch4(bits, offset); - - pixel |= pixel << 4; - return pixel << 24; -} - -static FASTCALL uint32_t -fbFetchPixel_r1g2b1 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = Fetch4(bits, offset); - - r = ((pixel & 0x8) * 0xff) << 13; - g = ((pixel & 0x6) * 0x55) << 7; - b = ((pixel & 0x1) * 0xff); - return 0xff000000|r|g|b; -} - -static FASTCALL uint32_t -fbFetchPixel_b1g2r1 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t r,g,b; - uint32_t pixel = Fetch4(bits, offset); - - b = ((pixel & 0x8) * 0xff) >> 3; - g = ((pixel & 0x6) * 0x55) << 7; - r = ((pixel & 0x1) * 0xff) << 16; - return 0xff000000|r|g|b; -} - -static FASTCALL uint32_t -fbFetchPixel_a1r1g1b1 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - uint32_t pixel = Fetch4(bits, offset); - - a = ((pixel & 0x8) * 0xff) << 21; - r = ((pixel & 0x4) * 0xff) << 14; - g = ((pixel & 0x2) * 0xff) << 7; - b = ((pixel & 0x1) * 0xff); - return a|r|g|b; -} - -static FASTCALL uint32_t -fbFetchPixel_a1b1g1r1 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t a,r,g,b; - uint32_t pixel = Fetch4(bits, offset); - - a = ((pixel & 0x8) * 0xff) << 21; - r = ((pixel & 0x4) * 0xff) >> 3; - g = ((pixel & 0x2) * 0xff) << 7; - b = ((pixel & 0x1) * 0xff) << 16; - return a|r|g|b; -} - -static FASTCALL uint32_t -fbFetchPixel_c4 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = Fetch4(bits, offset); - - return indexed->rgba[pixel]; -} - - -static FASTCALL uint32_t -fbFetchPixel_a1 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = READ(bits + (offset >> 5)); - uint32_t a; -#if BITMAP_BIT_ORDER == MSBFirst - a = pixel >> (0x1f - (offset & 0x1f)); -#else - a = pixel >> (offset & 0x1f); -#endif - a = a & 1; - a |= a << 1; - a |= a << 2; - a |= a << 4; - return a << 24; -} - -static FASTCALL uint32_t -fbFetchPixel_g1 (pixman_image_t *image, - const uint32_t *bits, int offset, const pixman_indexed_t * indexed) -{ - uint32_t pixel = READ(bits + (offset >> 5)); - uint32_t a; -#if BITMAP_BIT_ORDER == MSBFirst - a = pixel >> (0x1f - (offset & 0x1f)); -#else - a = pixel >> (offset & 0x1f); -#endif - a = a & 1; - return indexed->rgba[a]; -} - -static fetchPixelProc fetchPixelProcForPicture (bits_image_t * pict) -{ - switch(pict->format) { - case PIXMAN_a8r8g8b8: return fbFetchPixel_a8r8g8b8; - case PIXMAN_x8r8g8b8: return fbFetchPixel_x8r8g8b8; - case PIXMAN_a8b8g8r8: return fbFetchPixel_a8b8g8r8; - case PIXMAN_x8b8g8r8: return fbFetchPixel_x8b8g8r8; - - /* 24bpp formats */ - case PIXMAN_r8g8b8: return fbFetchPixel_r8g8b8; - case PIXMAN_b8g8r8: return fbFetchPixel_b8g8r8; - - /* 16bpp formats */ - case PIXMAN_r5g6b5: return fbFetchPixel_r5g6b5; - case PIXMAN_b5g6r5: return fbFetchPixel_b5g6r5; - - case PIXMAN_a1r5g5b5: return fbFetchPixel_a1r5g5b5; - case PIXMAN_x1r5g5b5: return fbFetchPixel_x1r5g5b5; - case PIXMAN_a1b5g5r5: return fbFetchPixel_a1b5g5r5; - case PIXMAN_x1b5g5r5: return fbFetchPixel_x1b5g5r5; - case PIXMAN_a4r4g4b4: return fbFetchPixel_a4r4g4b4; - case PIXMAN_x4r4g4b4: return fbFetchPixel_x4r4g4b4; - case PIXMAN_a4b4g4r4: return fbFetchPixel_a4b4g4r4; - case PIXMAN_x4b4g4r4: return fbFetchPixel_x4b4g4r4; - - /* 8bpp formats */ - case PIXMAN_a8: return fbFetchPixel_a8; - case PIXMAN_r3g3b2: return fbFetchPixel_r3g3b2; - case PIXMAN_b2g3r3: return fbFetchPixel_b2g3r3; - case PIXMAN_a2r2g2b2: return fbFetchPixel_a2r2g2b2; - case PIXMAN_a2b2g2r2: return fbFetchPixel_a2b2g2r2; - case PIXMAN_c8: return fbFetchPixel_c8; - case PIXMAN_g8: return fbFetchPixel_c8; - case PIXMAN_x4a4: return fbFetchPixel_x4a4; - - /* 4bpp formats */ - case PIXMAN_a4: return fbFetchPixel_a4; - case PIXMAN_r1g2b1: return fbFetchPixel_r1g2b1; - case PIXMAN_b1g2r1: return fbFetchPixel_b1g2r1; - case PIXMAN_a1r1g1b1: return fbFetchPixel_a1r1g1b1; - case PIXMAN_a1b1g1r1: return fbFetchPixel_a1b1g1r1; - case PIXMAN_c4: return fbFetchPixel_c4; - case PIXMAN_g4: return fbFetchPixel_c4; - - /* 1bpp formats */ - case PIXMAN_a1: return fbFetchPixel_a1; - case PIXMAN_g1: return fbFetchPixel_g1; - } - - return NULL; -} - - - -/* - * All the store functions - */ - -typedef FASTCALL void (*storeProc) (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed); - -#define Splita(v) uint32_t a = ((v) >> 24), r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff -#define Split(v) uint32_t r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff - -static FASTCALL void -fbStore_a8r8g8b8 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - MEMCPY_WRAPPED(((uint32_t *)bits) + x, values, width*sizeof(uint32_t)); -} - -static FASTCALL void -fbStore_x8r8g8b8 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint32_t *pixel = (uint32_t *)bits + x; - for (i = 0; i < width; ++i) - WRITE(pixel++, values[i] & 0xffffff); -} - -static FASTCALL void -fbStore_a8b8g8r8 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint32_t *pixel = (uint32_t *)bits + x; - for (i = 0; i < width; ++i) - WRITE(pixel++, (values[i] & 0xff00ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16)); -} - -static FASTCALL void -fbStore_x8b8g8r8 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint32_t *pixel = (uint32_t *)bits + x; - for (i = 0; i < width; ++i) - WRITE(pixel++, (values[i] & 0x0000ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16)); -} - -static FASTCALL void -fbStore_r8g8b8 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, - const pixman_indexed_t * indexed) -{ - int i; - uint8_t *pixel = ((uint8_t *) bits) + 3*x; - for (i = 0; i < width; ++i) { - Store24(pixel, values[i]); - pixel += 3; - } -} - -static FASTCALL void -fbStore_b8g8r8 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint8_t *pixel = ((uint8_t *) bits) + 3*x; - for (i = 0; i < width; ++i) { - uint32_t val = values[i]; -#if IMAGE_BYTE_ORDER == MSBFirst - WRITE(pixel++, Blue(val)); - WRITE(pixel++, Green(val)); - WRITE(pixel++, Red(val)); -#else - WRITE(pixel++, Red(val)); - WRITE(pixel++, Green(val)); - WRITE(pixel++, Blue(val)); -#endif - } -} - -static FASTCALL void -fbStore_r5g6b5 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - uint32_t s = values[i]; - WRITE(pixel++, ((s >> 3) & 0x001f) | - ((s >> 5) & 0x07e0) | - ((s >> 8) & 0xf800)); - } -} - -static FASTCALL void -fbStore_b5g6r5 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Split(values[i]); - WRITE(pixel++, ((b << 8) & 0xf800) | - ((g << 3) & 0x07e0) | - ((r >> 3) )); - } -} - -static FASTCALL void -fbStore_a1r5g5b5 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Splita(values[i]); - WRITE(pixel++, ((a << 8) & 0x8000) | - ((r << 7) & 0x7c00) | - ((g << 2) & 0x03e0) | - ((b >> 3) )); - } -} - -static FASTCALL void -fbStore_x1r5g5b5 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Split(values[i]); - WRITE(pixel++, ((r << 7) & 0x7c00) | - ((g << 2) & 0x03e0) | - ((b >> 3) )); - } -} - -static FASTCALL void -fbStore_a1b5g5r5 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Splita(values[i]); - WRITE(pixel++, ((a << 8) & 0x8000) | - ((b << 7) & 0x7c00) | - ((g << 2) & 0x03e0) | - ((r >> 3) )); - } -} - -static FASTCALL void -fbStore_x1b5g5r5 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Split(values[i]); - WRITE(pixel++, ((b << 7) & 0x7c00) | - ((g << 2) & 0x03e0) | - ((r >> 3) )); - } -} - -static FASTCALL void -fbStore_a4r4g4b4 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Splita(values[i]); - WRITE(pixel++, ((a << 8) & 0xf000) | - ((r << 4) & 0x0f00) | - ((g ) & 0x00f0) | - ((b >> 4) )); - } -} - -static FASTCALL void -fbStore_x4r4g4b4 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Split(values[i]); - WRITE(pixel++, ((r << 4) & 0x0f00) | - ((g ) & 0x00f0) | - ((b >> 4) )); - } -} - -static FASTCALL void -fbStore_a4b4g4r4 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Splita(values[i]); - WRITE(pixel++, ((a << 8) & 0xf000) | - ((b << 4) & 0x0f00) | - ((g ) & 0x00f0) | - ((r >> 4) )); - } -} - -static FASTCALL void -fbStore_x4b4g4r4 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint16_t *pixel = ((uint16_t *) bits) + x; - for (i = 0; i < width; ++i) { - Split(values[i]); - WRITE(pixel++, ((b << 4) & 0x0f00) | - ((g ) & 0x00f0) | - ((r >> 4) )); - } -} - -static FASTCALL void -fbStore_a8 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint8_t *pixel = ((uint8_t *) bits) + x; - for (i = 0; i < width; ++i) { - WRITE(pixel++, values[i] >> 24); - } -} - -static FASTCALL void -fbStore_r3g3b2 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint8_t *pixel = ((uint8_t *) bits) + x; - for (i = 0; i < width; ++i) { - Split(values[i]); - WRITE(pixel++, - ((r ) & 0xe0) | - ((g >> 3) & 0x1c) | - ((b >> 6) )); - } -} - -static FASTCALL void -fbStore_b2g3r3 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint8_t *pixel = ((uint8_t *) bits) + x; - for (i = 0; i < width; ++i) { - Split(values[i]); - WRITE(pixel++, - ((b ) & 0xc0) | - ((g >> 2) & 0x1c) | - ((r >> 5) )); - } -} - -static FASTCALL void -fbStore_a2r2g2b2 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint8_t *pixel = ((uint8_t *) bits) + x; - for (i = 0; i < width; ++i) { - Splita(values[i]); - WRITE(pixel++, ((a ) & 0xc0) | - ((r >> 2) & 0x30) | - ((g >> 4) & 0x0c) | - ((b >> 6) )); - } -} - -static FASTCALL void -fbStore_c8 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint8_t *pixel = ((uint8_t *) bits) + x; - for (i = 0; i < width; ++i) { - WRITE(pixel++, miIndexToEnt24(indexed,values[i])); - } -} - -static FASTCALL void -fbStore_x4a4 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - uint8_t *pixel = ((uint8_t *) bits) + x; - for (i = 0; i < width; ++i) { - WRITE(pixel++, values[i] >> 28); - } -} - -#define Store8(l,o,v) (WRITE((uint8_t *)(l) + ((o) >> 3), (v))) -#if IMAGE_BYTE_ORDER == MSBFirst -#define Store4(l,o,v) Store8(l,o,((o) & 4 ? \ - (Fetch8(l,o) & 0xf0) | (v) : \ - (Fetch8(l,o) & 0x0f) | ((v) << 4))) -#else -#define Store4(l,o,v) Store8(l,o,((o) & 4 ? \ - (Fetch8(l,o) & 0x0f) | ((v) << 4) : \ - (Fetch8(l,o) & 0xf0) | (v))) -#endif - -static FASTCALL void -fbStore_a4 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - Store4(bits, i + x, values[i]>>28); - } -} - -static FASTCALL void -fbStore_r1g2b1 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t pixel; - - Split(values[i]); - pixel = (((r >> 4) & 0x8) | - ((g >> 5) & 0x6) | - ((b >> 7) )); - Store4(bits, i + x, pixel); - } -} - -static FASTCALL void -fbStore_b1g2r1 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t pixel; - - Split(values[i]); - pixel = (((b >> 4) & 0x8) | - ((g >> 5) & 0x6) | - ((r >> 7) )); - Store4(bits, i + x, pixel); - } -} - -static FASTCALL void -fbStore_a1r1g1b1 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t pixel; - Splita(values[i]); - pixel = (((a >> 4) & 0x8) | - ((r >> 5) & 0x4) | - ((g >> 6) & 0x2) | - ((b >> 7) )); - Store4(bits, i + x, pixel); - } -} - -static FASTCALL void -fbStore_a1b1g1r1 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t pixel; - Splita(values[i]); - pixel = (((a >> 4) & 0x8) | - ((b >> 5) & 0x4) | - ((g >> 6) & 0x2) | - ((r >> 7) )); - Store4(bits, i + x, pixel); - } -} - -static FASTCALL void -fbStore_c4 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t pixel; - - pixel = miIndexToEnt24(indexed, values[i]); - Store4(bits, i + x, pixel); - } -} - -static FASTCALL void -fbStore_a1 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t *pixel = ((uint32_t *) bits) + ((i+x) >> 5); - uint32_t mask = FbStipMask((i+x) & 0x1f, 1); - - uint32_t v = values[i] & 0x80000000 ? mask : 0; - WRITE(pixel, (READ(pixel) & ~mask) | v); - } -} - -static FASTCALL void -fbStore_g1 (pixman_image_t *image, - uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t *pixel = ((uint32_t *) bits) + ((i+x) >> 5); - uint32_t mask = FbStipMask((i+x) & 0x1f, 1); - - uint32_t v = miIndexToEntY24(indexed,values[i]) ? mask : 0; - WRITE(pixel, (READ(pixel) & ~mask) | v); - } -} - - -static storeProc storeProcForPicture (bits_image_t * pict) -{ - switch(pict->format) { - case PIXMAN_a8r8g8b8: return fbStore_a8r8g8b8; - case PIXMAN_x8r8g8b8: return fbStore_x8r8g8b8; - case PIXMAN_a8b8g8r8: return fbStore_a8b8g8r8; - case PIXMAN_x8b8g8r8: return fbStore_x8b8g8r8; - - /* 24bpp formats */ - case PIXMAN_r8g8b8: return fbStore_r8g8b8; - case PIXMAN_b8g8r8: return fbStore_b8g8r8; - - /* 16bpp formats */ - case PIXMAN_r5g6b5: return fbStore_r5g6b5; - case PIXMAN_b5g6r5: return fbStore_b5g6r5; - - case PIXMAN_a1r5g5b5: return fbStore_a1r5g5b5; - case PIXMAN_x1r5g5b5: return fbStore_x1r5g5b5; - case PIXMAN_a1b5g5r5: return fbStore_a1b5g5r5; - case PIXMAN_x1b5g5r5: return fbStore_x1b5g5r5; - case PIXMAN_a4r4g4b4: return fbStore_a4r4g4b4; - case PIXMAN_x4r4g4b4: return fbStore_x4r4g4b4; - case PIXMAN_a4b4g4r4: return fbStore_a4b4g4r4; - case PIXMAN_x4b4g4r4: return fbStore_x4b4g4r4; - - /* 8bpp formats */ - case PIXMAN_a8: return fbStore_a8; - case PIXMAN_r3g3b2: return fbStore_r3g3b2; - case PIXMAN_b2g3r3: return fbStore_b2g3r3; - case PIXMAN_a2r2g2b2: return fbStore_a2r2g2b2; - case PIXMAN_c8: return fbStore_c8; - case PIXMAN_g8: return fbStore_c8; - case PIXMAN_x4a4: return fbStore_x4a4; - - /* 4bpp formats */ - case PIXMAN_a4: return fbStore_a4; - case PIXMAN_r1g2b1: return fbStore_r1g2b1; - case PIXMAN_b1g2r1: return fbStore_b1g2r1; - case PIXMAN_a1r1g1b1: return fbStore_a1r1g1b1; - case PIXMAN_a1b1g1r1: return fbStore_a1b1g1r1; - case PIXMAN_c4: return fbStore_c4; - case PIXMAN_g4: return fbStore_c4; - - /* 1bpp formats */ - case PIXMAN_a1: return fbStore_a1; - case PIXMAN_g1: return fbStore_g1; - default: - return NULL; - } -} - - -/* - * Combine src and mask - */ -static FASTCALL void -pixman_fbCombineMaskU (uint32_t *src, const uint32_t *mask, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t a = *(mask + i) >> 24; - uint32_t s = *(src + i); - FbByteMul(s, a); - *(src + i) = s; - } -} - -/* - * All of the composing functions - */ - -static FASTCALL void -fbCombineClear (uint32_t *dest, const uint32_t *src, int width) -{ - memset(dest, 0, width*sizeof(uint32_t)); -} - -static FASTCALL void -fbCombineSrcU (uint32_t *dest, const uint32_t *src, int width) -{ - memcpy(dest, src, width*sizeof(uint32_t)); -} - - -static FASTCALL void -fbCombineOverU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t ia = Alpha(~s); - - FbByteMulAdd(d, ia, s); - *(dest + i) = d; - } -} - -static FASTCALL void -fbCombineOverReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t ia = Alpha(~*(dest + i)); - FbByteMulAdd(s, ia, d); - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineInU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t a = Alpha(*(dest + i)); - FbByteMul(s, a); - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineInReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint32_t a = Alpha(*(src + i)); - FbByteMul(d, a); - *(dest + i) = d; - } -} - -static FASTCALL void -fbCombineOutU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t a = Alpha(~*(dest + i)); - FbByteMul(s, a); - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineOutReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint32_t a = Alpha(~*(src + i)); - FbByteMul(d, a); - *(dest + i) = d; - } -} - -static FASTCALL void -fbCombineAtopU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t dest_a = Alpha(d); - uint32_t src_ia = Alpha(~s); - - FbByteAddMul(s, dest_a, d, src_ia); - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineAtopReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t src_a = Alpha(s); - uint32_t dest_ia = Alpha(~d); - - FbByteAddMul(s, dest_ia, d, src_a); - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineXorU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t src_ia = Alpha(~s); - uint32_t dest_ia = Alpha(~d); - - FbByteAddMul(s, dest_ia, d, src_ia); - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineAddU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - FbByteAdd(d, s); - *(dest + i) = d; - } -} - -static FASTCALL void -fbCombineSaturateU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint16_t sa, da; - - sa = s >> 24; - da = ~d >> 24; - if (sa > da) - { - sa = FbIntDiv(da, sa); - FbByteMul(s, sa); - }; - FbByteAdd(d, s); - *(dest + i) = d; - } -} - -/* - * All of the disjoint composing functions - - The four entries in the first column indicate what source contributions - come from each of the four areas of the picture -- areas covered by neither - A nor B, areas covered only by A, areas covered only by B and finally - areas covered by both A and B. - - Disjoint Conjoint - Fa Fb Fa Fb - (0,0,0,0) 0 0 0 0 - (0,A,0,A) 1 0 1 0 - (0,0,B,B) 0 1 0 1 - (0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0) - (0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1 - (0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0 - (0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1) - (0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0 - (0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0) - (0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0) - (0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b) - (0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0) - -*/ - -#define CombineAOut 1 -#define CombineAIn 2 -#define CombineBOut 4 -#define CombineBIn 8 - -#define CombineClear 0 -#define CombineA (CombineAOut|CombineAIn) -#define CombineB (CombineBOut|CombineBIn) -#define CombineAOver (CombineAOut|CombineBOut|CombineAIn) -#define CombineBOver (CombineAOut|CombineBOut|CombineBIn) -#define CombineAAtop (CombineBOut|CombineAIn) -#define CombineBAtop (CombineAOut|CombineBIn) -#define CombineXor (CombineAOut|CombineBOut) - -/* portion covered by a but not b */ -static INLINE uint8_t -fbCombineDisjointOutPart (uint8_t a, uint8_t b) -{ - /* min (1, (1-b) / a) */ - - b = ~b; /* 1 - b */ - if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ - return 0xff; /* 1 */ - return FbIntDiv(b,a); /* (1-b) / a */ -} - -/* portion covered by both a and b */ -static INLINE uint8_t -fbCombineDisjointInPart (uint8_t a, uint8_t b) -{ - /* max (1-(1-b)/a,0) */ - /* = - min ((1-b)/a - 1, 0) */ - /* = 1 - min (1, (1-b)/a) */ - - b = ~b; /* 1 - b */ - if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ - return 0; /* 1 - 1 */ - return ~FbIntDiv(b,a); /* 1 - (1-b) / a */ -} - -static FASTCALL void -fbCombineDisjointGeneralU (uint32_t *dest, const uint32_t *src, int width, uint8_t combine) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t m,n,o,p; - uint16_t Fa, Fb, t, u, v; - uint8_t sa = s >> 24; - uint8_t da = d >> 24; - - switch (combine & CombineA) { - default: - Fa = 0; - break; - case CombineAOut: - Fa = fbCombineDisjointOutPart (sa, da); - break; - case CombineAIn: - Fa = fbCombineDisjointInPart (sa, da); - break; - case CombineA: - Fa = 0xff; - break; - } - - switch (combine & CombineB) { - default: - Fb = 0; - break; - case CombineBOut: - Fb = fbCombineDisjointOutPart (da, sa); - break; - case CombineBIn: - Fb = fbCombineDisjointInPart (da, sa); - break; - case CombineB: - Fb = 0xff; - break; - } - m = FbGen (s,d,0,Fa,Fb,t, u, v); - n = FbGen (s,d,8,Fa,Fb,t, u, v); - o = FbGen (s,d,16,Fa,Fb,t, u, v); - p = FbGen (s,d,24,Fa,Fb,t, u, v); - s = m|n|o|p; - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineDisjointOverU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint16_t a = s >> 24; - - if (a != 0x00) - { - if (a != 0xff) - { - uint32_t d = *(dest + i); - a = fbCombineDisjointOutPart (d >> 24, a); - FbByteMulAdd(d, a, s); - s = d; - } - *(dest + i) = s; - } - } -} - -static FASTCALL void -fbCombineDisjointInU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineAIn); -} - -static FASTCALL void -fbCombineDisjointInReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineBIn); -} - -static FASTCALL void -fbCombineDisjointOutU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineAOut); -} - -static FASTCALL void -fbCombineDisjointOutReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineBOut); -} - -static FASTCALL void -fbCombineDisjointAtopU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineAAtop); -} - -static FASTCALL void -fbCombineDisjointAtopReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineBAtop); -} - -static FASTCALL void -fbCombineDisjointXorU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineXor); -} - -/* portion covered by a but not b */ -static INLINE uint8_t -fbCombineConjointOutPart (uint8_t a, uint8_t b) -{ - /* max (1-b/a,0) */ - /* = 1-min(b/a,1) */ - - /* min (1, (1-b) / a) */ - - if (b >= a) /* b >= a -> b/a >= 1 */ - return 0x00; /* 0 */ - return ~FbIntDiv(b,a); /* 1 - b/a */ -} - -/* portion covered by both a and b */ -static INLINE uint8_t -fbCombineConjointInPart (uint8_t a, uint8_t b) -{ - /* min (1,b/a) */ - - if (b >= a) /* b >= a -> b/a >= 1 */ - return 0xff; /* 1 */ - return FbIntDiv(b,a); /* b/a */ -} - -static FASTCALL void -fbCombineConjointGeneralU (uint32_t *dest, const uint32_t *src, int width, uint8_t combine) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t m,n,o,p; - uint16_t Fa, Fb, t, u, v; - uint8_t sa = s >> 24; - uint8_t da = d >> 24; - - switch (combine & CombineA) { - default: - Fa = 0; - break; - case CombineAOut: - Fa = fbCombineConjointOutPart (sa, da); - break; - case CombineAIn: - Fa = fbCombineConjointInPart (sa, da); - break; - case CombineA: - Fa = 0xff; - break; - } - - switch (combine & CombineB) { - default: - Fb = 0; - break; - case CombineBOut: - Fb = fbCombineConjointOutPart (da, sa); - break; - case CombineBIn: - Fb = fbCombineConjointInPart (da, sa); - break; - case CombineB: - Fb = 0xff; - break; - } - m = FbGen (s,d,0,Fa,Fb,t, u, v); - n = FbGen (s,d,8,Fa,Fb,t, u, v); - o = FbGen (s,d,16,Fa,Fb,t, u, v); - p = FbGen (s,d,24,Fa,Fb,t, u, v); - s = m|n|o|p; - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineConjointOverU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineAOver); -} - - -static FASTCALL void -fbCombineConjointOverReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineBOver); -} - - -static FASTCALL void -fbCombineConjointInU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineAIn); -} - - -static FASTCALL void -fbCombineConjointInReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineBIn); -} - -static FASTCALL void -fbCombineConjointOutU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineAOut); -} - -static FASTCALL void -fbCombineConjointOutReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineBOut); -} - -static FASTCALL void -fbCombineConjointAtopU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineAAtop); -} - -static FASTCALL void -fbCombineConjointAtopReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineBAtop); -} - -static FASTCALL void -fbCombineConjointXorU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineConjointGeneralU (dest, src, width, CombineXor); -} - -static CombineFuncU pixman_fbCombineFuncU[] = { - fbCombineClear, - fbCombineSrcU, - NULL, /* CombineDst */ - fbCombineOverU, - fbCombineOverReverseU, - fbCombineInU, - fbCombineInReverseU, - fbCombineOutU, - fbCombineOutReverseU, - fbCombineAtopU, - fbCombineAtopReverseU, - fbCombineXorU, - fbCombineAddU, - fbCombineSaturateU, - NULL, - NULL, - fbCombineClear, - fbCombineSrcU, - NULL, /* CombineDst */ - fbCombineDisjointOverU, - fbCombineSaturateU, /* DisjointOverReverse */ - fbCombineDisjointInU, - fbCombineDisjointInReverseU, - fbCombineDisjointOutU, - fbCombineDisjointOutReverseU, - fbCombineDisjointAtopU, - fbCombineDisjointAtopReverseU, - fbCombineDisjointXorU, - NULL, - NULL, - NULL, - NULL, - fbCombineClear, - fbCombineSrcU, - NULL, /* CombineDst */ - fbCombineConjointOverU, - fbCombineConjointOverReverseU, - fbCombineConjointInU, - fbCombineConjointInReverseU, - fbCombineConjointOutU, - fbCombineConjointOutReverseU, - fbCombineConjointAtopU, - fbCombineConjointAtopReverseU, - fbCombineConjointXorU, -}; - -static INLINE void -fbCombineMaskC (uint32_t *src, uint32_t *mask) -{ - uint32_t a = *mask; - - uint32_t x; - uint16_t xa; - - if (!a) - { - *(src) = 0; - return; - } - - x = *(src); - if (a == 0xffffffff) - { - x = x >> 24; - x |= x << 8; - x |= x << 16; - *(mask) = x; - return; - } - - xa = x >> 24; - FbByteMulC(x, a); - *(src) = x; - FbByteMul(a, xa); - *(mask) = a; -} - -static INLINE void -fbCombineMaskValueC (uint32_t *src, const uint32_t *mask) -{ - uint32_t a = *mask; - uint32_t x; - - if (!a) - { - *(src) = 0; - return; - } - - if (a == 0xffffffff) - return; - - x = *(src); - FbByteMulC(x, a); - *(src) =x; -} - -static INLINE void -fbCombineMaskAlphaC (const uint32_t *src, uint32_t *mask) -{ - uint32_t a = *(mask); - uint32_t x; - - if (!a) - return; - - x = *(src) >> 24; - if (x == 0xff) - return; - if (a == 0xffffffff) - { - x = x >> 24; - x |= x << 8; - x |= x << 16; - *(mask) = x; - return; - } - - FbByteMul(a, x); - *(mask) = a; -} - -static FASTCALL void -fbCombineClearC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - memset(dest, 0, width*sizeof(uint32_t)); -} - -static FASTCALL void -fbCombineSrcC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - - fbCombineMaskValueC (&s, &m); - - *(dest) = s; - } -} - -static FASTCALL void -fbCombineOverC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - uint32_t a; - - fbCombineMaskC (&s, &m); - - a = ~m; - if (a != 0xffffffff) - { - if (a) - { - uint32_t d = *(dest + i); - FbByteMulAddC(d, a, s); - s = d; - } - *(dest + i) = s; - } - } -} - -static FASTCALL void -fbCombineOverReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint32_t a = ~d >> 24; - - if (a) - { - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - - fbCombineMaskValueC (&s, &m); - - if (a != 0xff) - { - FbByteMulAdd(s, a, d); - } - *(dest + i) = s; - } - } -} - -static FASTCALL void -fbCombineInC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint16_t a = d >> 24; - uint32_t s = 0; - if (a) - { - uint32_t m = *(mask + i); - - s = *(src + i); - fbCombineMaskValueC (&s, &m); - if (a != 0xff) - { - FbByteMul(s, a); - } - } - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineInReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - uint32_t a; - - fbCombineMaskAlphaC (&s, &m); - - a = m; - if (a != 0xffffffff) - { - uint32_t d = 0; - if (a) - { - d = *(dest + i); - FbByteMulC(d, a); - } - *(dest + i) = d; - } - } -} - -static FASTCALL void -fbCombineOutC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint16_t a = ~d >> 24; - uint32_t s = 0; - if (a) - { - uint32_t m = *(mask + i); - - s = *(src + i); - fbCombineMaskValueC (&s, &m); - - if (a != 0xff) - { - FbByteMul(s, a); - } - } - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineOutReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - uint32_t a; - - fbCombineMaskAlphaC (&s, &m); - - a = ~m; - if (a != 0xffffffff) - { - uint32_t d = 0; - if (a) - { - d = *(dest + i); - FbByteMulC(d, a); - } - *(dest + i) = d; - } - } -} - -static FASTCALL void -fbCombineAtopC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - uint32_t ad; - uint16_t as = d >> 24; - - fbCombineMaskC (&s, &m); - - ad = ~m; - - FbByteAddMulC(d, ad, s, as); - *(dest + i) = d; - } -} - -static FASTCALL void -fbCombineAtopReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - - uint32_t d = *(dest + i); - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - uint32_t ad; - uint16_t as = ~d >> 24; - - fbCombineMaskC (&s, &m); - - ad = m; - - FbByteAddMulC(d, ad, s, as); - *(dest + i) = d; - } -} - -static FASTCALL void -fbCombineXorC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - uint32_t ad; - uint16_t as = ~d >> 24; - - fbCombineMaskC (&s, &m); - - ad = ~m; - - FbByteAddMulC(d, ad, s, as); - *(dest + i) = d; - } -} - -static FASTCALL void -fbCombineAddC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t m = *(mask + i); - uint32_t d = *(dest + i); - - fbCombineMaskValueC (&s, &m); - - FbByteAdd(d, s); - *(dest + i) = d; - } -} - -static FASTCALL void -fbCombineSaturateC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t s, d; - uint16_t sa, sr, sg, sb, da; - uint16_t t, u, v; - uint32_t m,n,o,p; - - d = *(dest + i); - s = *(src + i); - m = *(mask + i); - - fbCombineMaskC (&s, &m); - - sa = (m >> 24); - sr = (m >> 16) & 0xff; - sg = (m >> 8) & 0xff; - sb = (m ) & 0xff; - da = ~d >> 24; - - if (sb <= da) - m = FbAdd(s,d,0,t); - else - m = FbGen (s, d, 0, (da << 8) / sb, 0xff, t, u, v); - - if (sg <= da) - n = FbAdd(s,d,8,t); - else - n = FbGen (s, d, 8, (da << 8) / sg, 0xff, t, u, v); - - if (sr <= da) - o = FbAdd(s,d,16,t); - else - o = FbGen (s, d, 16, (da << 8) / sr, 0xff, t, u, v); - - if (sa <= da) - p = FbAdd(s,d,24,t); - else - p = FbGen (s, d, 24, (da << 8) / sa, 0xff, t, u, v); - - *(dest + i) = m|n|o|p; - } -} - -static FASTCALL void -fbCombineDisjointGeneralC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width, uint8_t combine) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t s, d; - uint32_t m,n,o,p; - uint32_t Fa, Fb; - uint16_t t, u, v; - uint32_t sa; - uint8_t da; - - s = *(src + i); - m = *(mask + i); - d = *(dest + i); - da = d >> 24; - - fbCombineMaskC (&s, &m); - - sa = m; - - switch (combine & CombineA) { - default: - Fa = 0; - break; - case CombineAOut: - m = fbCombineDisjointOutPart ((uint8_t) (sa >> 0), da); - n = fbCombineDisjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = fbCombineDisjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = fbCombineDisjointOutPart ((uint8_t) (sa >> 24), da) << 24; - Fa = m|n|o|p; - break; - case CombineAIn: - m = fbCombineDisjointInPart ((uint8_t) (sa >> 0), da); - n = fbCombineDisjointInPart ((uint8_t) (sa >> 8), da) << 8; - o = fbCombineDisjointInPart ((uint8_t) (sa >> 16), da) << 16; - p = fbCombineDisjointInPart ((uint8_t) (sa >> 24), da) << 24; - Fa = m|n|o|p; - break; - case CombineA: - Fa = 0xffffffff; - break; - } - - switch (combine & CombineB) { - default: - Fb = 0; - break; - case CombineBOut: - m = fbCombineDisjointOutPart (da, (uint8_t) (sa >> 0)); - n = fbCombineDisjointOutPart (da, (uint8_t) (sa >> 8)) << 8; - o = fbCombineDisjointOutPart (da, (uint8_t) (sa >> 16)) << 16; - p = fbCombineDisjointOutPart (da, (uint8_t) (sa >> 24)) << 24; - Fb = m|n|o|p; - break; - case CombineBIn: - m = fbCombineDisjointInPart (da, (uint8_t) (sa >> 0)); - n = fbCombineDisjointInPart (da, (uint8_t) (sa >> 8)) << 8; - o = fbCombineDisjointInPart (da, (uint8_t) (sa >> 16)) << 16; - p = fbCombineDisjointInPart (da, (uint8_t) (sa >> 24)) << 24; - Fb = m|n|o|p; - break; - case CombineB: - Fb = 0xffffffff; - break; - } - m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); - n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); - o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); - p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); - s = m|n|o|p; - *(dest + i) = s; - } -} - -static FASTCALL void -fbCombineDisjointOverC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver); -} - -static FASTCALL void -fbCombineDisjointInC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn); -} - -static FASTCALL void -fbCombineDisjointInReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn); -} - -static FASTCALL void -fbCombineDisjointOutC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut); -} - -static FASTCALL void -fbCombineDisjointOutReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut); -} - -static FASTCALL void -fbCombineDisjointAtopC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop); -} - -static FASTCALL void -fbCombineDisjointAtopReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineDisjointGeneralC (dest, src, mask, width, CombineBAtop); -} - -static FASTCALL void -fbCombineDisjointXorC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor); -} - -static FASTCALL void -fbCombineConjointGeneralC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width, uint8_t combine) -{ - int i; - - for (i = 0; i < width; ++i) { - uint32_t s, d; - uint32_t m,n,o,p; - uint32_t Fa, Fb; - uint16_t t, u, v; - uint32_t sa; - uint8_t da; - - s = *(src + i); - m = *(mask + i); - d = *(dest + i); - da = d >> 24; - - fbCombineMaskC (&s, &m); - - sa = m; - - switch (combine & CombineA) { - default: - Fa = 0; - break; - case CombineAOut: - m = fbCombineConjointOutPart ((uint8_t) (sa >> 0), da); - n = fbCombineConjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = fbCombineConjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = fbCombineConjointOutPart ((uint8_t) (sa >> 24), da) << 24; - Fa = m|n|o|p; - break; - case CombineAIn: - m = fbCombineConjointInPart ((uint8_t) (sa >> 0), da); - n = fbCombineConjointInPart ((uint8_t) (sa >> 8), da) << 8; - o = fbCombineConjointInPart ((uint8_t) (sa >> 16), da) << 16; - p = fbCombineConjointInPart ((uint8_t) (sa >> 24), da) << 24; - Fa = m|n|o|p; - break; - case CombineA: - Fa = 0xffffffff; - break; - } - - switch (combine & CombineB) { - default: - Fb = 0; - break; - case CombineBOut: - m = fbCombineConjointOutPart (da, (uint8_t) (sa >> 0)); - n = fbCombineConjointOutPart (da, (uint8_t) (sa >> 8)) << 8; - o = fbCombineConjointOutPart (da, (uint8_t) (sa >> 16)) << 16; - p = fbCombineConjointOutPart (da, (uint8_t) (sa >> 24)) << 24; - Fb = m|n|o|p; - break; - case CombineBIn: - m = fbCombineConjointInPart (da, (uint8_t) (sa >> 0)); - n = fbCombineConjointInPart (da, (uint8_t) (sa >> 8)) << 8; - o = fbCombineConjointInPart (da, (uint8_t) (sa >> 16)) << 16; - p = fbCombineConjointInPart (da, (uint8_t) (sa >> 24)) << 24; - Fb = m|n|o|p; - break; - case CombineB: - Fb = 0xffffffff; - break; - } - m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); - n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); - o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); - p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); - s = m|n|o|p; - *(dest + i) = s; - } -} -static FASTCALL void -fbCombineConjointOverC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineAOver); -} - -static FASTCALL void -fbCombineConjointOverReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineBOver); -} - -static FASTCALL void -fbCombineConjointInC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn); -} - -static FASTCALL void -fbCombineConjointInReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineBIn); -} - -static FASTCALL void -fbCombineConjointOutC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut); -} - -static FASTCALL void -fbCombineConjointOutReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineBOut); -} - -static FASTCALL void -fbCombineConjointAtopC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop); -} - -static FASTCALL void -fbCombineConjointAtopReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineBAtop); -} - -static FASTCALL void -fbCombineConjointXorC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) -{ - fbCombineConjointGeneralC (dest, src, mask, width, CombineXor); + return pict->class; } -static CombineFuncC pixman_fbCombineFuncC[] = { - fbCombineClearC, - fbCombineSrcC, - NULL, /* Dest */ - fbCombineOverC, - fbCombineOverReverseC, - fbCombineInC, - fbCombineInReverseC, - fbCombineOutC, - fbCombineOutReverseC, - fbCombineAtopC, - fbCombineAtopReverseC, - fbCombineXorC, - fbCombineAddC, - fbCombineSaturateC, - NULL, - NULL, - fbCombineClearC, /* 0x10 */ - fbCombineSrcC, - NULL, /* Dest */ - fbCombineDisjointOverC, - fbCombineSaturateC, /* DisjointOverReverse */ - fbCombineDisjointInC, - fbCombineDisjointInReverseC, - fbCombineDisjointOutC, - fbCombineDisjointOutReverseC, - fbCombineDisjointAtopC, - fbCombineDisjointAtopReverseC, - fbCombineDisjointXorC, /* 0x1b */ - NULL, - NULL, - NULL, - NULL, - fbCombineClearC, - fbCombineSrcC, - NULL, /* Dest */ - fbCombineConjointOverC, - fbCombineConjointOverReverseC, - fbCombineConjointInC, - fbCombineConjointInReverseC, - fbCombineConjointOutC, - fbCombineConjointOutReverseC, - fbCombineConjointAtopC, - fbCombineConjointAtopReverseC, - fbCombineConjointXorC, -}; - - static void fbFetchSolid(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) { - uint32_t *bits; uint32_t color; uint32_t *end; - fetchPixelProc fetch = fetchPixelProcForPicture(pict); - const pixman_indexed_t * indexed = pict->indexed; - - bits = pict->bits; - - color = fetch((pixman_image_t *)pict, bits, 0, indexed); - + fetchPixelProc fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict); + + color = fetch(pict, 0, 0); + end = buffer + width; while (buffer < end) *(buffer++) = color; - fbFinishAccess (pict->pDrawable); } static void fbFetch(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) { - uint32_t *bits; - uint32_t stride; - fetchProc fetch = fetchProcForPicture(pict); - const pixman_indexed_t * indexed = pict->indexed; - - bits = pict->bits; - stride = pict->rowstride; - - bits += y*stride; - - fetch((pixman_image_t *)pict, bits, x, width, buffer, indexed); -} + fetchProc fetch = FETCH_PROC_FOR_PICTURE(pict); -#ifdef PIXMAN_FB_ACCESSORS -#define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_accessors -#define PIXMAN_COMPOSE_FUNCTIONS pixman_composeFunctions_accessors -#else -#define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_no_accessors -#define PIXMAN_COMPOSE_FUNCTIONS pixman_composeFunctions -#endif + fetch(pict, x, y, width, buffer); +} #ifdef PIXMAN_FB_ACCESSORS /* The accessor version can't be parameterized from outside */ static const @@ -2907,1239 +151,18 @@ FbComposeFunctions PIXMAN_COMPOSE_FUNCTIONS = { pixman_fbCombineMaskU }; -typedef struct -{ - uint32_t left_ag; - uint32_t left_rb; - uint32_t right_ag; - uint32_t right_rb; - int32_t left_x; - int32_t right_x; - int32_t stepper; - - pixman_gradient_stop_t *stops; - int num_stops; - unsigned int spread; - - int need_reset; -} GradientWalker; - static void -_gradient_walker_init (GradientWalker *walker, - gradient_t *gradient, - unsigned int spread) -{ - walker->num_stops = gradient->n_stops; - walker->stops = gradient->stops; - walker->left_x = 0; - walker->right_x = 0x10000; - walker->stepper = 0; - walker->left_ag = 0; - walker->left_rb = 0; - walker->right_ag = 0; - walker->right_rb = 0; - walker->spread = spread; - - walker->need_reset = TRUE; -} - -static void -_gradient_walker_reset (GradientWalker *walker, - pixman_fixed_32_32_t pos) -{ - int32_t x, left_x, right_x; - pixman_color_t *left_c, *right_c; - int n, count = walker->num_stops; - pixman_gradient_stop_t * stops = walker->stops; - - static const pixman_color_t transparent_black = { 0, 0, 0, 0 }; - - switch (walker->spread) - { - case PIXMAN_REPEAT_NORMAL: - x = (int32_t)pos & 0xFFFF; - for (n = 0; n < count; n++) - if (x < stops[n].x) - break; - if (n == 0) { - left_x = stops[count-1].x - 0x10000; - left_c = &stops[count-1].color; - } else { - left_x = stops[n-1].x; - left_c = &stops[n-1].color; - } - - if (n == count) { - right_x = stops[0].x + 0x10000; - right_c = &stops[0].color; - } else { - right_x = stops[n].x; - right_c = &stops[n].color; - } - left_x += (pos - x); - right_x += (pos - x); - break; - - case PIXMAN_REPEAT_PAD: - for (n = 0; n < count; n++) - if (pos < stops[n].x) - break; - - if (n == 0) { - left_x = INT32_MIN; - left_c = &stops[0].color; - } else { - left_x = stops[n-1].x; - left_c = &stops[n-1].color; - } - - if (n == count) { - right_x = INT32_MAX; - right_c = &stops[n-1].color; - } else { - right_x = stops[n].x; - right_c = &stops[n].color; - } - break; - - case PIXMAN_REPEAT_REFLECT: - x = (int32_t)pos & 0xFFFF; - if ((int32_t)pos & 0x10000) - x = 0x10000 - x; - for (n = 0; n < count; n++) - if (x < stops[n].x) - break; - - if (n == 0) { - left_x = -stops[0].x; - left_c = &stops[0].color; - } else { - left_x = stops[n-1].x; - left_c = &stops[n-1].color; - } - - if (n == count) { - right_x = 0x20000 - stops[n-1].x; - right_c = &stops[n-1].color; - } else { - right_x = stops[n].x; - right_c = &stops[n].color; - } - - if ((int32_t)pos & 0x10000) { - pixman_color_t *tmp_c; - int32_t tmp_x; - - tmp_x = 0x10000 - right_x; - right_x = 0x10000 - left_x; - left_x = tmp_x; - - tmp_c = right_c; - right_c = left_c; - left_c = tmp_c; - - x = 0x10000 - x; - } - left_x += (pos - x); - right_x += (pos - x); - break; - - default: /* RepeatNone */ - for (n = 0; n < count; n++) - if (pos < stops[n].x) - break; - - if (n == 0) - { - left_x = INT32_MIN; - right_x = stops[0].x; - left_c = right_c = (pixman_color_t*) &transparent_black; - } - else if (n == count) - { - left_x = stops[n-1].x; - right_x = INT32_MAX; - left_c = right_c = (pixman_color_t*) &transparent_black; - } - else - { - left_x = stops[n-1].x; - right_x = stops[n].x; - left_c = &stops[n-1].color; - right_c = &stops[n].color; - } - } - - walker->left_x = left_x; - walker->right_x = right_x; - walker->left_ag = ((left_c->alpha >> 8) << 16) | (left_c->green >> 8); - walker->left_rb = ((left_c->red & 0xff00) << 8) | (left_c->blue >> 8); - walker->right_ag = ((right_c->alpha >> 8) << 16) | (right_c->green >> 8); - walker->right_rb = ((right_c->red & 0xff00) << 8) | (right_c->blue >> 8); - - if ( walker->left_x == walker->right_x || - ( walker->left_ag == walker->right_ag && - walker->left_rb == walker->right_rb ) ) - { - walker->stepper = 0; - } - else - { - int32_t width = right_x - left_x; - walker->stepper = ((1 << 24) + width/2)/width; - } - - walker->need_reset = FALSE; -} - -#define GRADIENT_WALKER_NEED_RESET(w,x) \ - ( (w)->need_reset || (x) < (w)->left_x || (x) >= (w)->right_x) - - -/* the following assumes that GRADIENT_WALKER_NEED_RESET(w,x) is FALSE */ -static uint32_t -_gradient_walker_pixel (GradientWalker *walker, - pixman_fixed_32_32_t x) -{ - int dist, idist; - uint32_t t1, t2, a, color; - - if (GRADIENT_WALKER_NEED_RESET (walker, x)) - _gradient_walker_reset (walker, x); - - dist = ((int)(x - walker->left_x)*walker->stepper) >> 16; - idist = 256 - dist; - - /* combined INTERPOLATE and premultiply */ - t1 = walker->left_rb*idist + walker->right_rb*dist; - t1 = (t1 >> 8) & 0xff00ff; - - t2 = walker->left_ag*idist + walker->right_ag*dist; - t2 &= 0xff00ff00; - - color = t2 & 0xff000000; - a = t2 >> 24; - - t1 = t1*a + 0x800080; - t1 = (t1 + ((t1 >> 8) & 0xff00ff)) >> 8; - - t2 = (t2 >> 8)*a + 0x800080; - t2 = (t2 + ((t2 >> 8) & 0xff00ff)); - - return (color | (t1 & 0xff00ff) | (t2 & 0xff00)); -} - -static void pixmanFetchSourcePict(source_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) -{ -#if 0 - SourcePictPtr pGradient = pict->pSourcePict; -#endif - GradientWalker walker; - uint32_t *end = buffer + width; - gradient_t *gradient; - - if (pict->common.type == SOLID) - { - register uint32_t color = ((solid_fill_t *)pict)->color; - - while (buffer < end) - *(buffer++) = color; - - return; - } - - gradient = (gradient_t *)pict; - - _gradient_walker_init (&walker, gradient, pict->common.repeat); - - if (pict->common.type == LINEAR) { - pixman_vector_t v, unit; - pixman_fixed_32_32_t l; - pixman_fixed_48_16_t dx, dy, a, b, off; - linear_gradient_t *linear = (linear_gradient_t *)pict; - - /* reference point is the center of the pixel */ - v.vector[0] = pixman_int_to_fixed(x) + pixman_fixed_1/2; - v.vector[1] = pixman_int_to_fixed(y) + pixman_fixed_1/2; - v.vector[2] = pixman_fixed_1; - if (pict->common.transform) { - if (!pixman_transform_point_3d (pict->common.transform, &v)) - return; - unit.vector[0] = pict->common.transform->matrix[0][0]; - unit.vector[1] = pict->common.transform->matrix[1][0]; - unit.vector[2] = pict->common.transform->matrix[2][0]; - } else { - unit.vector[0] = pixman_fixed_1; - unit.vector[1] = 0; - unit.vector[2] = 0; - } - - dx = linear->p2.x - linear->p1.x; - dy = linear->p2.y - linear->p1.y; - l = dx*dx + dy*dy; - if (l != 0) { - a = (dx << 32) / l; - b = (dy << 32) / l; - off = (-a*linear->p1.x - b*linear->p1.y)>>16; - } - if (l == 0 || (unit.vector[2] == 0 && v.vector[2] == pixman_fixed_1)) { - pixman_fixed_48_16_t inc, t; - /* affine transformation only */ - if (l == 0) { - t = 0; - inc = 0; - } else { - t = ((a*v.vector[0] + b*v.vector[1]) >> 16) + off; - inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16; - } - - if (pict->class == SOURCE_IMAGE_CLASS_VERTICAL) - { - register uint32_t color; - - color = _gradient_walker_pixel( &walker, t ); - while (buffer < end) - *(buffer++) = color; - } - else - { - if (!mask) { - while (buffer < end) - { - *(buffer) = _gradient_walker_pixel (&walker, t); - buffer += 1; - t += inc; - } - } else { - while (buffer < end) { - if (*mask++ & maskBits) - { - *(buffer) = _gradient_walker_pixel (&walker, t); - } - buffer += 1; - t += inc; - } - } - } - } - else /* projective transformation */ - { - pixman_fixed_48_16_t t; - - if (pict->class == SOURCE_IMAGE_CLASS_VERTICAL) - { - register uint32_t color; - - if (v.vector[2] == 0) - { - t = 0; - } - else - { - pixman_fixed_48_16_t x, y; - - x = ((pixman_fixed_48_16_t) v.vector[0] << 16) / v.vector[2]; - y = ((pixman_fixed_48_16_t) v.vector[1] << 16) / v.vector[2]; - t = ((a * x + b * y) >> 16) + off; - } - - color = _gradient_walker_pixel( &walker, t ); - while (buffer < end) - *(buffer++) = color; - } - else - { - while (buffer < end) - { - if (!mask || *mask++ & maskBits) - { - if (v.vector[2] == 0) { - t = 0; - } else { - pixman_fixed_48_16_t x, y; - x = ((pixman_fixed_48_16_t)v.vector[0] << 16) / v.vector[2]; - y = ((pixman_fixed_48_16_t)v.vector[1] << 16) / v.vector[2]; - t = ((a*x + b*y) >> 16) + off; - } - *(buffer) = _gradient_walker_pixel (&walker, t); - } - ++buffer; - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } - } - } else { - -/* - * In the radial gradient problem we are given two circles (c₁,r₁) and - * (c₂,r₂) that define the gradient itself. Then, for any point p, we - * must compute the value(s) of t within [0.0, 1.0] representing the - * circle(s) that would color the point. - * - * There are potentially two values of t since the point p can be - * colored by both sides of the circle, (which happens whenever one - * circle is not entirely contained within the other). - * - * If we solve for a value of t that is outside of [0.0, 1.0] then we - * use the extend mode (NONE, REPEAT, REFLECT, or PAD) to map to a - * value within [0.0, 1.0]. - * - * Here is an illustration of the problem: - * - * p₂ - * p • - * • ╲ - * · ╲r₂ - * p₁ · ╲ - * • θ╲ - * ╲ ╌╌• - * ╲r₁ · c₂ - * θ╲ · - * ╌╌• - * c₁ - * - * Given (c₁,r₁), (c₂,r₂) and p, we must find an angle θ such that two - * points p₁ and p₂ on the two circles are collinear with p. Then, the - * desired value of t is the ratio of the length of p₁p to the length - * of p₁p₂. - * - * So, we have six unknown values: (p₁x, p₁y), (p₂x, p₂y), θ and t. - * We can also write six equations that constrain the problem: - * - * Point p₁ is a distance r₁ from c₁ at an angle of θ: - * - * 1. p₁x = c₁x + r₁·cos θ - * 2. p₁y = c₁y + r₁·sin θ - * - * Point p₂ is a distance r₂ from c₂ at an angle of θ: - * - * 3. p₂x = c₂x + r2·cos θ - * 4. p₂y = c₂y + r2·sin θ - * - * Point p lies at a fraction t along the line segment p₁p₂: - * - * 5. px = t·p₂x + (1-t)·p₁x - * 6. py = t·p₂y + (1-t)·p₁y - * - * To solve, first subtitute 1-4 into 5 and 6: - * - * px = t·(c₂x + r₂·cos θ) + (1-t)·(c₁x + r₁·cos θ) - * py = t·(c₂y + r₂·sin θ) + (1-t)·(c₁y + r₁·sin θ) - * - * Then solve each for cos θ and sin θ expressed as a function of t: - * - * cos θ = (-(c₂x - c₁x)·t + (px - c₁x)) / ((r₂-r₁)·t + r₁) - * sin θ = (-(c₂y - c₁y)·t + (py - c₁y)) / ((r₂-r₁)·t + r₁) - * - * To simplify this a bit, we define new variables for several of the - * common terms as shown below: - * - * p₂ - * p • - * • ╲ - * · ┆ ╲r₂ - * p₁ · ┆ ╲ - * • pdy┆ ╲ - * ╲ ┆ •c₂ - * ╲r₁ ┆ · ┆ - * ╲ ·┆ ┆cdy - * •╌╌╌╌┴╌╌╌╌╌╌╌┘ - * c₁ pdx cdx - * - * cdx = (c₂x - c₁x) - * cdy = (c₂y - c₁y) - * dr = r₂-r₁ - * pdx = px - c₁x - * pdy = py - c₁y - * - * Note that cdx, cdy, and dr do not depend on point p at all, so can - * be pre-computed for the entire gradient. The simplifed equations - * are now: - * - * cos θ = (-cdx·t + pdx) / (dr·t + r₁) - * sin θ = (-cdy·t + pdy) / (dr·t + r₁) - * - * Finally, to get a single function of t and eliminate the last - * unknown θ, we use the identity sin²θ + cos²θ = 1. First, square - * each equation, (we knew a quadratic was coming since it must be - * possible to obtain two solutions in some cases): - * - * cos²θ = (cdx²t² - 2·cdx·pdx·t + pdx²) / (dr²·t² + 2·r₁·dr·t + r₁²) - * sin²θ = (cdy²t² - 2·cdy·pdy·t + pdy²) / (dr²·t² + 2·r₁·dr·t + r₁²) - * - * Then add both together, set the result equal to 1, and express as a - * standard quadratic equation in t of the form At² + Bt + C = 0 - * - * (cdx² + cdy² - dr²)·t² - 2·(cdx·pdx + cdy·pdy + r₁·dr)·t + (pdx² + pdy² - r₁²) = 0 - * - * In other words: - * - * A = cdx² + cdy² - dr² - * B = -2·(pdx·cdx + pdy·cdy + r₁·dr) - * C = pdx² + pdy² - r₁² - * - * And again, notice that A does not depend on p, so can be - * precomputed. From here we just use the quadratic formula to solve - * for t: - * - * t = (-2·B ± ⎷(B² - 4·A·C)) / 2·A - */ - /* radial or conical */ - pixman_bool_t affine = TRUE; - double cx = 1.; - double cy = 0.; - double cz = 0.; - double rx = x + 0.5; - double ry = y + 0.5; - double rz = 1.; - - if (pict->common.transform) { - pixman_vector_t v; - /* reference point is the center of the pixel */ - v.vector[0] = pixman_int_to_fixed(x) + pixman_fixed_1/2; - v.vector[1] = pixman_int_to_fixed(y) + pixman_fixed_1/2; - v.vector[2] = pixman_fixed_1; - if (!pixman_transform_point_3d (pict->common.transform, &v)) - return; - - cx = pict->common.transform->matrix[0][0]/65536.; - cy = pict->common.transform->matrix[1][0]/65536.; - cz = pict->common.transform->matrix[2][0]/65536.; - rx = v.vector[0]/65536.; - ry = v.vector[1]/65536.; - rz = v.vector[2]/65536.; - affine = pict->common.transform->matrix[2][0] == 0 && v.vector[2] == pixman_fixed_1; - } - - if (pict->common.type == RADIAL) { - radial_gradient_t *radial = (radial_gradient_t *)pict; - if (affine) { - while (buffer < end) { - if (!mask || *mask++ & maskBits) - { - double pdx, pdy; - double B, C; - double det; - double c1x = radial->c1.x / 65536.0; - double c1y = radial->c1.y / 65536.0; - double r1 = radial->c1.radius / 65536.0; - pixman_fixed_48_16_t t; - - pdx = rx - c1x; - pdy = ry - c1y; - - B = -2 * ( pdx * radial->cdx - + pdy * radial->cdy - + r1 * radial->dr); - C = (pdx * pdx + pdy * pdy - r1 * r1); - - det = (B * B) - (4 * radial->A * C); - if (det < 0.0) - det = 0.0; - - if (radial->A < 0) - t = (pixman_fixed_48_16_t) ((- B - sqrt(det)) / (2.0 * radial->A) * 65536); - else - t = (pixman_fixed_48_16_t) ((- B + sqrt(det)) / (2.0 * radial->A) * 65536); - - *(buffer) = _gradient_walker_pixel (&walker, t); - } - ++buffer; - - rx += cx; - ry += cy; - } - } else { - /* projective */ - while (buffer < end) { - if (!mask || *mask++ & maskBits) - { - double pdx, pdy; - double B, C; - double det; - double c1x = radial->c1.x / 65536.0; - double c1y = radial->c1.y / 65536.0; - double r1 = radial->c1.radius / 65536.0; - pixman_fixed_48_16_t t; - double x, y; - - if (rz != 0) { - x = rx/rz; - y = ry/rz; - } else { - x = y = 0.; - } - - pdx = x - c1x; - pdy = y - c1y; - - B = -2 * ( pdx * radial->cdx - + pdy * radial->cdy - + r1 * radial->dr); - C = (pdx * pdx + pdy * pdy - r1 * r1); - - det = (B * B) - (4 * radial->A * C); - if (det < 0.0) - det = 0.0; - - if (radial->A < 0) - t = (pixman_fixed_48_16_t) ((- B - sqrt(det)) / (2.0 * radial->A) * 65536); - else - t = (pixman_fixed_48_16_t) ((- B + sqrt(det)) / (2.0 * radial->A) * 65536); - - *(buffer) = _gradient_walker_pixel (&walker, t); - } - ++buffer; - - rx += cx; - ry += cy; - rz += cz; - } - } - } else /* SourcePictTypeConical */ { - conical_gradient_t *conical = (conical_gradient_t *)pict; - double a = conical->angle/(180.*65536); - if (affine) { - rx -= conical->center.x/65536.; - ry -= conical->center.y/65536.; - - while (buffer < end) { - double angle; - - if (!mask || *mask++ & maskBits) - { - pixman_fixed_48_16_t t; - - angle = atan2(ry, rx) + a; - t = (pixman_fixed_48_16_t) (angle * (65536. / (2*M_PI))); - - *(buffer) = _gradient_walker_pixel (&walker, t); - } - - ++buffer; - rx += cx; - ry += cy; - } - } else { - while (buffer < end) { - double x, y; - double angle; - - if (!mask || *mask++ & maskBits) - { - pixman_fixed_48_16_t t; - - if (rz != 0) { - x = rx/rz; - y = ry/rz; - } else { - x = y = 0.; - } - x -= conical->center.x/65536.; - y -= conical->center.y/65536.; - angle = atan2(y, x) + a; - t = (pixman_fixed_48_16_t) (angle * (65536. / (2*M_PI))); - - *(buffer) = _gradient_walker_pixel (&walker, t); - } - - ++buffer; - rx += cx; - ry += cy; - rz += cz; - } - } - } - } -} - -static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) -{ - uint32_t *bits; - uint32_t stride; - fetchPixelProc fetch; - pixman_vector_t v; - pixman_vector_t unit; - int i; - pixman_box16_t box; - const pixman_indexed_t * indexed = pict->indexed; - pixman_bool_t affine = TRUE; - - fetch = fetchPixelProcForPicture(pict); - - bits = pict->bits; - stride = pict->rowstride; - - /* reference point is the center of the pixel */ - v.vector[0] = pixman_int_to_fixed(x) + pixman_fixed_1 / 2; - v.vector[1] = pixman_int_to_fixed(y) + pixman_fixed_1 / 2; - v.vector[2] = pixman_fixed_1; - - /* when using convolution filters one might get here without a transform */ - if (pict->common.transform) - { - if (!pixman_transform_point_3d (pict->common.transform, &v)) - { - fbFinishAccess (pict->pDrawable); - return; - } - unit.vector[0] = pict->common.transform->matrix[0][0]; - unit.vector[1] = pict->common.transform->matrix[1][0]; - unit.vector[2] = pict->common.transform->matrix[2][0]; - affine = v.vector[2] == pixman_fixed_1 && unit.vector[2] == 0; - } - else - { - unit.vector[0] = pixman_fixed_1; - unit.vector[1] = 0; - unit.vector[2] = 0; - } - - if (pict->common.filter == PIXMAN_FILTER_NEAREST || pict->common.filter == PIXMAN_FILTER_FAST) - { - if (pict->common.repeat == PIXMAN_REPEAT_NORMAL) { - if (pixman_region_n_rects (pict->common.src_clip) == 1) { - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - if (!affine) { - y = MOD(DIV(v.vector[1],v.vector[2]), pict->height); - x = MOD(DIV(v.vector[0],v.vector[2]), pict->width); - } else { - y = MOD(v.vector[1]>>16, pict->height); - x = MOD(v.vector[0]>>16, pict->width); - } - *(buffer + i) = fetch((pixman_image_t *)pict, bits + y * stride, x, indexed); - } - } - - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } else { - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - if (!affine) { - y = MOD(DIV(v.vector[1],v.vector[2]), pict->height); - x = MOD(DIV(v.vector[0],v.vector[2]), pict->width); - } else { - y = MOD(v.vector[1]>>16, pict->height); - x = MOD(v.vector[0]>>16, pict->width); - } - if (pixman_region_contains_point (pict->common.src_clip, x, y, &box)) - *(buffer + i) = fetch ((pixman_image_t *)pict, bits + y*stride, x, indexed); - else - *(buffer + i) = 0; - } - } - - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } - } else { - if (pixman_region_n_rects(pict->common.src_clip) == 1) { - box = pict->common.src_clip->extents; - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - if (!affine) { - y = DIV(v.vector[1],v.vector[2]); - x = DIV(v.vector[0],v.vector[2]); - } else { - y = v.vector[1]>>16; - x = v.vector[0]>>16; - } - *(buffer + i) = ((x < box.x1) | (x >= box.x2) | (y < box.y1) | (y >= box.y2)) ? - 0 : fetch((pixman_image_t *)pict, bits + (y)*stride, x, indexed); - } - } - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } else { - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - if (!affine) { - y = DIV(v.vector[1],v.vector[2]); - x = DIV(v.vector[0],v.vector[2]); - } else { - y = v.vector[1]>>16; - x = v.vector[0]>>16; - } - if (pixman_region_contains_point (pict->common.src_clip, x, y, &box)) - *(buffer + i) = fetch((pixman_image_t *)pict, bits + y*stride, x, indexed); - else - *(buffer + i) = 0; - } - } - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } - } - } else if (pict->common.filter == PIXMAN_FILTER_BILINEAR || - pict->common.filter == PIXMAN_FILTER_GOOD || - pict->common.filter == PIXMAN_FILTER_BEST) - { - /* adjust vector for maximum contribution at 0.5, 0.5 of each texel. */ - v.vector[0] -= v.vector[2] / 2; - v.vector[1] -= v.vector[2] / 2; - unit.vector[0] -= unit.vector[2] / 2; - unit.vector[1] -= unit.vector[2] / 2; - - if (pict->common.repeat == PIXMAN_REPEAT_NORMAL) { - if (pixman_region_n_rects(pict->common.src_clip) == 1) { - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - int x1, x2, y1, y2, distx, idistx, disty, idisty; - uint32_t *b; - uint32_t tl, tr, bl, br, r; - uint32_t ft, fb; - - if (!affine) { - pixman_fixed_48_16_t div; - div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2]; - x1 = div >> 16; - distx = ((pixman_fixed_t)div >> 8) & 0xff; - div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2]; - y1 = div >> 16; - disty = ((pixman_fixed_t)div >> 8) & 0xff; - } else { - x1 = v.vector[0] >> 16; - distx = (v.vector[0] >> 8) & 0xff; - y1 = v.vector[1] >> 16; - disty = (v.vector[1] >> 8) & 0xff; - } - x2 = x1 + 1; - y2 = y1 + 1; - - idistx = 256 - distx; - idisty = 256 - disty; - - x1 = MOD (x1, pict->width); - x2 = MOD (x2, pict->width); - y1 = MOD (y1, pict->height); - y2 = MOD (y2, pict->height); - - b = bits + y1*stride; - - tl = fetch((pixman_image_t *)pict, b, x1, indexed); - tr = fetch((pixman_image_t *)pict, b, x2, indexed); - b = bits + y2*stride; - bl = fetch((pixman_image_t *)pict, b, x1, indexed); - br = fetch((pixman_image_t *)pict, b, x2, indexed); - - ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; - fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; - r = (((ft * idisty + fb * disty) >> 16) & 0xff); - ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; - fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; - r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); - ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; - fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; - r |= (((ft * idisty + fb * disty)) & 0xff0000); - ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; - fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; - r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); - *(buffer + i) = r; - } - } - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } else { - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - int x1, x2, y1, y2, distx, idistx, disty, idisty; - uint32_t *b; - uint32_t tl, tr, bl, br, r; - uint32_t ft, fb; - - if (!affine) { - pixman_fixed_48_16_t div; - div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2]; - x1 = div >> 16; - distx = ((pixman_fixed_t)div >> 8) & 0xff; - div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2]; - y1 = div >> 16; - disty = ((pixman_fixed_t)div >> 8) & 0xff; - } else { - x1 = v.vector[0] >> 16; - distx = (v.vector[0] >> 8) & 0xff; - y1 = v.vector[1] >> 16; - disty = (v.vector[1] >> 8) & 0xff; - } - x2 = x1 + 1; - y2 = y1 + 1; - - idistx = 256 - distx; - idisty = 256 - disty; - - x1 = MOD (x1, pict->width); - x2 = MOD (x2, pict->width); - y1 = MOD (y1, pict->height); - y2 = MOD (y2, pict->height); - - b = bits + y1*stride; - - tl = pixman_region_contains_point(pict->common.src_clip, x1, y1, &box) - ? fetch((pixman_image_t *)pict, b, x1, indexed) : 0; - tr = pixman_region_contains_point(pict->common.src_clip, x2, y1, &box) - ? fetch((pixman_image_t *)pict, b, x2, indexed) : 0; - b = bits + (y2)*stride; - bl = pixman_region_contains_point(pict->common.src_clip, x1, y2, &box) - ? fetch((pixman_image_t *)pict, b, x1, indexed) : 0; - br = pixman_region_contains_point(pict->common.src_clip, x2, y2, &box) - ? fetch((pixman_image_t *)pict, b, x2, indexed) : 0; - - ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; - fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; - r = (((ft * idisty + fb * disty) >> 16) & 0xff); - ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; - fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; - r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); - ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; - fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; - r |= (((ft * idisty + fb * disty)) & 0xff0000); - ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; - fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; - r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); - *(buffer + i) = r; - } - } - - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } - } else { - if (pixman_region_n_rects(pict->common.src_clip) == 1) { - box = pict->common.src_clip->extents; - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off; - uint32_t *b; - uint32_t tl, tr, bl, br, r; - pixman_bool_t x1_out, x2_out, y1_out, y2_out; - uint32_t ft, fb; - - if (!affine) { - pixman_fixed_48_16_t div; - div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2]; - x1 = div >> 16; - distx = ((pixman_fixed_t)div >> 8) & 0xff; - div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2]; - y1 = div >> 16; - disty = ((pixman_fixed_t)div >> 8) & 0xff; - } else { - x1 = v.vector[0] >> 16; - distx = (v.vector[0] >> 8) & 0xff; - y1 = v.vector[1] >> 16; - disty = (v.vector[1] >> 8) & 0xff; - } - x2 = x1 + 1; - y2 = y1 + 1; - - idistx = 256 - distx; - idisty = 256 - disty; - - b = bits + (y1)*stride; - x_off = x1; - - x1_out = (x1 < box.x1) | (x1 >= box.x2); - x2_out = (x2 < box.x1) | (x2 >= box.x2); - y1_out = (y1 < box.y1) | (y1 >= box.y2); - y2_out = (y2 < box.y1) | (y2 >= box.y2); - - tl = x1_out|y1_out ? 0 : fetch((pixman_image_t *)pict, b, x_off, indexed); - tr = x2_out|y1_out ? 0 : fetch((pixman_image_t *)pict, b, x_off + 1, indexed); - b += stride; - bl = x1_out|y2_out ? 0 : fetch((pixman_image_t *)pict, b, x_off, indexed); - br = x2_out|y2_out ? 0 : fetch((pixman_image_t *)pict, b, x_off + 1, indexed); - - ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; - fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; - r = (((ft * idisty + fb * disty) >> 16) & 0xff); - ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; - fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; - r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); - ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; - fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; - r |= (((ft * idisty + fb * disty)) & 0xff0000); - ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; - fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; - r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); - *(buffer + i) = r; - } - } - - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } else { - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off; - uint32_t *b; - uint32_t tl, tr, bl, br, r; - uint32_t ft, fb; - - if (!affine) { - pixman_fixed_48_16_t div; - div = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2]; - x1 = div >> 16; - distx = ((pixman_fixed_t)div >> 8) & 0xff; - div = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2]; - y1 = div >> 16; - disty = ((pixman_fixed_t)div >> 8) & 0xff; - } else { - x1 = v.vector[0] >> 16; - distx = (v.vector[0] >> 8) & 0xff; - y1 = v.vector[1] >> 16; - disty = (v.vector[1] >> 8) & 0xff; - } - x2 = x1 + 1; - y2 = y1 + 1; - - idistx = 256 - distx; - idisty = 256 - disty; - - b = bits + (y1)*stride; - x_off = x1; - - tl = pixman_region_contains_point(pict->common.src_clip, x1, y1, &box) - ? fetch((pixman_image_t *)pict, b, x_off, indexed) : 0; - tr = pixman_region_contains_point(pict->common.src_clip, x2, y1, &box) - ? fetch((pixman_image_t *)pict, b, x_off + 1, indexed) : 0; - b += stride; - bl = pixman_region_contains_point(pict->common.src_clip, x1, y2, &box) - ? fetch((pixman_image_t *)pict, b, x_off, indexed) : 0; - br = pixman_region_contains_point(pict->common.src_clip, x2, y2, &box) - ? fetch((pixman_image_t *)pict, b, x_off + 1, indexed) : 0; - - ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; - fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; - r = (((ft * idisty + fb * disty) >> 16) & 0xff); - ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; - fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; - r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); - ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; - fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; - r |= (((ft * idisty + fb * disty)) & 0xff0000); - ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; - fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; - r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); - *(buffer + i) = r; - } - } - - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } - } - } else if (pict->common.filter == PIXMAN_FILTER_CONVOLUTION) { - pixman_fixed_t *params = pict->common.filter_params; - int32_t cwidth = pixman_fixed_to_int(params[0]); - int32_t cheight = pixman_fixed_to_int(params[1]); - int xoff = (params[0] - pixman_fixed_1) >> 1; - int yoff = (params[1] - pixman_fixed_1) >> 1; - params += 2; - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - if (!v.vector[2]) { - *(buffer + i) = 0; - } else { - int x1, x2, y1, y2, x, y; - int32_t srtot, sgtot, sbtot, satot; - pixman_fixed_t *p = params; - - if (!affine) { - pixman_fixed_48_16_t tmp; - tmp = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2] - xoff; - x1 = pixman_fixed_to_int(tmp); - tmp = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2] - yoff; - y1 = pixman_fixed_to_int(tmp); - } else { - x1 = pixman_fixed_to_int(v.vector[0] - xoff); - y1 = pixman_fixed_to_int(v.vector[1] - yoff); - } - x2 = x1 + cwidth; - y2 = y1 + cheight; - - srtot = sgtot = sbtot = satot = 0; - - for (y = y1; y < y2; y++) { - int ty = (pict->common.repeat == PIXMAN_REPEAT_NORMAL) ? MOD (y, pict->height) : y; - for (x = x1; x < x2; x++) { - if (*p) { - int tx = (pict->common.repeat == PIXMAN_REPEAT_NORMAL) ? MOD (x, pict->width) : x; - if (pixman_region_contains_point (pict->common.src_clip, tx, ty, &box)) { - uint32_t *b = bits + (ty)*stride; - uint32_t c = fetch((pixman_image_t *)pict, b, tx, indexed); - - srtot += Red(c) * *p; - sgtot += Green(c) * *p; - sbtot += Blue(c) * *p; - satot += Alpha(c) * *p; - } - } - p++; - } - } - - satot >>= 16; - srtot >>= 16; - sgtot >>= 16; - sbtot >>= 16; - - if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff; - if (srtot < 0) srtot = 0; else if (srtot > 0xff) srtot = 0xff; - if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff; - if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff; - - *(buffer + i) = ((satot << 24) | - (srtot << 16) | - (sgtot << 8) | - (sbtot )); - } - } - v.vector[0] += unit.vector[0]; - v.vector[1] += unit.vector[1]; - v.vector[2] += unit.vector[2]; - } - } - - fbFinishAccess (pict->pDrawable); -} - - -static void fbFetchExternalAlpha(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) -{ - int i; - uint32_t _alpha_buffer[SCANLINE_BUFFER_LENGTH]; - uint32_t *alpha_buffer = _alpha_buffer; - - if (!pict->common.alpha_map) { - fbFetchTransformed (pict, x, y, width, buffer, mask, maskBits); - return; - } - if (width > SCANLINE_BUFFER_LENGTH) - alpha_buffer = (uint32_t *) pixman_malloc_ab (width, sizeof(uint32_t)); - - fbFetchTransformed(pict, x, y, width, buffer, mask, maskBits); - fbFetchTransformed((bits_image_t *)pict->common.alpha_map, x - pict->common.alpha_origin.x, - y - pict->common.alpha_origin.y, width, alpha_buffer, - mask, maskBits); - for (i = 0; i < width; ++i) { - if (!mask || mask[i] & maskBits) - { - int a = alpha_buffer[i]>>24; - *(buffer + i) = (a << 24) - | (div_255(Red(*(buffer + i)) * a) << 16) - | (div_255(Green(*(buffer + i)) * a) << 8) - | (div_255(Blue(*(buffer + i)) * a)); - } - } - - if (alpha_buffer != _alpha_buffer) - free(alpha_buffer); -} - -static void fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer) +fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer) { uint32_t *bits; - uint32_t stride; - storeProc store = storeProcForPicture(pict); + int32_t stride; + storeProc store = STORE_PROC_FOR_PICTURE(pict); const pixman_indexed_t * indexed = pict->indexed; - - bits = pict->bits; - stride = pict->rowstride; - bits += y*stride; - store((pixman_image_t *)pict, bits, buffer, x, width, indexed); - fbFinishAccess (pict->pDrawable); -} -static void fbStoreExternalAlpha(bits_image_t * pict, int x, int y, int width, uint32_t *buffer) -{ - uint32_t *bits, *alpha_bits; - uint32_t stride, astride; - int ax, ay; - storeProc store; - storeProc astore; - const pixman_indexed_t * indexed = pict->indexed; - const pixman_indexed_t * aindexed; - - if (!pict->common.alpha_map) { - fbStore(pict, x, y, width, buffer); - return; - } - - store = storeProcForPicture(pict); - astore = storeProcForPicture(pict->common.alpha_map); - aindexed = pict->common.alpha_map->indexed; - - ax = x; - ay = y; - bits = pict->bits; stride = pict->rowstride; - - alpha_bits = pict->common.alpha_map->bits; - astride = pict->common.alpha_map->rowstride; - - bits += y*stride; - alpha_bits += (ay - pict->common.alpha_origin.y)*astride; - - + bits += y*stride; store((pixman_image_t *)pict, bits, buffer, x, width, indexed); - astore((pixman_image_t *)pict->common.alpha_map, - alpha_bits, buffer, ax - pict->common.alpha_origin.x, width, aindexed); - - fbFinishAccess (pict->alpha_map->pDrawable); - fbFinishAccess (pict->pDrawable); } typedef void (*scanStoreProc)(pixman_image_t *, int, int, int, uint32_t *); @@ -4161,9 +184,9 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, unsigned int srcClass = SOURCE_IMAGE_CLASS_UNKNOWN; unsigned int maskClass = SOURCE_IMAGE_CLASS_UNKNOWN; uint32_t *bits; - uint32_t stride; + int32_t stride; int xoff, yoff; - + if (data->op == PIXMAN_OP_CLEAR) fetchSrc = NULL; else if (IS_SOURCE_IMAGE (data->src)) @@ -4176,28 +199,29 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, else { bits_image_t *bits = (bits_image_t *)data->src; - + if (bits->common.alpha_map) { - fetchSrc = (scanFetchProc)fbFetchExternalAlpha; + fetchSrc = (scanFetchProc)FB_FETCH_EXTERNAL_ALPHA; } - else if (bits->common.repeat == PIXMAN_REPEAT_NORMAL && + else if ((bits->common.repeat == PIXMAN_REPEAT_NORMAL || bits->common.repeat == PIXMAN_REPEAT_PAD) && bits->width == 1 && bits->height == 1) { fetchSrc = (scanFetchProc)fbFetchSolid; srcClass = SOURCE_IMAGE_CLASS_HORIZONTAL; } - else if (!bits->common.transform && bits->common.filter != PIXMAN_FILTER_CONVOLUTION) + else if (!bits->common.transform && bits->common.filter != PIXMAN_FILTER_CONVOLUTION + && bits->common.repeat != PIXMAN_REPEAT_PAD) { fetchSrc = (scanFetchProc)fbFetch; } else { - fetchSrc = (scanFetchProc)fbFetchTransformed; + fetchSrc = (scanFetchProc)FB_FETCH_TRANSFORMED; } } - + if (!data->mask || data->op == PIXMAN_OP_CLEAR) { fetchMask = NULL; @@ -4214,29 +238,30 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, else { bits_image_t *bits = (bits_image_t *)data->mask; - + if (bits->common.alpha_map) { - fetchMask = (scanFetchProc)fbFetchExternalAlpha; + fetchMask = (scanFetchProc)FB_FETCH_EXTERNAL_ALPHA; } - else if (bits->common.repeat == PIXMAN_REPEAT_NORMAL && + else if ((bits->common.repeat == PIXMAN_REPEAT_NORMAL || bits->common.repeat == PIXMAN_REPEAT_PAD) && bits->width == 1 && bits->height == 1) { fetchMask = (scanFetchProc)fbFetchSolid; maskClass = SOURCE_IMAGE_CLASS_HORIZONTAL; } - else if (!bits->common.transform && bits->common.filter != PIXMAN_FILTER_CONVOLUTION) + else if (!bits->common.transform && bits->common.filter != PIXMAN_FILTER_CONVOLUTION + && bits->common.repeat != PIXMAN_REPEAT_PAD) fetchMask = (scanFetchProc)fbFetch; else - fetchMask = (scanFetchProc)fbFetchTransformed; + fetchMask = (scanFetchProc)FB_FETCH_TRANSFORMED; } } - + if (data->dest->common.alpha_map) { - fetchDest = (scanFetchProc)fbFetchExternalAlpha; - store = (scanStoreProc)fbStoreExternalAlpha; - + fetchDest = (scanFetchProc)FB_FETCH_EXTERNAL_ALPHA; + store = (scanStoreProc)FB_STORE_EXTERNAL_ALPHA; + if (data->op == PIXMAN_OP_CLEAR || data->op == PIXMAN_OP_SRC) fetchDest = NULL; } @@ -4244,7 +269,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, { fetchDest = (scanFetchProc)fbFetch; store = (scanStoreProc)fbStore; - + switch (data->op) { case PIXMAN_OP_CLEAR: @@ -4266,7 +291,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, break; } } - + if (!store) { bits = data->dest->bits.bits; @@ -4279,11 +304,11 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, stride = 0; xoff = yoff = 0; } - + if (fetchSrc && fetchMask && data->mask && - data->mask->common.type == BITS && + data->mask->common.type == BITS && data->mask->common.component_alpha && PIXMAN_FORMAT_RGB (data->mask->bits.format)) { @@ -4291,7 +316,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, CombineFuncC compose = PIXMAN_COMPOSE_FUNCTIONS.combineC[data->op]; if (!compose) return; - + for (i = 0; i < data->height; ++i) { /* fill first half of scanline with source */ if (fetchSrc) @@ -4302,11 +327,11 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, source can be optimized */ fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); - + if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL) fetchMask = NULL; } - + if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL) { fetchSrc (data->src, data->xSrc, data->ySrc + i, @@ -4325,17 +350,17 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); } - + if (store) { /* fill dest into second half of scanline */ if (fetchDest) fetchDest (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer, 0, 0); - + /* blend */ compose (dest_buffer, src_buffer, mask_buffer, data->width); - + /* write back */ store (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); @@ -4355,10 +380,10 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, CombineFuncU compose = PIXMAN_COMPOSE_FUNCTIONS.combineU[data->op]; if (!compose) return; - + if (fetchMask) mask_buffer = dest_buffer + data->width; - + for (i = 0; i < data->height; ++i) { /* fill first half of scanline with source */ if (fetchSrc) @@ -4369,24 +394,24 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, source can be optimized */ fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); - + if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL) fetchMask = NULL; } - + if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL) { fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, 0, 0); - + if (mask_buffer) { - fbCombineInU (mask_buffer, src_buffer, data->width); + PIXMAN_COMPOSE_FUNCTIONS.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width); src_mask_buffer = mask_buffer; } else src_mask_buffer = src_buffer; - + fetchSrc = NULL; } else @@ -4394,12 +419,12 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, mask_buffer, 0xff000000); - + if (mask_buffer) PIXMAN_COMPOSE_FUNCTIONS.combineMaskU (src_buffer, mask_buffer, data->width); - + src_mask_buffer = src_buffer; } } @@ -4407,22 +432,22 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, { fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); - - fbCombineInU (mask_buffer, src_buffer, data->width); - + + PIXMAN_COMPOSE_FUNCTIONS.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width); + src_mask_buffer = mask_buffer; } - + if (store) { /* fill dest into second half of scanline */ if (fetchDest) fetchDest (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer, 0, 0); - + /* blend */ compose (dest_buffer, src_mask_buffer, data->width); - + /* write back */ store (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); @@ -4436,9 +461,6 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, } } } - - if (!store) - fbFinishAccess (data->dest->pDrawable); } #ifndef PIXMAN_FB_ACCESSORS diff --git a/lib/pixman/pixman/pixman-edge-imp.h b/lib/pixman/pixman/pixman-edge-imp.h index e35c02bdb..016bfaba7 100644 --- a/lib/pixman/pixman/pixman-edge-imp.h +++ b/lib/pixman/pixman/pixman-edge-imp.h @@ -1,6 +1,4 @@ /* - * $Id: pixman-edge-imp.h,v 1.1 2007/10/03 20:48:59 matthieu Exp $ - * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -35,34 +33,49 @@ rasterizeEdges (pixman_image_t *image, pixman_fixed_t y = t; uint32_t *line; uint32_t *buf = (image)->bits.bits; - int32_t stride = (image)->bits.rowstride; - int32_t width = (image)->bits.width; - + int stride = (image)->bits.rowstride; + int width = (image)->bits.width; + line = buf + pixman_fixed_to_int (y) * stride; - + for (;;) { pixman_fixed_t lx; pixman_fixed_t rx; int lxi; int rxi; - - /* clip X */ + lx = l->x; + rx = r->x; +#if N_BITS == 1 + /* For the non-antialiased case, round the coordinates up, in effect + * sampling the center of the pixel. (The AA case does a similar + * adjustment in RenderSamplesX) */ + lx += X_FRAC_FIRST(1); + rx += X_FRAC_FIRST(1); +#endif + /* clip X */ if (lx < 0) lx = 0; - rx = r->x; if (pixman_fixed_to_int (rx) >= width) +#if N_BITS == 1 rx = pixman_int_to_fixed (width); - +#else + /* Use the last pixel of the scanline, covered 100%. + * We can't use the first pixel following the scanline, + * because accessing it could result in a buffer overrun. + */ + rx = pixman_int_to_fixed (width) - 1; +#endif + /* Skip empty (or backwards) sections */ if (rx > lx) { - + /* Find pixel bounds for span */ lxi = pixman_fixed_to_int (lx); rxi = pixman_fixed_to_int (rx); - + #if N_BITS == 1 { uint32_t *a = line; @@ -71,30 +84,30 @@ rasterizeEdges (pixman_image_t *image, int nmiddle; int width = rxi - lxi; int x = lxi; - + a += x >> FB_SHIFT; x &= FB_MASK; - + FbMaskBits (x, width, startmask, nmiddle, endmask); if (startmask) { - WRITE(a, READ(a) | startmask); + WRITE(image, a, READ(image, a) | startmask); a++; } while (nmiddle--) - WRITE(a++, FB_ALLONES); + WRITE(image, a++, FB_ALLONES); if (endmask) - WRITE(a, READ(a) | endmask); + WRITE(image, a, READ(image, a) | endmask); } #else { DefineAlpha(line,lxi); int lxs; int rxs; - + /* Sample coverage for edge pixels */ lxs = RenderSamplesX (lx, N_BITS); rxs = RenderSamplesX (rx, N_BITS); - + /* Add coverage across row */ if (lxi == rxi) { @@ -103,7 +116,7 @@ rasterizeEdges (pixman_image_t *image, else { int xi; - + AddAlpha (N_X_FRAC(N_BITS) - lxs); StepAlpha; for (xi = lxi + 1; xi < rxi; xi++) @@ -111,20 +124,15 @@ rasterizeEdges (pixman_image_t *image, AddAlpha (N_X_FRAC(N_BITS)); StepAlpha; } - /* Do not add in a 0 alpha here. This check is necessary - * to avoid a buffer overrun when rx is exactly on a pixel - * boundary. - */ - if (rxs != 0) - AddAlpha (rxs); + AddAlpha (rxs); } } #endif } - + if (y == b) break; - + #if N_BITS > 1 if (pixman_fixed_frac (y) != Y_FRAC_LAST(N_BITS)) { diff --git a/lib/pixman/pixman/pixman-edge.c b/lib/pixman/pixman/pixman-edge.c index 7f6980156..717284f7d 100644 --- a/lib/pixman/pixman/pixman-edge.c +++ b/lib/pixman/pixman/pixman-edge.c @@ -1,6 +1,4 @@ /* - * $Id: pixman-edge.c,v 1.1 2007/10/03 20:48:55 matthieu Exp $ - * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -21,9 +19,13 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ + +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + #include <string.h> -#include "pixman.h" + #include "pixman-private.h" #ifdef PIXMAN_FB_ACCESSORS @@ -54,10 +56,10 @@ #define StepAlpha ((__ap += __ao), (__ao ^= 1)) -#define AddAlpha(a) { \ - uint8_t __o = READ(__ap); \ - uint8_t __a = (a) + Get4(__o, __ao); \ - WRITE(__ap, Put4 (__o, __ao, __a | (0 - ((__a) >> 4)))); \ +#define AddAlpha(a) { \ + uint8_t __o = READ(image, __ap); \ + uint8_t __a = (a) + Get4(__o, __ao); \ + WRITE(image, __ap, Put4 (__o, __ao, __a | (0 - ((__a) >> 4)))); \ } #include "pixman-edge-imp.h" @@ -100,7 +102,7 @@ clip255 (int x) \ while (i__--) \ { \ - WRITE((buf__), clip255 (READ((buf__)) + (val__))); \ + WRITE(image, (buf__), clip255 (READ(image, (buf__)) + (val__))); \ (buf__)++; \ } \ } while (0) @@ -127,51 +129,55 @@ fbRasterizeEdges8 (pixman_image_t *image, uint32_t *line; int fill_start = -1, fill_end = -1; int fill_size = 0; - uint32_t *buf = (image)->bits.bits; - int32_t stride = (image)->bits.rowstride; - int32_t width = (image)->bits.width; - + uint32_t *buf = (image)->bits.bits; + int stride = (image)->bits.rowstride; + int width = (image)->bits.width; + line = buf + pixman_fixed_to_int (y) * stride; - + for (;;) { uint8_t *ap = (uint8_t *) line; pixman_fixed_t lx, rx; int lxi, rxi; - + /* clip X */ lx = l->x; if (lx < 0) lx = 0; rx = r->x; if (pixman_fixed_to_int (rx) >= width) - rx = pixman_int_to_fixed (width); - + /* Use the last pixel of the scanline, covered 100%. + * We can't use the first pixel following the scanline, + * because accessing it could result in a buffer overrun. + */ + rx = pixman_int_to_fixed (width) - 1; + /* Skip empty (or backwards) sections */ if (rx > lx) { int lxs, rxs; - + /* Find pixel bounds for span. */ lxi = pixman_fixed_to_int (lx); rxi = pixman_fixed_to_int (rx); - + /* Sample coverage for edge pixels */ lxs = RenderSamplesX (lx, 8); rxs = RenderSamplesX (rx, 8); - + /* Add coverage across row */ if (lxi == rxi) { - WRITE(ap +lxi, clip255 (READ(ap + lxi) + rxs - lxs)); + WRITE(image, ap +lxi, clip255 (READ(image, ap + lxi) + rxs - lxs)); } else { - WRITE(ap + lxi, clip255 (READ(ap + lxi) + N_X_FRAC(8) - lxs)); - + WRITE(image, ap + lxi, clip255 (READ(image, ap + lxi) + N_X_FRAC(8) - lxs)); + /* Move forward so that lxi/rxi is the pixel span */ lxi++; - + /* Don't bother trying to optimize the fill unless * the span is longer than 4 pixels. */ if (rxi - lxi > 4) @@ -209,7 +215,7 @@ fbRasterizeEdges8 (pixman_image_t *image, add_saturate_8 (ap + lxi, N_X_FRAC(8), fill_start - lxi); } - + /* Update fill_end */ if (rxi < fill_end) { @@ -232,21 +238,17 @@ fbRasterizeEdges8 (pixman_image_t *image, { add_saturate_8 (ap + lxi, N_X_FRAC(8), rxi - lxi); } - - /* Do not add in a 0 alpha here. This check is - * necessary to avoid a buffer overrun, (when rx - * is exactly on a pixel boundary). */ - if (rxs) - WRITE(ap + rxi, clip255 (READ(ap + rxi) + rxs)); + + WRITE(image, ap + rxi, clip255 (READ(image, ap + rxi) + rxs)); } } - + if (y == b) { /* We're done, make sure we clean up any remaining fill. */ if (fill_start != fill_end) { if (fill_size == N_Y_FRAC(8)) { - MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start); + MEMSET_WRAPPED (image, ap + fill_start, 0xff, fill_end - fill_start); } else { @@ -256,7 +258,7 @@ fbRasterizeEdges8 (pixman_image_t *image, } break; } - + if (pixman_fixed_frac (y) != Y_FRAC_LAST(8)) { RenderEdgeStepSmall (l); @@ -272,7 +274,7 @@ fbRasterizeEdges8 (pixman_image_t *image, { if (fill_size == N_Y_FRAC(8)) { - MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start); + MEMSET_WRAPPED (image, ap + fill_start, 0xff, fill_end - fill_start); } else { diff --git a/lib/pixman/pixman/pixman-image.c b/lib/pixman/pixman/pixman-image.c index c39ee9b64..9b6846e16 100644 --- a/lib/pixman/pixman/pixman-image.c +++ b/lib/pixman/pixman/pixman-image.c @@ -20,13 +20,14 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #include <stdlib.h> #include <stdio.h> #include <string.h> -#include "pixman.h" #include "pixman-private.h" static void @@ -49,7 +50,7 @@ init_gradient (gradient_t *gradient, return FALSE; memcpy (gradient->stops, stops, n_stops * sizeof (pixman_gradient_stop_t)); - + gradient->n_stops = n_stops; gradient->stop_range = 0xffff; @@ -73,7 +74,7 @@ static pixman_image_t * allocate_image (void) { pixman_image_t *image = malloc (sizeof (pixman_image_t)); - + if (image) { image_common_t *common = &image->common; @@ -132,7 +133,7 @@ pixman_image_unref (pixman_image_t *image) if (image->type == BITS && image->bits.indexed) free (image->bits.indexed); #endif - + #if 0 memset (image, 0xaa, sizeof (pixman_image_t)); #endif @@ -142,10 +143,10 @@ pixman_image_unref (pixman_image_t *image) free (image->gradient.stops); } - + if (image->type == BITS && image->bits.free_me) free (image->bits.free_me); - + free (image); return TRUE; @@ -161,9 +162,9 @@ pixman_image_create_solid_fill (pixman_color_t *color) pixman_image_t *img = allocate_image(); if (!img) return NULL; - + init_source_image (&img->solid.common); - + img->type = SOLID; img->solid.color = color_to_uint32 (color); @@ -180,14 +181,14 @@ pixman_image_create_linear_gradient (pixman_point_fixed_t *p1, linear_gradient_t *linear; return_val_if_fail (n_stops >= 2, NULL); - + image = allocate_image(); - + if (!image) return NULL; linear = &image->linear; - + if (!init_gradient (&linear->common, stops, n_stops)) { free (image); @@ -215,7 +216,7 @@ pixman_image_create_radial_gradient (pixman_point_fixed_t *inner, radial_gradient_t *radial; return_val_if_fail (n_stops >= 2, NULL); - + image = allocate_image(); if (!image) @@ -230,7 +231,7 @@ pixman_image_create_radial_gradient (pixman_point_fixed_t *inner, } image->type = RADIAL; - + radial->c1.x = inner->x; radial->c1.y = inner->y; radial->c1.radius = inner_radius; @@ -243,7 +244,7 @@ pixman_image_create_radial_gradient (pixman_point_fixed_t *inner, radial->A = (radial->cdx * radial->cdx + radial->cdy * radial->cdy - radial->dr * radial->dr); - + return image; } @@ -260,7 +261,7 @@ pixman_image_create_conical_gradient (pixman_point_fixed_t *center, return NULL; conical = &image->conical; - + if (!init_gradient (&conical->common, stops, n_stops)) { free (image); @@ -283,9 +284,32 @@ create_bits (pixman_format_code_t format, int stride; int buf_size; int bpp; - + + /* what follows is a long-winded way, avoiding any possibility of integer + * overflows, of saying: + * stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (uint32_t); + */ + bpp = PIXMAN_FORMAT_BPP (format); - stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (uint32_t); + if (pixman_multiply_overflows_int (width, bpp)) + return NULL; + + stride = width * bpp; + if (pixman_addition_overflows_int (stride, FB_MASK)) + return NULL; + + stride += FB_MASK; + stride >>= FB_SHIFT; + +#if FB_SHIFT < 2 + if (pixman_multiply_overflows_int (stride, sizeof (uint32_t))) + return NULL; +#endif + stride *= sizeof (uint32_t); + + if (pixman_multiply_overflows_int (height, stride)) + return NULL; + buf_size = height * stride; if (rowstride_bytes) @@ -298,11 +322,11 @@ static void reset_clip_region (pixman_image_t *image) { pixman_region_fini (&image->common.clip_region); - + if (image->type == BITS) { pixman_region_init_rect (&image->common.clip_region, 0, 0, - image->bits.width, image->bits.height); + image->bits.width, image->bits.height); } else { @@ -320,22 +344,25 @@ pixman_image_create_bits (pixman_format_code_t format, pixman_image_t *image; uint32_t *free_me = NULL; - /* must be a whole number of uint32_t's + /* must be a whole number of uint32_t's */ return_val_if_fail (bits == NULL || - (rowstride_bytes % sizeof (uint32_t)) == 0, NULL); + (rowstride_bytes % sizeof (uint32_t)) == 0, NULL); - if (!bits) + if (!bits && width && height) { free_me = bits = create_bits (format, width, height, &rowstride_bytes); if (!bits) return NULL; } - + image = allocate_image(); - if (!image) + if (!image) { + if (free_me) + free (free_me); return NULL; + } image->type = BITS; image->bits.format = format; @@ -343,8 +370,8 @@ pixman_image_create_bits (pixman_format_code_t format, image->bits.height = height; image->bits.bits = bits; image->bits.free_me = free_me; - - image->bits.rowstride = rowstride_bytes / sizeof (uint32_t); /* we store it in number + + image->bits.rowstride = rowstride_bytes / (int) sizeof (uint32_t); /* we store it in number * of uint32_t's */ image->bits.indexed = NULL; @@ -370,7 +397,7 @@ pixman_image_set_clip_region (pixman_image_t *image, else { reset_clip_region (image); - + return TRUE; } } @@ -395,7 +422,7 @@ pixman_image_set_transform (pixman_image_t *image, { 0, 0, pixman_fixed_1 } } }; - + image_common_t *common = (image_common_t *)image; if (common->transform == transform) @@ -407,7 +434,7 @@ pixman_image_set_transform (pixman_image_t *image, common->transform = NULL; return TRUE; } - + if (common->transform == NULL) common->transform = malloc (sizeof (pixman_transform_t)); if (common->transform == NULL) @@ -425,7 +452,7 @@ pixman_image_set_repeat (pixman_image_t *image, image->common.repeat = repeat; } -pixman_bool_t +pixman_bool_t pixman_image_set_filter (pixman_image_t *image, pixman_filter_t filter, const pixman_fixed_t *params, @@ -449,7 +476,7 @@ pixman_image_set_filter (pixman_image_t *image, } common->filter = filter; - + if (common->filter_params) free (common->filter_params); @@ -490,7 +517,7 @@ pixman_image_set_alpha_map (pixman_image_t *image, int16_t y) { image_common_t *common = (image_common_t *)image; - + return_if_fail (!alpha_map || alpha_map->type == BITS); if (common->alpha_map != (bits_image_t *)alpha_map) @@ -558,7 +585,7 @@ int pixman_image_get_stride (pixman_image_t *image) { if (image->type == BITS) - return image->bits.rowstride * sizeof (uint32_t); + return image->bits.rowstride * (int) sizeof (uint32_t); return 0; } @@ -589,7 +616,7 @@ color_to_pixel (pixman_color_t *color, { return FALSE; } - + if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_ABGR) { c = ((c & 0xff000000) >> 0) | @@ -608,7 +635,7 @@ color_to_pixel (pixman_color_t *color, printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue); printf ("pixel: %x\n", c); #endif - + *pixel = c; return TRUE; } @@ -623,7 +650,7 @@ pixman_image_fill_rectangles (pixman_op_t op, pixman_image_t *solid; pixman_color_t c; int i; - + if (color->alpha == 0xffff) { if (op == PIXMAN_OP_OVER) @@ -638,14 +665,14 @@ pixman_image_fill_rectangles (pixman_op_t op, c.alpha = 0; color = &c; - + op = PIXMAN_OP_SRC; } if (op == PIXMAN_OP_SRC) { uint32_t pixel; - + if (color_to_pixel (color, &pixel, dest->bits.format)) { for (i = 0; i < n_rects; ++i) @@ -653,7 +680,7 @@ pixman_image_fill_rectangles (pixman_op_t op, pixman_region16_t fill_region; int n_boxes, j; pixman_box16_t *boxes; - + pixman_region_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height); pixman_region_intersect (&fill_region, &fill_region, &dest->common.clip_region); @@ -671,7 +698,7 @@ pixman_image_fill_rectangles (pixman_op_t op, return TRUE; } } - + solid = pixman_image_create_solid_fill (color); if (!solid) return FALSE; @@ -679,13 +706,13 @@ pixman_image_fill_rectangles (pixman_op_t op, for (i = 0; i < n_rects; ++i) { const pixman_rectangle16_t *rect = &(rects[i]); - + pixman_image_composite (op, solid, NULL, dest, 0, 0, 0, 0, rect->x, rect->y, rect->width, rect->height); } - + pixman_image_unref (solid); return TRUE; diff --git a/lib/pixman/pixman/pixman-mmx.c b/lib/pixman/pixman/pixman-mmx.c index 8c7be6df4..8afbcb8eb 100644 --- a/lib/pixman/pixman/pixman-mmx.c +++ b/lib/pixman/pixman/pixman-mmx.c @@ -24,18 +24,17 @@ * * Author: Søren Sandmann (sandmann@redhat.com) * Minor Improvements: Nicholas Miell (nmiell@gmail.com) - * MMX code paths for fbcompose.c by Lars Knoll (lars@trolltech.com) + * MMX code paths for fbcompose.c by Lars Knoll (lars@trolltech.com) * * Based on work by Owen Taylor */ + +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #ifdef USE_MMX -#if defined(__amd64__) || defined(__x86_64__) -#define USE_SSE -#endif - #include <mmintrin.h> #ifdef USE_SSE #include <xmmintrin.h> /* for _mm_shuffle_pi16 and _MM_SHUFFLE */ @@ -45,8 +44,8 @@ #undef READ #undef WRITE -#define READ(x) *(x) -#define WRITE(ptr,v) (*(ptr) = (v)); +#define READ(img,x) *(x) +#define WRITE(img,ptr,v) (*(ptr) = (v)); #define noVERBOSE @@ -77,9 +76,8 @@ /* --------------- MMX primitivess ------------------------------------ */ -typedef unsigned long long ullong; - #ifdef __GNUC__ +typedef unsigned long long ullong; typedef ullong mmxdatafield; #endif #ifdef _MSC_VER @@ -157,6 +155,36 @@ static const MMXData c = #endif static inline __m64 +M64 (ullong x) +{ +#ifdef __GNUC__ + return (__m64)x; +#endif + +#ifdef _MSC_VER + __m64 res; + + res.m64_u64 = x; + return res; +#endif +} + +static inline ullong +ULLONG (__m64 x) +{ +#ifdef __GNUC__ + return (ullong)x; +#endif + +#ifdef _MSC_VER + ullong res; + + res = x.m64_u64; + return res; +#endif +} + +static inline __m64 shift (__m64 v, int s) { if (s > 0) @@ -177,12 +205,12 @@ static inline __m64 pix_multiply (__m64 a, __m64 b) { __m64 res; - + res = _mm_mullo_pi16 (a, b); res = _mm_adds_pu16 (res, MC(4x0080)); res = _mm_adds_pu16 (res, _mm_srli_pi16 (res, 8)); res = _mm_srli_pi16 (res, 8); - + return res; } @@ -204,7 +232,7 @@ static inline __m64 expand_alpha_rev (__m64 pixel) { return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE(0, 0, 0, 0)); -} +} static inline __m64 invert_colors (__m64 pixel) @@ -218,7 +246,7 @@ static inline __m64 expand_alpha (__m64 pixel) { __m64 t1, t2; - + t1 = shift (pixel, -48); t2 = shift (t1, 16); t1 = _mm_or_si64 (t1, t2); @@ -278,7 +306,7 @@ over_rev_non_pre (__m64 src, __m64 dest) { __m64 srca = expand_alpha (src); __m64 srcfaaa = _mm_or_si64 (srca, MC(full_alpha)); - + return over(pix_multiply(invert_colors(src), srcfaaa), srca, dest); } @@ -331,14 +359,14 @@ store8888 (__m64 v) /* Expand 16 bits positioned at @pos (0-3) of a mmx register into * * 00RR00GG00BB - * + * * --- Expanding 565 in the low word --- - * + * * m = (m << (32 - 3)) | (m << (16 - 5)) | m; * m = m & (01f0003f001f); * m = m * (008404100840); * m = m >> 8; - * + * * Note the trick here - the top word is shifted by another nibble to * avoid it bumping into the middle word */ @@ -347,17 +375,17 @@ expand565 (__m64 pixel, int pos) { __m64 p = pixel; __m64 t1, t2; - + /* move pixel to low 16 bit and zero the rest */ - p = shift (shift (p, (3 - pos) * 16), -48); - + p = shift (shift (p, (3 - pos) * 16), -48); + t1 = shift (p, 36 - 11); t2 = shift (p, 16 - 5); - + p = _mm_or_si64 (t1, p); p = _mm_or_si64 (t2, p); p = _mm_and_si64 (p, MC(565_rgb)); - + pixel = _mm_mullo_pi16 (p, MC(565_unpack_multiplier)); return _mm_srli_pi16 (pixel, 8); } @@ -377,15 +405,15 @@ pack565 (__m64 pixel, __m64 target, int pos) __m64 p = pixel; __m64 t = target; __m64 r, g, b; - + r = _mm_and_si64 (p, MC(565_r)); g = _mm_and_si64 (p, MC(565_g)); b = _mm_and_si64 (p, MC(565_b)); - + r = shift (r, - (32 - 8) + pos * 16); g = shift (g, - (16 - 3) + pos * 16); b = shift (b, - (0 + 3) + pos * 16); - + if (pos == 0) t = _mm_and_si64 (t, MC(mask_0)); else if (pos == 1) @@ -394,10 +422,10 @@ pack565 (__m64 pixel, __m64 target, int pos) t = _mm_and_si64 (t, MC(mask_2)); else if (pos == 3) t = _mm_and_si64 (t, MC(mask_3)); - + p = _mm_or_si64 (r, t); p = _mm_or_si64 (g, p); - + return _mm_or_si64 (b, p); } @@ -453,7 +481,7 @@ static FASTCALL void mmxCombineOverU (uint32_t *dest, const uint32_t *src, int width) { const uint32_t *end = dest + width; - + while (dest < end) { uint32_t ssrc = *src; uint32_t a = ssrc >> 24; @@ -691,9 +719,9 @@ mmxCombineOverC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) __m64 s = load8888(*src); __m64 d = load8888(*dest); __m64 sa = expand_alpha(s); - + *dest = store8888(in_over (s, sa, a, d)); - + ++src; ++dest; ++mask; @@ -712,7 +740,7 @@ mmxCombineOverReverseC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width __m64 da = expand_alpha(d); *dest = store8888(over (d, da, in (s, a))); - + ++src; ++dest; ++mask; @@ -808,7 +836,7 @@ mmxCombineAtopC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) __m64 s = load8888(*src); __m64 d = load8888(*dest); __m64 da = expand_alpha(d); - __m64 sa = expand_alpha(s); + __m64 sa = expand_alpha(s); s = pix_multiply(s, a); a = pix_multiply(a, sa); a = negate(a); @@ -884,8 +912,14 @@ mmxCombineAddC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width) _mm_empty(); } -void fbComposeSetupMMX(void) +void +fbComposeSetupMMX(void) { + static pixman_bool_t initialized = FALSE; + + if (initialized) + return; + /* check if we have MMX support and initialize accordingly */ if (pixman_have_mmx()) { @@ -914,7 +948,9 @@ void fbComposeSetupMMX(void) pixman_composeFunctions.combineC[PIXMAN_OP_ADD] = mmxCombineAddC; pixman_composeFunctions.combineMaskU = mmxCombineMaskU; - } + } + + initialized = TRUE; } @@ -939,62 +975,62 @@ fbCompositeSolid_nx8888mmx (pixman_op_t op, uint16_t w; int dstStride; __m64 vsrc, vsrca; - + CHECKPOINT(); - + fbComposeGetSolid(pSrc, src, pDst->bits.format); - + if (src >> 24 == 0) return; - + fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); - + vsrc = load8888 (src); vsrca = expand_alpha (vsrc); - + while (height--) { dst = dstLine; dstLine += dstStride; w = width; - + CHECKPOINT(); - + while (w && (unsigned long)dst & 7) { *dst = store8888(over(vsrc, vsrca, load8888(*dst))); - + w--; dst++; } - + while (w >= 2) { __m64 vdest; __m64 dest0, dest1; - + vdest = *(__m64 *)dst; - + dest0 = over(vsrc, vsrca, expand8888(vdest, 0)); dest1 = over(vsrc, vsrca, expand8888(vdest, 1)); - + *(__m64 *)dst = pack8888(dest0, dest1); - + dst += 2; w -= 2; } - + CHECKPOINT(); - + while (w) { *dst = store8888(over(vsrc, vsrca, load8888(*dst))); - + w--; dst++; } } - + _mm_empty(); } @@ -1017,69 +1053,69 @@ fbCompositeSolid_nx0565mmx (pixman_op_t op, uint16_t w; int dstStride; __m64 vsrc, vsrca; - + CHECKPOINT(); - + fbComposeGetSolid(pSrc, src, pDst->bits.format); - + if (src >> 24 == 0) return; - + fbComposeGetStart (pDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); - + vsrc = load8888 (src); vsrca = expand_alpha (vsrc); - + while (height--) { dst = dstLine; dstLine += dstStride; w = width; - + CHECKPOINT(); - + while (w && (unsigned long)dst & 7) { ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); + __m64 vdest = expand565 (M64(d), 0); vdest = pack565(over(vsrc, vsrca, vdest), vdest, 0); - *dst = (ullong)vdest; - + *dst = ULLONG(vdest); + w--; dst++; } - + while (w >= 4) { __m64 vdest; - + vdest = *(__m64 *)dst; - + vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 0)), vdest, 0); vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 1)), vdest, 1); vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 2)), vdest, 2); vdest = pack565 (over(vsrc, vsrca, expand565(vdest, 3)), vdest, 3); - + *(__m64 *)dst = vdest; - + dst += 4; w -= 4; } - + CHECKPOINT(); - + while (w) { ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); + __m64 vdest = expand565 (M64(d), 0); vdest = pack565(over(vsrc, vsrca, vdest), vdest, 0); - *dst = (ullong)vdest; - + *dst = ULLONG(vdest); + w--; dst++; } } - + _mm_empty(); } @@ -1102,87 +1138,87 @@ fbCompositeSolidMask_nx8888x8888Cmmx (pixman_op_t op, uint32_t *maskLine; int dstStride, maskStride; __m64 vsrc, vsrca; - + CHECKPOINT(); - + fbComposeGetSolid(pSrc, src, pDst->bits.format); - + srca = src >> 24; if (srca == 0) return; - + fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint32_t, maskStride, maskLine, 1); - + vsrc = load8888(src); vsrca = expand_alpha(vsrc); - + while (height--) { int twidth = width; uint32_t *p = (uint32_t *)maskLine; uint32_t *q = (uint32_t *)dstLine; - + while (twidth && (unsigned long)q & 7) { uint32_t m = *(uint32_t *)p; - + if (m) { __m64 vdest = load8888(*q); vdest = in_over(vsrc, vsrca, load8888(m), vdest); *q = store8888(vdest); } - + twidth--; p++; q++; } - + while (twidth >= 2) { uint32_t m0, m1; m0 = *p; m1 = *(p + 1); - + if (m0 | m1) { __m64 dest0, dest1; __m64 vdest = *(__m64 *)q; - + dest0 = in_over(vsrc, vsrca, load8888(m0), expand8888 (vdest, 0)); dest1 = in_over(vsrc, vsrca, load8888(m1), expand8888 (vdest, 1)); - + *(__m64 *)q = pack8888(dest0, dest1); } - + p += 2; q += 2; twidth -= 2; } - + while (twidth) { uint32_t m = *(uint32_t *)p; - + if (m) { __m64 vdest = load8888(*q); vdest = in_over(vsrc, vsrca, load8888(m), vdest); *q = store8888(vdest); } - + twidth--; p++; q++; } - + dstLine += dstStride; maskLine += maskStride; } - + _mm_empty(); } @@ -1332,7 +1368,7 @@ fbCompositeSrc_x888xnx8888mmx (pixman_op_t op, __m64 vd5 = *(__m64 *)(dst + 10); __m64 vd6 = *(__m64 *)(dst + 12); __m64 vd7 = *(__m64 *)(dst + 14); - + __m64 vs0 = *(__m64 *)(src + 0); __m64 vs1 = *(__m64 *)(src + 2); __m64 vs2 = *(__m64 *)(src + 4); @@ -1341,27 +1377,27 @@ fbCompositeSrc_x888xnx8888mmx (pixman_op_t op, __m64 vs5 = *(__m64 *)(src + 10); __m64 vs6 = *(__m64 *)(src + 12); __m64 vs7 = *(__m64 *)(src + 14); - + vd0 = pack8888 ( in_over (expand8888 (vs0, 0), srca, vmask, expand8888 (vd0, 0)), in_over (expand8888 (vs0, 1), srca, vmask, expand8888 (vd0, 1))); - + vd1 = pack8888 ( in_over (expand8888 (vs1, 0), srca, vmask, expand8888 (vd1, 0)), in_over (expand8888 (vs1, 1), srca, vmask, expand8888 (vd1, 1))); - + vd2 = pack8888 ( in_over (expand8888 (vs2, 0), srca, vmask, expand8888 (vd2, 0)), in_over (expand8888 (vs2, 1), srca, vmask, expand8888 (vd2, 1))); - + vd3 = pack8888 ( in_over (expand8888 (vs3, 0), srca, vmask, expand8888 (vd3, 0)), in_over (expand8888 (vs3, 1), srca, vmask, expand8888 (vd3, 1))); - + vd4 = pack8888 ( in_over (expand8888 (vs4, 0), srca, vmask, expand8888 (vd4, 0)), in_over (expand8888 (vs4, 1), srca, vmask, expand8888 (vd4, 1))); - + vd5 = pack8888 ( in_over (expand8888 (vs5, 0), srca, vmask, expand8888 (vd5, 0)), in_over (expand8888 (vs5, 1), srca, vmask, expand8888 (vd5, 1))); @@ -1387,7 +1423,7 @@ fbCompositeSrc_x888xnx8888mmx (pixman_op_t op, dst += 16; src += 16; } - + while (w) { __m64 s = load8888 (*src | 0xff000000); @@ -1424,9 +1460,9 @@ fbCompositeSrc_8888x8888mmx (pixman_op_t op, int dstStride, srcStride; uint8_t a; uint16_t w; - + CHECKPOINT(); - + fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); @@ -1453,7 +1489,7 @@ fbCompositeSrc_8888x8888mmx (pixman_op_t op, dst++; } } - _mm_empty(); + _mm_empty(); } void @@ -1474,17 +1510,17 @@ fbCompositeSrc_8888x0565mmx (pixman_op_t op, uint32_t *srcLine, *src; int dstStride, srcStride; uint16_t w; - + CHECKPOINT(); - + fbComposeGetStart (pDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - + #if 0 /* FIXME */ assert (pSrc->pDrawable == pMask->pDrawable); #endif - + while (height--) { dst = dstLine; @@ -1492,26 +1528,26 @@ fbCompositeSrc_8888x0565mmx (pixman_op_t op, src = srcLine; srcLine += srcStride; w = width; - + CHECKPOINT(); - + while (w && (unsigned long)dst & 7) { __m64 vsrc = load8888 (*src); ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); - + __m64 vdest = expand565 (M64(d), 0); + vdest = pack565(over(vsrc, expand_alpha(vsrc), vdest), vdest, 0); - - *dst = (ullong)vdest; - + + *dst = ULLONG(vdest); + w--; dst++; src++; } - + CHECKPOINT(); - + while (w >= 4) { __m64 vsrc0, vsrc1, vsrc2, vsrc3; @@ -1523,12 +1559,12 @@ fbCompositeSrc_8888x0565mmx (pixman_op_t op, vsrc3 = load8888(*(src + 3)); vdest = *(__m64 *)dst; - + vdest = pack565(over(vsrc0, expand_alpha(vsrc0), expand565(vdest, 0)), vdest, 0); vdest = pack565(over(vsrc1, expand_alpha(vsrc1), expand565(vdest, 1)), vdest, 1); vdest = pack565(over(vsrc2, expand_alpha(vsrc2), expand565(vdest, 2)), vdest, 2); vdest = pack565(over(vsrc3, expand_alpha(vsrc3), expand565(vdest, 3)), vdest, 3); - + *(__m64 *)dst = vdest; w -= 4; @@ -1537,23 +1573,23 @@ fbCompositeSrc_8888x0565mmx (pixman_op_t op, } CHECKPOINT(); - + while (w) { __m64 vsrc = load8888 (*src); ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); - + __m64 vdest = expand565 (M64(d), 0); + vdest = pack565(over(vsrc, expand_alpha(vsrc), vdest), vdest, 0); - - *dst = (ullong)vdest; - + + *dst = ULLONG(vdest); + w--; dst++; src++; } } - + _mm_empty(); } @@ -1578,23 +1614,23 @@ fbCompositeSolidMask_nx8x8888mmx (pixman_op_t op, uint16_t w; __m64 vsrc, vsrca; ullong srcsrc; - + CHECKPOINT(); - + fbComposeGetSolid(pSrc, src, pDst->bits.format); - + srca = src >> 24; if (srca == 0) return; - - srcsrc = (unsigned long long)src << 32 | src; - + + srcsrc = (ullong)src << 32 | src; + fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - + vsrc = load8888 (src); vsrca = expand_alpha (vsrc); - + while (height--) { dst = dstLine; @@ -1602,73 +1638,73 @@ fbCompositeSolidMask_nx8x8888mmx (pixman_op_t op, mask = maskLine; maskLine += maskStride; w = width; - + CHECKPOINT(); - + while (w && (unsigned long)dst & 7) { ullong m = *mask; - + if (m) { - __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), load8888(*dst)); + __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (M64(m)), load8888(*dst)); *dst = store8888(vdest); } - + w--; mask++; dst++; } - + CHECKPOINT(); - + while (w >= 2) { ullong m0, m1; m0 = *mask; m1 = *(mask + 1); - + if (srca == 0xff && (m0 & m1) == 0xff) { - *(unsigned long long *)dst = srcsrc; + *(ullong *)dst = srcsrc; } else if (m0 | m1) { __m64 vdest; __m64 dest0, dest1; - + vdest = *(__m64 *)dst; - - dest0 = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m0), expand8888(vdest, 0)); - dest1 = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m1), expand8888(vdest, 1)); - + + dest0 = in_over(vsrc, vsrca, expand_alpha_rev (M64(m0)), expand8888(vdest, 0)); + dest1 = in_over(vsrc, vsrca, expand_alpha_rev (M64(m1)), expand8888(vdest, 1)); + *(__m64 *)dst = pack8888(dest0, dest1); } - + mask += 2; dst += 2; w -= 2; } - + CHECKPOINT(); - + while (w) { ullong m = *mask; - + if (m) { __m64 vdest = load8888(*dst); - vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), vdest); + vdest = in_over(vsrc, vsrca, expand_alpha_rev (M64(m)), vdest); *dst = store8888(vdest); } - + w--; mask++; dst++; } } - + _mm_empty(); } @@ -1689,31 +1725,31 @@ pixman_fill_mmx (uint32_t *bits, #ifdef __GNUC__ __m64 v1, v2, v3, v4, v5, v6, v7; #endif - + if (bpp == 16 && (xor >> 16 != (xor & 0xffff))) return FALSE; - + if (bpp != 16 && bpp != 32) return FALSE; - + if (bpp == 16) { - stride = stride * sizeof (uint32_t) / 2; + stride = stride * (int) sizeof (uint32_t) / 2; byte_line = (uint8_t *)(((uint16_t *)bits) + stride * y + x); byte_width = 2 * width; stride *= 2; } else { - stride = stride * sizeof (uint32_t) / 4; + stride = stride * (int) sizeof (uint32_t) / 4; byte_line = (uint8_t *)(((uint32_t *)bits) + stride * y + x); byte_width = 4 * width; stride *= 4; } - + fill = ((ullong)xor << 32) | xor; - vfill = (__m64)fill; - + vfill = M64(fill); + #ifdef __GNUC__ __asm__ ( "movq %7, %0\n" @@ -1727,25 +1763,25 @@ pixman_fill_mmx (uint32_t *bits, "=y" (v4), "=y" (v5), "=y" (v6), "=y" (v7) : "y" (vfill)); #endif - + while (height--) { int w; uint8_t *d = byte_line; byte_line += stride; w = byte_width; - + while (w >= 2 && ((unsigned long)d & 3)) { *(uint16_t *)d = xor; w -= 2; d += 2; } - + while (w >= 4 && ((unsigned long)d & 7)) { *(uint32_t *)d = xor; - + w -= 4; d += 4; } @@ -1776,15 +1812,15 @@ pixman_fill_mmx (uint32_t *bits, *(__m64*) (d + 40) = vfill; *(__m64*) (d + 48) = vfill; *(__m64*) (d + 56) = vfill; -#endif +#endif w -= 64; d += 64; } - + while (w >= 4) { *(uint32_t *)d = xor; - + w -= 4; d += 4; } @@ -1795,7 +1831,7 @@ pixman_fill_mmx (uint32_t *bits, d += 2; } } - + _mm_empty(); return TRUE; } @@ -1858,7 +1894,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t op, if (m) { - __m64 vdest = in(vsrc, expand_alpha_rev ((__m64)m)); + __m64 vdest = in(vsrc, expand_alpha_rev (M64(m))); *dst = store8888(vdest); } else @@ -1890,8 +1926,8 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t op, vdest = *(__m64 *)dst; - dest0 = in(vsrc, expand_alpha_rev ((__m64)m0)); - dest1 = in(vsrc, expand_alpha_rev ((__m64)m1)); + dest0 = in(vsrc, expand_alpha_rev (M64(m0))); + dest1 = in(vsrc, expand_alpha_rev (M64(m1))); *(__m64 *)dst = pack8888(dest0, dest1); } @@ -1914,7 +1950,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t op, if (m) { __m64 vdest = load8888(*dst); - vdest = in(vsrc, expand_alpha_rev ((__m64)m)); + vdest = in(vsrc, expand_alpha_rev (M64(m))); *dst = store8888(vdest); } else @@ -1950,28 +1986,29 @@ fbCompositeSolidMask_nx8x0565mmx (pixman_op_t op, uint8_t *maskLine, *mask; int dstStride, maskStride; uint16_t w; - __m64 vsrc, vsrca; - unsigned long long srcsrcsrcsrc, src16; - + __m64 vsrc, vsrca, tmp; + ullong srcsrcsrcsrc, src16; + CHECKPOINT(); - + fbComposeGetSolid(pSrc, src, pDst->bits.format); - + srca = src >> 24; if (srca == 0) return; - + fbComposeGetStart (pDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - + vsrc = load8888 (src); vsrca = expand_alpha (vsrc); - - src16 = (ullong)pack565(vsrc, _mm_setzero_si64(), 0); - + + tmp = pack565(vsrc, _mm_setzero_si64(), 0); + src16 = ULLONG(tmp); + srcsrcsrcsrc = (ullong)src16 << 48 | (ullong)src16 << 32 | (ullong)src16 << 16 | (ullong)src16; - + while (height--) { dst = dstLine; @@ -1979,28 +2016,29 @@ fbCompositeSolidMask_nx8x0565mmx (pixman_op_t op, mask = maskLine; maskLine += maskStride; w = width; - + CHECKPOINT(); - + while (w && (unsigned long)dst & 7) { ullong m = *mask; - + if (m) { ullong d = *dst; - __m64 vd = (__m64)d; - __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), expand565(vd, 0)); - *dst = (ullong)pack565(vdest, _mm_setzero_si64(), 0); + __m64 vd = M64(d); + __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (M64 (m)), expand565(vd, 0)); + vd = pack565(vdest, _mm_setzero_si64(), 0); + *dst = ULLONG(vd); } - + w--; mask++; dst++; } - + CHECKPOINT(); - + while (w >= 4) { ullong m0, m1, m2, m3; @@ -2008,55 +2046,56 @@ fbCompositeSolidMask_nx8x0565mmx (pixman_op_t op, m1 = *(mask + 1); m2 = *(mask + 2); m3 = *(mask + 3); - + if (srca == 0xff && (m0 & m1 & m2 & m3) == 0xff) { - *(unsigned long long *)dst = srcsrcsrcsrc; + *(ullong *)dst = srcsrcsrcsrc; } else if (m0 | m1 | m2 | m3) { __m64 vdest; __m64 vm0, vm1, vm2, vm3; - + vdest = *(__m64 *)dst; - - vm0 = (__m64)m0; + + vm0 = M64(m0); vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm0), expand565(vdest, 0)), vdest, 0); - vm1 = (__m64)m1; + vm1 = M64(m1); vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm1), expand565(vdest, 1)), vdest, 1); - vm2 = (__m64)m2; + vm2 = M64(m2); vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm2), expand565(vdest, 2)), vdest, 2); - vm3 = (__m64)m3; + vm3 = M64(m3); vdest = pack565(in_over(vsrc, vsrca, expand_alpha_rev(vm3), expand565(vdest, 3)), vdest, 3); - + *(__m64 *)dst = vdest; } - + w -= 4; mask += 4; dst += 4; } - + CHECKPOINT(); - + while (w) { ullong m = *mask; - + if (m) { ullong d = *dst; - __m64 vd = (__m64)d; - __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev ((__m64)m), expand565(vd, 0)); - *dst = (ullong)pack565(vdest, _mm_setzero_si64(), 0); + __m64 vd = M64(d); + __m64 vdest = in_over(vsrc, vsrca, expand_alpha_rev (M64(m)), expand565(vd, 0)); + vd = pack565(vdest, _mm_setzero_si64(), 0); + *dst = ULLONG(vd); } - + w--; mask++; dst++; } } - + _mm_empty(); } @@ -2078,17 +2117,17 @@ fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t op, uint32_t *srcLine, *src; int dstStride, srcStride; uint16_t w; - + CHECKPOINT(); - + fbComposeGetStart (pDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - + #if 0 /* FIXME */ assert (pSrc->pDrawable == pMask->pDrawable); #endif - + while (height--) { dst = dstLine; @@ -2096,41 +2135,41 @@ fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t op, src = srcLine; srcLine += srcStride; w = width; - + CHECKPOINT(); - + while (w && (unsigned long)dst & 7) { __m64 vsrc = load8888 (*src); ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); - + __m64 vdest = expand565 (M64(d), 0); + vdest = pack565(over_rev_non_pre(vsrc, vdest), vdest, 0); - - *dst = (ullong)vdest; - + + *dst = ULLONG(vdest); + w--; dst++; src++; } - + CHECKPOINT(); - + while (w >= 4) { uint32_t s0, s1, s2, s3; unsigned char a0, a1, a2, a3; - + s0 = *src; s1 = *(src + 1); s2 = *(src + 2); s3 = *(src + 3); - + a0 = (s0 >> 24); a1 = (s1 >> 24); a2 = (s2 >> 24); a3 = (s3 >> 24); - + if ((a0 & a1 & a2 & a3) == 0xFF) { __m64 vdest; @@ -2138,44 +2177,44 @@ fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t op, vdest = pack565(invert_colors(load8888(s1)), vdest, 1); vdest = pack565(invert_colors(load8888(s2)), vdest, 2); vdest = pack565(invert_colors(load8888(s3)), vdest, 3); - + *(__m64 *)dst = vdest; } else if (a0 | a1 | a2 | a3) { __m64 vdest = *(__m64 *)dst; - + vdest = pack565(over_rev_non_pre(load8888(s0), expand565(vdest, 0)), vdest, 0); vdest = pack565(over_rev_non_pre(load8888(s1), expand565(vdest, 1)), vdest, 1); vdest = pack565(over_rev_non_pre(load8888(s2), expand565(vdest, 2)), vdest, 2); vdest = pack565(over_rev_non_pre(load8888(s3), expand565(vdest, 3)), vdest, 3); - + *(__m64 *)dst = vdest; } - + w -= 4; dst += 4; src += 4; } - + CHECKPOINT(); - + while (w) { __m64 vsrc = load8888 (*src); ullong d = *dst; - __m64 vdest = expand565 ((__m64)d, 0); - + __m64 vdest = expand565 (M64(d), 0); + vdest = pack565(over_rev_non_pre(vsrc, vdest), vdest, 0); - - *dst = (ullong)vdest; - + + *dst = ULLONG(vdest); + w--; dst++; src++; } } - + _mm_empty(); } @@ -2199,17 +2238,17 @@ fbCompositeSrc_8888RevNPx8888mmx (pixman_op_t op, uint32_t *srcLine, *src; int dstStride, srcStride; uint16_t w; - + CHECKPOINT(); - + fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - + #if 0 /* FIXME */ assert (pSrc->pDrawable == pMask->pDrawable); #endif - + while (height--) { dst = dstLine; @@ -2217,66 +2256,66 @@ fbCompositeSrc_8888RevNPx8888mmx (pixman_op_t op, src = srcLine; srcLine += srcStride; w = width; - + while (w && (unsigned long)dst & 7) { __m64 s = load8888 (*src); __m64 d = load8888 (*dst); - + *dst = store8888 (over_rev_non_pre (s, d)); - + w--; dst++; src++; } - + while (w >= 2) { ullong s0, s1; unsigned char a0, a1; __m64 d0, d1; - + s0 = *src; s1 = *(src + 1); - + a0 = (s0 >> 24); a1 = (s1 >> 24); - + if ((a0 & a1) == 0xFF) { d0 = invert_colors(load8888(s0)); d1 = invert_colors(load8888(s1)); - + *(__m64 *)dst = pack8888 (d0, d1); } else if (a0 | a1) { __m64 vdest = *(__m64 *)dst; - + d0 = over_rev_non_pre (load8888(s0), expand8888 (vdest, 0)); d1 = over_rev_non_pre (load8888(s1), expand8888 (vdest, 1)); - + *(__m64 *)dst = pack8888 (d0, d1); } - + w -= 2; dst += 2; src += 2; } - + while (w) { __m64 s = load8888 (*src); __m64 d = load8888 (*dst); - + *dst = store8888 (over_rev_non_pre (s, d)); - + w--; dst++; src++; } } - + _mm_empty(); } @@ -2299,91 +2338,91 @@ fbCompositeSolidMask_nx8888x0565Cmmx (pixman_op_t op, uint32_t *maskLine; int dstStride, maskStride; __m64 vsrc, vsrca; - + CHECKPOINT(); - + fbComposeGetSolid(pSrc, src, pDst->bits.format); - + srca = src >> 24; if (srca == 0) return; - + fbComposeGetStart (pDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint32_t, maskStride, maskLine, 1); - + vsrc = load8888 (src); vsrca = expand_alpha (vsrc); - + while (height--) { int twidth = width; uint32_t *p = (uint32_t *)maskLine; uint16_t *q = (uint16_t *)dstLine; - + while (twidth && ((unsigned long)q & 7)) { uint32_t m = *(uint32_t *)p; - + if (m) { ullong d = *q; - __m64 vdest = expand565 ((__m64)d, 0); + __m64 vdest = expand565 (M64(d), 0); vdest = pack565 (in_over (vsrc, vsrca, load8888 (m), vdest), vdest, 0); - *q = (ullong)vdest; + *q = ULLONG(vdest); } - + twidth--; p++; q++; } - + while (twidth >= 4) { uint32_t m0, m1, m2, m3; - + m0 = *p; m1 = *(p + 1); m2 = *(p + 2); m3 = *(p + 3); - + if ((m0 | m1 | m2 | m3)) { __m64 vdest = *(__m64 *)q; - + vdest = pack565(in_over(vsrc, vsrca, load8888(m0), expand565(vdest, 0)), vdest, 0); vdest = pack565(in_over(vsrc, vsrca, load8888(m1), expand565(vdest, 1)), vdest, 1); vdest = pack565(in_over(vsrc, vsrca, load8888(m2), expand565(vdest, 2)), vdest, 2); vdest = pack565(in_over(vsrc, vsrca, load8888(m3), expand565(vdest, 3)), vdest, 3); - + *(__m64 *)q = vdest; } twidth -= 4; p += 4; q += 4; } - + while (twidth) { uint32_t m; - + m = *(uint32_t *)p; if (m) { ullong d = *q; - __m64 vdest = expand565((__m64)d, 0); + __m64 vdest = expand565(M64(d), 0); vdest = pack565 (in_over(vsrc, vsrca, load8888(m), vdest), vdest, 0); - *q = (ullong)vdest; + *q = ULLONG(vdest); } - + twidth--; p++; q++; } - + maskLine += maskStride; dstLine += dstStride; } - + _mm_empty (); } @@ -2633,12 +2672,12 @@ fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op, uint16_t w; uint8_t s, d; uint16_t t; - + CHECKPOINT(); - + fbComposeGetStart (pSrc, xSrc, ySrc, uint8_t, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); - + while (height--) { dst = dstLine; @@ -2646,7 +2685,7 @@ fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op, src = srcLine; srcLine += srcStride; w = width; - + while (w && (unsigned long)dst & 7) { s = *src; @@ -2654,12 +2693,12 @@ fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op, t = d + s; s = t | (0 - (t >> 8)); *dst = s; - + dst++; src++; w--; } - + while (w >= 8) { *(__m64*)dst = _mm_adds_pu8(*(__m64*)src, *(__m64*)dst); @@ -2667,7 +2706,7 @@ fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op, src += 8; w -= 8; } - + while (w) { s = *src; @@ -2675,13 +2714,13 @@ fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op, t = d + s; s = t | (0 - (t >> 8)); *dst = s; - + dst++; src++; w--; } } - + _mm_empty(); } @@ -2699,16 +2738,17 @@ fbCompositeSrcAdd_8888x8888mmx (pixman_op_t op, uint16_t width, uint16_t height) { + __m64 dst64; uint32_t *dstLine, *dst; uint32_t *srcLine, *src; int dstStride, srcStride; uint16_t w; - + CHECKPOINT(); - + fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); - + while (height--) { dst = dstLine; @@ -2716,7 +2756,7 @@ fbCompositeSrcAdd_8888x8888mmx (pixman_op_t op, src = srcLine; srcLine += srcStride; w = width; - + while (w && (unsigned long)dst & 7) { *dst = _mm_cvtsi64_si32(_mm_adds_pu8(_mm_cvtsi32_si64(*src), @@ -2725,27 +2765,28 @@ fbCompositeSrcAdd_8888x8888mmx (pixman_op_t op, src++; w--; } - + while (w >= 2) { - *(ullong*)dst = (ullong) _mm_adds_pu8(*(__m64*)src, *(__m64*)dst); + dst64 = _mm_adds_pu8(*(__m64*)src, *(__m64*)dst); + *(ullong*)dst = ULLONG(dst64); dst += 2; src += 2; w -= 2; } - + if (w) { *dst = _mm_cvtsi64_si32(_mm_adds_pu8(_mm_cvtsi32_si64(*src), _mm_cvtsi32_si64(*dst))); - + } } - + _mm_empty(); } -pixman_bool_t +pixman_bool_t pixman_blt_mmx (uint32_t *src_bits, uint32_t *dst_bits, int src_stride, @@ -2759,22 +2800,22 @@ pixman_blt_mmx (uint32_t *src_bits, uint8_t * src_bytes; uint8_t * dst_bytes; int byte_width; - + if (src_bpp != dst_bpp) return FALSE; - + if (src_bpp == 16) { - src_stride = src_stride * sizeof (uint32_t) / 2; - dst_stride = dst_stride * sizeof (uint32_t) / 2; + src_stride = src_stride * (int) sizeof (uint32_t) / 2; + dst_stride = dst_stride * (int) sizeof (uint32_t) / 2; src_bytes = (uint8_t *)(((uint16_t *)src_bits) + src_stride * (src_y) + (src_x)); dst_bytes = (uint8_t *)(((uint16_t *)dst_bits) + dst_stride * (dst_y) + (dst_x)); byte_width = 2 * width; src_stride *= 2; dst_stride *= 2; } else if (src_bpp == 32) { - src_stride = src_stride * sizeof (uint32_t) / 4; - dst_stride = dst_stride * sizeof (uint32_t) / 4; + src_stride = src_stride * (int) sizeof (uint32_t) / 4; + dst_stride = dst_stride * (int) sizeof (uint32_t) / 4; src_bytes = (uint8_t *)(((uint32_t *)src_bits) + src_stride * (src_y) + (src_x)); dst_bytes = (uint8_t *)(((uint32_t *)dst_bits) + dst_stride * (dst_y) + (dst_x)); byte_width = 4 * width; @@ -2792,7 +2833,7 @@ pixman_blt_mmx (uint32_t *src_bits, src_bytes += src_stride; dst_bytes += dst_stride; w = byte_width; - + while (w >= 2 && ((unsigned long)d & 3)) { *(uint16_t *)d = *(uint16_t *)s; @@ -2800,16 +2841,16 @@ pixman_blt_mmx (uint32_t *src_bits, s += 2; d += 2; } - + while (w >= 4 && ((unsigned long)d & 7)) { *(uint32_t *)d = *(uint32_t *)s; - + w -= 4; s += 4; d += 4; } - + while (w >= 64) { #ifdef __GNUC__ @@ -2853,8 +2894,8 @@ pixman_blt_mmx (uint32_t *src_bits, *(__m64 *)(d + 40) = v5; *(__m64 *)(d + 48) = v6; *(__m64 *)(d + 56) = v7; -#endif - +#endif + w -= 64; s += 64; d += 64; @@ -2875,7 +2916,7 @@ pixman_blt_mmx (uint32_t *src_bits, d += 2; } } - + _mm_empty(); return TRUE; @@ -2922,8 +2963,6 @@ fbCompositeOver_x888x8x8888mmx (pixman_op_t op, uint32_t *dst, *dstLine; uint8_t *mask, *maskLine; int srcStride, maskStride, dstStride; - __m64 m; - uint32_t s, d; uint16_t w; fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); @@ -2954,13 +2993,13 @@ fbCompositeOver_x888x8x8888mmx (pixman_op_t op, else { __m64 sa = expand_alpha (s); - __m64 vm = expand_alpha_rev ((__m64)m); + __m64 vm = expand_alpha_rev (M64(m)); __m64 vdest = in_over(s, sa, vm, load8888 (*dst)); *dst = store8888 (vdest); } } - + mask++; dst++; src++; diff --git a/lib/pixman/pixman/pixman-mmx.h b/lib/pixman/pixman/pixman-mmx.h index a74d4ba66..611e1ad8b 100644 --- a/lib/pixman/pixman/pixman-mmx.h +++ b/lib/pixman/pixman/pixman-mmx.h @@ -26,6 +26,9 @@ * * Based on work by Owen Taylor */ +#ifndef _PIXMAN_MMX_H_ +#define _PIXMAN_MMX_H_ + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -313,3 +316,5 @@ fbCompositeOver_x888x8x8888mmx (pixman_op_t op, uint16_t height); #endif /* USE_MMX */ + +#endif /* _PIXMAN_MMX_H_ */ diff --git a/lib/pixman/pixman/pixman-pict.c b/lib/pixman/pixman/pixman-pict.c index b8b7b767b..8976ff209 100644 --- a/lib/pixman/pixman/pixman-pict.c +++ b/lib/pixman/pixman/pixman-pict.c @@ -1,3 +1,4 @@ +/* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */ /* * Copyright © 2000 SuSE, Inc. * Copyright © 2007 Red Hat, Inc. @@ -22,20 +23,24 @@ * Author: Keith Packard, SuSE, Inc. */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "pixman.h" + #include "pixman-private.h" #include "pixman-mmx.h" +#include "pixman-sse.h" #define FbFullMask(n) ((n) == 32 ? (uint32_t)-1 : ((((uint32_t) 1) << n) - 1)) #undef READ #undef WRITE -#define READ(x) (*(x)) -#define WRITE(ptr,v) ((*(ptr)) = (v)) +#define READ(img,x) (*(x)) +#define WRITE(img,ptr,v) ((*(ptr)) = (v)) typedef void (* CompositeFunc) (pixman_op_t, pixman_image_t *, pixman_image_t *, pixman_image_t *, @@ -127,26 +132,23 @@ fbCompositeOver_x888x8x8888 (pixman_op_t op, w = width; while (w--) { - m = READ(mask++); + m = READ(pMask, mask++); if (m) { - s = READ(src) | 0xff000000; + s = READ(pSrc, src) | 0xff000000; if (m == 0xff) - WRITE (dst, s); + WRITE(pDst, dst, s); else { d = fbIn (s, m); - WRITE(dst, fbOver (d, READ(dst))); + WRITE(pDst, dst, fbOver (d, READ(pDst, dst))); } } src++; dst++; } } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); } static void @@ -169,12 +171,12 @@ fbCompositeSolidMaskIn_nx8x8 (pixman_op_t op, int dstStride, maskStride; uint16_t w; uint16_t t; - + fbComposeGetSolid(iSrc, src, iDst->bits.format); dstMask = FbFullMask (PIXMAN_FORMAT_DEPTH (iDst->bits.format)); srca = src >> 24; - + fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); fbComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); @@ -251,10 +253,10 @@ fbCompositeSrcIn_8x8 (pixman_op_t op, uint16_t w; uint8_t s; uint16_t t; - + fbComposeGetStart (iSrc, xSrc, ySrc, uint8_t, srcStride, srcLine, 1); fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); - + while (height--) { dst = dstLine; @@ -262,7 +264,7 @@ fbCompositeSrcIn_8x8 (pixman_op_t op, src = srcLine; srcLine += srcStride; w = width; - + while (w--) { s = *src++; @@ -305,10 +307,10 @@ fbCompositeSolidMask_nx8x8888 (pixman_op_t op, srca = src >> 24; if (src == 0) return; - + fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - + while (height--) { dst = dstLine; @@ -316,28 +318,25 @@ fbCompositeSolidMask_nx8x8888 (pixman_op_t op, mask = maskLine; maskLine += maskStride; w = width; - + while (w--) { - m = READ(mask++); + m = READ(pMask, mask++); if (m == 0xff) { if (srca == 0xff) - WRITE(dst, src & dstMask); + WRITE(pDst, dst, src & dstMask); else - WRITE(dst, fbOver (src, READ(dst)) & dstMask); + WRITE(pDst, dst, fbOver (src, READ(pDst, dst)) & dstMask); } else if (m) { d = fbIn (src, m); - WRITE(dst, fbOver (d, READ(dst)) & dstMask); + WRITE(pDst, dst, fbOver (d, READ(pDst, dst)) & dstMask); } dst++; } } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); } void @@ -381,17 +380,17 @@ fbCompositeSolidMask_nx8888x8888C (pixman_op_t op, while (w--) { - ma = READ(mask++); + ma = READ(pMask, mask++); if (ma == 0xffffffff) { if (srca == 0xff) - WRITE(dst, src & dstMask); + WRITE(pDst, dst, src & dstMask); else - WRITE(dst, fbOver (src, READ(dst)) & dstMask); + WRITE(pDst, dst, fbOver (src, READ(pDst, dst)) & dstMask); } else if (ma) { - d = READ(dst); + d = READ(pDst, dst); #define FbInOverC(src,srca,msk,dst,i,result) { \ uint16_t __a = FbGet8(msk,i); \ uint32_t __t, __ta; \ @@ -406,14 +405,11 @@ fbCompositeSolidMask_nx8888x8888C (pixman_op_t op, FbInOverC (src, srca, ma, d, 8, n); FbInOverC (src, srca, ma, d, 16, o); FbInOverC (src, srca, ma, d, 24, p); - WRITE(dst, m|n|o|p); + WRITE(pDst, dst, m|n|o|p); } dst++; } } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); } void @@ -456,29 +452,26 @@ fbCompositeSolidMask_nx8x0888 (pixman_op_t op, while (w--) { - m = READ(mask++); + m = READ(pMask, mask++); if (m == 0xff) { if (srca == 0xff) d = src; else { - d = Fetch24(dst); + d = Fetch24(pDst, dst); d = fbOver24 (src, d); } - Store24(dst,d); + Store24(pDst, dst,d); } else if (m) { - d = fbOver24 (fbIn(src,m), Fetch24(dst)); - Store24(dst,d); + d = fbOver24 (fbIn(src,m), Fetch24(pDst, dst)); + Store24(pDst, dst, d); } dst += 3; } } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); } void @@ -521,30 +514,27 @@ fbCompositeSolidMask_nx8x0565 (pixman_op_t op, while (w--) { - m = READ(mask++); + m = READ(pMask, mask++); if (m == 0xff) { if (srca == 0xff) d = src; else { - d = READ(dst); + d = READ(pDst, dst); d = fbOver24 (src, cvt0565to0888(d)); } - WRITE(dst, cvt8888to0565(d)); + WRITE(pDst, dst, cvt8888to0565(d)); } else if (m) { - d = READ(dst); + d = READ(pDst, dst); d = fbOver24 (fbIn(src,m), cvt0565to0888(d)); - WRITE(dst, cvt8888to0565(d)); + WRITE(pDst, dst, cvt8888to0565(d)); } dst++; } } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); } void @@ -591,36 +581,33 @@ fbCompositeSolidMask_nx8888x0565C (pixman_op_t op, while (w--) { - ma = READ(mask++); + ma = READ(pMask, mask++); if (ma == 0xffffffff) { if (srca == 0xff) { - WRITE(dst, src16); + WRITE(pDst, dst, src16); } else { - d = READ(dst); + d = READ(pDst, dst); d = fbOver24 (src, cvt0565to0888(d)); - WRITE(dst, cvt8888to0565(d)); + WRITE(pDst, dst, cvt8888to0565(d)); } } else if (ma) { - d = READ(dst); + d = READ(pDst, dst); d = cvt0565to0888(d); FbInOverC (src, srca, ma, d, 0, m); FbInOverC (src, srca, ma, d, 8, n); FbInOverC (src, srca, ma, d, 16, o); d = m|n|o; - WRITE(dst, cvt8888to0565(d)); + WRITE(pDst, dst, cvt8888to0565(d)); } dst++; } } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); } void @@ -658,18 +645,15 @@ fbCompositeSrc_8888x8888 (pixman_op_t op, while (w--) { - s = READ(src++); + s = READ(pSrc, src++); a = s >> 24; if (a == 0xff) - WRITE(dst, s & dstMask); + WRITE(pDst, dst, s & dstMask); else if (a) - WRITE(dst, fbOver (s, READ(dst)) & dstMask); + WRITE(pDst, dst, fbOver (s, READ(pDst, dst)) & dstMask); dst++; } } - - fbFinishAccess (pSrc->pDrawable); - fbFinishAccess (pDst->pDrawable); } void @@ -706,22 +690,19 @@ fbCompositeSrc_8888x0888 (pixman_op_t op, while (w--) { - s = READ(src++); + s = READ(pSrc, src++); a = s >> 24; if (a) { if (a == 0xff) d = s; else - d = fbOver24 (s, Fetch24(dst)); - Store24(dst,d); + d = fbOver24 (s, Fetch24(pDst, dst)); + Store24(pDst, dst, d); } dst += 3; } } - - fbFinishAccess (pSrc->pDrawable); - fbFinishAccess (pDst->pDrawable); } void @@ -758,7 +739,7 @@ fbCompositeSrc_8888x0565 (pixman_op_t op, while (w--) { - s = READ(src++); + s = READ(pSrc, src++); a = s >> 24; if (a) { @@ -766,17 +747,14 @@ fbCompositeSrc_8888x0565 (pixman_op_t op, d = s; else { - d = READ(dst); + d = READ(pDst, dst); d = fbOver24 (s, cvt0565to0888(d)); } - WRITE(dst, cvt8888to0565(d)); + WRITE(pDst, dst, cvt8888to0565(d)); } dst++; } } - - fbFinishAccess (pDst->pDrawable); - fbFinishAccess (pSrc->pDrawable); } void @@ -813,23 +791,20 @@ fbCompositeSrcAdd_8000x8000 (pixman_op_t op, while (w--) { - s = READ(src++); + s = READ(pSrc, src++); if (s) { if (s != 0xff) { - d = READ(dst); + d = READ(pDst, dst); t = d + s; s = t | (0 - (t >> 8)); } - WRITE(dst, s); + WRITE(pDst, dst, s); } dst++; } } - - fbFinishAccess (pDst->pDrawable); - fbFinishAccess (pSrc->pDrawable); } void @@ -867,12 +842,12 @@ fbCompositeSrcAdd_8888x8888 (pixman_op_t op, while (w--) { - s = READ(src++); + s = READ(pSrc, src++); if (s) { if (s != 0xffffffff) { - d = READ(dst); + d = READ(pDst, dst); if (d) { m = FbAdd(s,d,0,t); @@ -882,14 +857,11 @@ fbCompositeSrcAdd_8888x8888 (pixman_op_t op, s = m|n|o|p; } } - WRITE(dst, s); + WRITE(pDst, dst, s); } dst++; } } - - fbFinishAccess (pDst->pDrawable); - fbFinishAccess (pSrc->pDrawable); } static void @@ -933,18 +905,15 @@ fbCompositeSrcAdd_8888x8x8 (pixman_op_t op, uint32_t m, d; uint32_t r; - a = READ(mask++); - d = READ(dst); + a = READ(pMask, mask++); + d = READ(pDst, dst); m = FbInU (sa, 0, a, tmp); r = FbAdd (m, d, 0, tmp); - WRITE(dst++, r); + WRITE(pDst, dst++, r); } } - - fbFinishAccess(pDst->pDrawable); - fbFinishAccess(pMask->pDrawable); } void @@ -963,7 +932,7 @@ fbCompositeSrcAdd_1000x1000 (pixman_op_t op, { /* FIXME */ #if 0 - + uint32_t *dstBits, *srcBits; int dstStride, srcStride; int dstBpp, srcBpp; @@ -992,8 +961,6 @@ fbCompositeSrcAdd_1000x1000 (pixman_op_t op, FALSE, FALSE); - fbFinishAccess(pDst->pDrawable); - fbFinishAccess(pSrc->pDrawable); #endif } @@ -1054,8 +1021,6 @@ fbCompositeSolidMask_nx1xn (pixman_op_t op, FB_ALLONES, 0x0); - fbFinishAccess (pDst->pDrawable); - fbFinishAccess (pMask->pDrawable); #endif } @@ -1105,14 +1070,14 @@ fbCompositeSrcSrc_nxn (pixman_op_t op, int dstBpp; pixman_bool_t reverse = FALSE; pixman_bool_t upsidedown = FALSE; - + fbGetDrawable(pSrc->pDrawable,src,srcStride,srcBpp,srcXoff,srcYoff); fbGetDrawable(pDst->pDrawable,dst,dstStride,dstBpp,dstXoff,dstYoff); - + fbBlt (src + (ySrc + srcYoff) * srcStride, srcStride, (xSrc + srcXoff) * srcBpp, - + dst + (yDst + dstYoff) * dstStride, dstStride, (xDst + dstXoff) * dstBpp, @@ -1126,9 +1091,6 @@ fbCompositeSrcSrc_nxn (pixman_op_t op, reverse, upsidedown); - - fbFinishAccess(pSrc->pDrawable); - fbFinishAccess(pDst->pDrawable); #endif } @@ -1160,7 +1122,7 @@ fbCompositeSolidFill (pixman_op_t op, uint16_t height) { uint32_t src; - + fbComposeGetSolid(pSrc, src, pDst->bits.format); if (pDst->bits.format == PIXMAN_a8) @@ -1205,9 +1167,6 @@ fbCompositeSrc_8888xx888 (pixman_op_t op, dst += dstStride; src += srcStride; } - - fbFinishAccess(pSrc->pDrawable); - fbFinishAccess(pDst->pDrawable); } static void @@ -1242,7 +1201,7 @@ pixman_walk_composite_region (pixman_op_t op, } region = ® - + pbox = pixman_region_rectangles (region, &n); while (n--) { @@ -1307,7 +1266,7 @@ can_get_solid (pixman_image_t *image) { if (image->type == SOLID) return TRUE; - + if (image->type != BITS || image->bits.width != 1 || image->bits.height != 1) @@ -1356,7 +1315,7 @@ pixman_image_composite_rect (pixman_op_t op, return_if_fail (src != NULL); return_if_fail (dest != NULL); - + if (width > SCANLINE_BUFFER_LENGTH) { scanline_buffer = (uint32_t *)pixman_malloc_abc (width, 3, sizeof (uint32_t)); @@ -1364,7 +1323,7 @@ pixman_image_composite_rect (pixman_op_t op, if (!scanline_buffer) return; } - + compose_data.op = op; compose_data.src = src; compose_data.mask = mask; @@ -1382,8 +1341,258 @@ pixman_image_composite_rect (pixman_op_t op, if (scanline_buffer != _scanline_buffer) free (scanline_buffer); -} +} + +/* These "formats" both have depth 0, so they + * will never clash with any real ones + */ +#define PIXMAN_null PIXMAN_FORMAT(0,0,0,0,0,0) +#define PIXMAN_solid PIXMAN_FORMAT(0,1,0,0,0,0) +#define NEED_COMPONENT_ALPHA (1 << 0) +#define NEED_PIXBUF (1 << 1) +#define NEED_SOLID_MASK (1 << 2) + +typedef struct +{ + pixman_op_t op; + pixman_format_code_t src_format; + pixman_format_code_t mask_format; + pixman_format_code_t dest_format; + CompositeFunc func; + uint32_t flags; +} FastPathInfo; + +#ifdef USE_MMX +static const FastPathInfo mmx_fast_paths[] = +{ + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_r5g6b5, fbCompositeSolidMask_nx8x0565mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_b5g6r5, fbCompositeSolidMask_nx8x0565mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeSolidMask_nx8x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8r8g8b8, fbCompositeSolidMask_nx8x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8b8g8r8, fbCompositeSolidMask_nx8x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8b8g8r8, fbCompositeSolidMask_nx8x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8, PIXMAN_a8r8g8b8, fbCompositeSolidMask_nx8888x8888Cmmx, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8, PIXMAN_x8r8g8b8, fbCompositeSolidMask_nx8888x8888Cmmx, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8, PIXMAN_r5g6b5, fbCompositeSolidMask_nx8888x0565Cmmx, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8, PIXMAN_a8b8g8r8, fbCompositeSolidMask_nx8888x8888Cmmx, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8, PIXMAN_x8b8g8r8, fbCompositeSolidMask_nx8888x8888Cmmx, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8, PIXMAN_b5g6r5, fbCompositeSolidMask_nx8888x0565Cmmx, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8r8g8b8, PIXMAN_a8r8g8b8, fbCompositeSrc_8888RevNPx8888mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8b8g8r8, PIXMAN_a8r8g8b8, fbCompositeSrc_8888RevNPx8888mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8r8g8b8, PIXMAN_x8r8g8b8, fbCompositeSrc_8888RevNPx8888mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8b8g8r8, PIXMAN_x8r8g8b8, fbCompositeSrc_8888RevNPx8888mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8r8g8b8, PIXMAN_r5g6b5, fbCompositeSrc_8888RevNPx0565mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8b8g8r8, PIXMAN_r5g6b5, fbCompositeSrc_8888RevNPx0565mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8r8g8b8, PIXMAN_a8b8g8r8, fbCompositeSrc_8888RevNPx8888mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8b8g8r8, PIXMAN_a8b8g8r8, fbCompositeSrc_8888RevNPx8888mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8r8g8b8, PIXMAN_x8b8g8r8, fbCompositeSrc_8888RevNPx8888mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8b8g8r8, PIXMAN_x8b8g8r8, fbCompositeSrc_8888RevNPx8888mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8r8g8b8, PIXMAN_b5g6r5, fbCompositeSrc_8888RevNPx0565mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8b8g8r8, PIXMAN_b5g6r5, fbCompositeSrc_8888RevNPx0565mmx, NEED_PIXBUF }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeSrc_x888xnx8888mmx, NEED_SOLID_MASK }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8, PIXMAN_x8r8g8b8, fbCompositeSrc_x888xnx8888mmx, NEED_SOLID_MASK }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8, PIXMAN_a8b8g8r8, fbCompositeSrc_x888xnx8888mmx, NEED_SOLID_MASK }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_a8, PIXMAN_x8b8g8r8, fbCompositeSrc_x888xnx8888mmx, NEED_SOLID_MASK }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeSrc_8888x8x8888mmx, NEED_SOLID_MASK }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_a8, PIXMAN_x8r8g8b8, fbCompositeSrc_8888x8x8888mmx, NEED_SOLID_MASK }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_a8, PIXMAN_a8b8g8r8, fbCompositeSrc_8888x8x8888mmx, NEED_SOLID_MASK }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_a8, PIXMAN_x8b8g8r8, fbCompositeSrc_8888x8x8888mmx, NEED_SOLID_MASK }, +#if 0 + /* FIXME: This code is commented out since it's apparently not actually faster than the generic code. */ + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8, PIXMAN_x8r8g8b8, fbCompositeOver_x888x8x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeOver_x888x8x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8r8g8, PIXMAN_a8, PIXMAN_x8b8g8r8, fbCompositeOver_x888x8x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8r8g8, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeOver_x888x8x8888mmx, 0 }, +#endif + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_null, PIXMAN_a8r8g8b8, fbCompositeSolid_nx8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeSolid_nx8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_null, PIXMAN_r5g6b5, fbCompositeSolid_nx0565mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeCopyAreammx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, fbCompositeCopyAreammx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, fbCompositeSrc_8888x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeSrc_8888x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_r5g6b5, fbCompositeSrc_8888x0565mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, fbCompositeSrc_8888x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, fbCompositeSrc_8888x8888mmx, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_b5g6r5, fbCompositeSrc_8888x0565mmx, 0 }, + + { PIXMAN_OP_ADD, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, fbCompositeSrcAdd_8888x8888mmx, 0 }, + { PIXMAN_OP_ADD, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, fbCompositeSrcAdd_8888x8888mmx, 0 }, + { PIXMAN_OP_ADD, PIXMAN_a8, PIXMAN_null, PIXMAN_a8, fbCompositeSrcAdd_8000x8000mmx, 0 }, + { PIXMAN_OP_ADD, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8, fbCompositeSrcAdd_8888x8x8mmx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeSolidMaskSrc_nx8x8888mmx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8r8g8b8, fbCompositeSolidMaskSrc_nx8x8888mmx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8b8g8r8, fbCompositeSolidMaskSrc_nx8x8888mmx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8b8g8r8, fbCompositeSolidMaskSrc_nx8x8888mmx, 0 }, + + { PIXMAN_OP_SRC, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, fbCompositeCopyAreammx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, fbCompositeCopyAreammx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_x8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeCopyAreammx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_x8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, fbCompositeCopyAreammx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_r5g6b5, PIXMAN_null, PIXMAN_r5g6b5, fbCompositeCopyAreammx, 0 }, + { PIXMAN_OP_SRC, PIXMAN_b5g6r5, PIXMAN_null, PIXMAN_b5g6r5, fbCompositeCopyAreammx, 0 }, + { PIXMAN_OP_IN, PIXMAN_a8, PIXMAN_null, PIXMAN_a8, fbCompositeIn_8x8mmx, 0 }, + { PIXMAN_OP_IN, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8, fbCompositeIn_nx8x8mmx, 0 }, + { PIXMAN_OP_NONE }, +}; +#endif + +#ifdef USE_SSE2 +static const FastPathInfo sse_fast_paths[] = +{ + { PIXMAN_OP_NONE }, +}; +#endif + +static const FastPathInfo c_fast_paths[] = +{ + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_r5g6b5, fbCompositeSolidMask_nx8x0565, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_b5g6r5, fbCompositeSolidMask_nx8x0565, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_r8g8b8, fbCompositeSolidMask_nx8x0888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_b8g8r8, fbCompositeSolidMask_nx8x0888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeSolidMask_nx8x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8r8g8b8, fbCompositeSolidMask_nx8x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8b8g8r8, fbCompositeSolidMask_nx8x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_x8b8g8r8, fbCompositeSolidMask_nx8x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8, PIXMAN_a8r8g8b8, fbCompositeSolidMask_nx8888x8888C, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8, PIXMAN_x8r8g8b8, fbCompositeSolidMask_nx8888x8888C, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8r8g8b8, PIXMAN_r5g6b5, fbCompositeSolidMask_nx8888x0565C, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8, PIXMAN_a8b8g8r8, fbCompositeSolidMask_nx8888x8888C, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8, PIXMAN_x8b8g8r8, fbCompositeSolidMask_nx8888x8888C, NEED_COMPONENT_ALPHA }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8b8g8r8, PIXMAN_b5g6r5, fbCompositeSolidMask_nx8888x0565C, NEED_COMPONENT_ALPHA }, +#if 0 + /* FIXME: This code is commented out since it's apparently not actually faster than the generic code */ + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8, PIXMAN_x8r8g8b8, fbCompositeOver_x888x8x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_x8r8g8b8, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeOver_x888x8x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8r8g8, PIXMAN_a8, PIXMAN_x8b8g8r8, fbCompositeOver_x888x8x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_x8b8r8g8, PIXMAN_a8, PIXMAN_a8r8g8b8, fbCompositeOver_x888x8x8888, 0 }, +#endif + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, fbCompositeSrc_8888x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeSrc_8888x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_r5g6b5, fbCompositeSrc_8888x0565, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, fbCompositeSrc_8888x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, fbCompositeSrc_8888x8888, 0 }, + { PIXMAN_OP_OVER, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_b5g6r5, fbCompositeSrc_8888x0565, 0 }, +#if 0 + /* FIXME */ + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a1, PIXMAN_r5g6b5, fbCompositeSolidMask_nx1xn, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a1, PIXMAN_b5g6r5, fbCompositeSolidMask_nx1xn, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a1, PIXMAN_r8g8b8, fbCompositeSolidMask_nx1xn, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a1, PIXMAN_b8g8r8, fbCompositeSolidMask_nx1xn, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a1, PIXMAN_a8r8g8b8, fbCompositeSolidMask_nx1xn, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a1, PIXMAN_a8b8g8r8, fbCompositeSolidMask_nx1xn, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a1, PIXMAN_x8r8g8b8, fbCompositeSolidMask_nx1xn, 0 }, + { PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a1, PIXMAN_x8b8g8r8, fbCompositeSolidMask_nx1xn, 0 }, +#endif + { PIXMAN_OP_ADD, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, fbCompositeSrcAdd_8888x8888, 0 }, + { PIXMAN_OP_ADD, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, fbCompositeSrcAdd_8888x8888, 0 }, + { PIXMAN_OP_ADD, PIXMAN_a8, PIXMAN_null, PIXMAN_a8, fbCompositeSrcAdd_8000x8000, 0 }, +#if 0 + /* FIXME */ + { PIXMAN_OP_ADD, PIXMAN_a1, PIXMAN_null, PIXMAN_a1, fbCompositeSrcAdd_1000x1000, 0 }, +#endif + { PIXMAN_OP_ADD, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8, fbCompositeSrcAdd_8888x8x8, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_null, PIXMAN_a8r8g8b8, fbCompositeSolidFill, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeSolidFill, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_null, PIXMAN_a8b8g8r8, fbCompositeSolidFill, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_null, PIXMAN_x8b8g8r8, fbCompositeSolidFill, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_null, PIXMAN_a8, fbCompositeSolidFill, 0 }, + { PIXMAN_OP_SRC, PIXMAN_solid, PIXMAN_null, PIXMAN_r5g6b5, fbCompositeSolidFill, 0 }, + { PIXMAN_OP_SRC, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeSrc_8888xx888, 0 }, + { PIXMAN_OP_SRC, PIXMAN_x8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeSrc_8888xx888, 0 }, + { PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, fbCompositeSrc_8888xx888, 0 }, + { PIXMAN_OP_SRC, PIXMAN_x8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, fbCompositeSrc_8888xx888, 0 }, +#if 0 + /* FIXME */ + { PIXMAN_OP_SRC, PIXMAN_a8r8g8b8, PIXMAN_null, PIXMAN_a8r8g8b8, fbCompositeSrcSrc_nxn, 0 }, + { PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, PIXMAN_null, PIXMAN_a8b8g8r8, fbCompositeSrcSrc_nxn, 0 }, + { PIXMAN_OP_SRC, PIXMAN_x8r8g8b8, PIXMAN_null, PIXMAN_x8r8g8b8, fbCompositeSrcSrc_nxn, 0 }, + { PIXMAN_OP_SRC, PIXMAN_x8b8g8r8, PIXMAN_null, PIXMAN_x8b8g8r8, fbCompositeSrcSrc_nxn, 0 }, + { PIXMAN_OP_SRC, PIXMAN_r5g6b5, PIXMAN_null, PIXMAN_r5g6b5, fbCompositeSrcSrc_nxn, 0 }, + { PIXMAN_OP_SRC, PIXMAN_b5g6r5, PIXMAN_null, PIXMAN_b5g6r5, fbCompositeSrcSrc_nxn, 0 }, +#endif + { PIXMAN_OP_IN, PIXMAN_a8, PIXMAN_null, PIXMAN_a8, fbCompositeSrcIn_8x8, 0 }, + { PIXMAN_OP_IN, PIXMAN_solid, PIXMAN_a8, PIXMAN_a8, fbCompositeSolidMaskIn_nx8x8, 0 }, + { PIXMAN_OP_NONE }, +}; + +static pixman_bool_t +mask_is_solid (pixman_image_t *mask) +{ + if (mask->type == SOLID) + return TRUE; + + if (mask->type == BITS && + mask->common.repeat == PIXMAN_REPEAT_NORMAL && + mask->bits.width == 1 && + mask->bits.height == 1) + { + return TRUE; + } + + return FALSE; +} + +static const FastPathInfo * +get_fast_path (const FastPathInfo *fast_paths, + pixman_op_t op, + pixman_image_t *pSrc, + pixman_image_t *pMask, + pixman_image_t *pDst, + pixman_bool_t is_pixbuf) +{ + const FastPathInfo *info; + + for (info = fast_paths; info->op != PIXMAN_OP_NONE; info++) + { + pixman_bool_t valid_src = FALSE; + pixman_bool_t valid_mask = FALSE; + + if (info->op != op) + continue; + + if ((info->src_format == PIXMAN_solid && can_get_solid (pSrc)) || + (pSrc->type == BITS && info->src_format == pSrc->bits.format)) + { + valid_src = TRUE; + } + + if (!valid_src) + continue; + + if ((info->mask_format == PIXMAN_null && !pMask) || + (pMask && pMask->type == BITS && info->mask_format == pMask->bits.format)) + { + valid_mask = TRUE; + + if (info->flags & NEED_SOLID_MASK) + { + if (!pMask || !mask_is_solid (pMask)) + valid_mask = FALSE; + } + + if (info->flags & NEED_COMPONENT_ALPHA) + { + if (!pMask || !pMask->common.component_alpha) + valid_mask = FALSE; + } + } + + if (!valid_mask) + continue; + + if (info->dest_format != pDst->bits.format) + continue; + + if ((info->flags & NEED_PIXBUF) && !is_pixbuf) + continue; + + return info; + } + + return NULL; +} void pixman_image_composite (pixman_op_t op, @@ -1399,33 +1608,35 @@ pixman_image_composite (pixman_op_t op, uint16_t width, uint16_t height) { - pixman_bool_t srcRepeat = pSrc->type == BITS && pSrc->common.repeat == PIXMAN_REPEAT_NORMAL; - pixman_bool_t maskRepeat = FALSE; - pixman_bool_t srcTransform = pSrc->common.transform != NULL; - pixman_bool_t maskTransform = FALSE; - pixman_bool_t srcAlphaMap = pSrc->common.alpha_map != NULL; - pixman_bool_t maskAlphaMap = FALSE; - pixman_bool_t dstAlphaMap = pDst->common.alpha_map != NULL; - CompositeFunc func = NULL; - + pixman_bool_t srcRepeat = pSrc->type == BITS && pSrc->common.repeat == PIXMAN_REPEAT_NORMAL; + pixman_bool_t maskRepeat = FALSE; + pixman_bool_t srcTransform = pSrc->common.transform != NULL; + pixman_bool_t maskTransform = FALSE; + pixman_bool_t srcAlphaMap = pSrc->common.alpha_map != NULL; + pixman_bool_t maskAlphaMap = FALSE; + pixman_bool_t dstAlphaMap = pDst->common.alpha_map != NULL; + CompositeFunc func = NULL; + +#ifdef USE_SSE2 + fbComposeSetupSSE(); +#endif + #ifdef USE_MMX - static pixman_bool_t mmx_setup = FALSE; - if (!mmx_setup) - { - fbComposeSetupMMX(); - mmx_setup = TRUE; - } + fbComposeSetupMMX(); #endif if (srcRepeat && srcTransform && pSrc->bits.width == 1 && pSrc->bits.height == 1) + { srcTransform = FALSE; - + } + if (pMask && pMask->type == BITS) { maskRepeat = pMask->common.repeat == PIXMAN_REPEAT_NORMAL; + maskTransform = pMask->common.transform != 0; if (pMask->common.filter == PIXMAN_FILTER_CONVOLUTION) maskTransform = TRUE; @@ -1434,586 +1645,63 @@ pixman_image_composite (pixman_op_t op, if (maskRepeat && maskTransform && pMask->bits.width == 1 && pMask->bits.height == 1) + { maskTransform = FALSE; + } } if ((pSrc->type == BITS || can_get_solid (pSrc)) && (!pMask || pMask->type == BITS) && !srcTransform && !maskTransform && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap && (pSrc->common.filter != PIXMAN_FILTER_CONVOLUTION) - && (!pMask || pMask->common.filter != PIXMAN_FILTER_CONVOLUTION) + && (pSrc->common.repeat != PIXMAN_REPEAT_PAD) + && (!pMask || (pMask->common.filter != PIXMAN_FILTER_CONVOLUTION && pMask->common.repeat != PIXMAN_REPEAT_PAD)) && !pSrc->common.read_func && !pSrc->common.write_func && !(pMask && pMask->common.read_func) && !(pMask && pMask->common.write_func) && !pDst->common.read_func && !pDst->common.write_func) - switch (op) { - case PIXMAN_OP_OVER: - if (pMask) - { - if (can_get_solid(pSrc) && - !maskRepeat) - { - if (pSrc->type == SOLID || PIXMAN_FORMAT_COLOR(pSrc->bits.format)) { - switch (pMask->bits.format) { - case PIXMAN_a8: - switch (pDst->bits.format) { - case PIXMAN_r5g6b5: - case PIXMAN_b5g6r5: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSolidMask_nx8x0565mmx; - else -#endif - func = fbCompositeSolidMask_nx8x0565; - break; - case PIXMAN_r8g8b8: - case PIXMAN_b8g8r8: - func = fbCompositeSolidMask_nx8x0888; - break; - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSolidMask_nx8x8888mmx; - else -#endif - func = fbCompositeSolidMask_nx8x8888; - break; - default: - break; - } - break; - case PIXMAN_a8r8g8b8: - if (pMask->common.component_alpha) { - switch (pDst->bits.format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSolidMask_nx8888x8888Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x8888C; - break; - case PIXMAN_r5g6b5: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSolidMask_nx8888x0565Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x0565C; - break; - default: - break; - } - } - break; - case PIXMAN_a8b8g8r8: - if (pMask->common.component_alpha) { - switch (pDst->bits.format) { - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSolidMask_nx8888x8888Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x8888C; - break; - case PIXMAN_b5g6r5: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSolidMask_nx8888x0565Cmmx; - else + { + const FastPathInfo *info; + pixman_bool_t pixbuf; + + pixbuf = + pSrc && pSrc->type == BITS && + pMask && pMask->type == BITS && + pSrc->bits.bits == pMask->bits.bits && + xSrc == xMask && + ySrc == yMask && + !pMask->common.component_alpha && + !maskRepeat; + info = NULL; + +#ifdef USE_SSE2 + if (pixman_have_sse ()) + info = get_fast_path (sse_fast_paths, op, pSrc, pMask, pDst, pixbuf); + if (!info) #endif - func = fbCompositeSolidMask_nx8888x0565C; - break; - default: - break; - } - } - break; - case PIXMAN_a1: - switch (pDst->bits.format) { - case PIXMAN_r5g6b5: - case PIXMAN_b5g6r5: - case PIXMAN_r8g8b8: - case PIXMAN_b8g8r8: - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: - { - uint32_t src; -#if 0 - /* FIXME */ - fbComposeGetSolid(pSrc, src, pDst->bits.format); - if ((src & 0xff000000) == 0xff000000) - func = fbCompositeSolidMask_nx1xn; -#endif - break; - } - default: - break; - } - break; - default: - break; - } - } - if (func) - srcRepeat = FALSE; - } - else if (!srcRepeat) /* has mask and non-repeating source */ - { - if (pSrc->bits.bits == pMask->bits.bits && - xSrc == xMask && - ySrc == yMask && - !pMask->common.component_alpha && !maskRepeat) - { - /* source == mask: non-premultiplied data */ - switch (pSrc->bits.format) { - case PIXMAN_x8b8g8r8: - switch (pMask->bits.format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_a8b8g8r8: - switch (pDst->bits.format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrc_8888RevNPx8888mmx; -#endif - break; - case PIXMAN_r5g6b5: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrc_8888RevNPx0565mmx; -#endif - break; - default: - break; - } - break; - default: - break; - } - break; - case PIXMAN_x8r8g8b8: - switch (pMask->bits.format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_a8b8g8r8: - switch (pDst->bits.format) { - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrc_8888RevNPx8888mmx; -#endif - break; - case PIXMAN_r5g6b5: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrc_8888RevNPx0565mmx; -#endif - break; - default: - break; - } - break; - default: - break; - } - break; - default: - break; - } - break; - } - else if (maskRepeat && - pMask->bits.width == 1 && - pMask->bits.height == 1) - { - switch (pSrc->bits.format) { -#ifdef USE_MMX - case PIXMAN_x8r8g8b8: - if ((pDst->bits.format == PIXMAN_a8r8g8b8 || - pDst->bits.format == PIXMAN_x8r8g8b8) && - pMask->bits.format == PIXMAN_a8 && pixman_have_mmx()) - func = fbCompositeSrc_x888xnx8888mmx; - break; - case PIXMAN_x8b8g8r8: - if ((pDst->bits.format == PIXMAN_a8b8g8r8 || - pDst->bits.format == PIXMAN_x8b8g8r8) && - pMask->bits.format == PIXMAN_a8 && pixman_have_mmx()) - func = fbCompositeSrc_x888xnx8888mmx; - break; - case PIXMAN_a8r8g8b8: - if ((pDst->bits.format == PIXMAN_a8r8g8b8 || - pDst->bits.format == PIXMAN_x8r8g8b8) && - pMask->bits.format == PIXMAN_a8 && pixman_have_mmx()) - func = fbCompositeSrc_8888x8x8888mmx; - break; - case PIXMAN_a8b8g8r8: - if ((pDst->bits.format == PIXMAN_a8b8g8r8 || - pDst->bits.format == PIXMAN_x8b8g8r8) && - pMask->bits.format == PIXMAN_a8 && pixman_have_mmx()) - func = fbCompositeSrc_8888x8x8888mmx; - break; -#endif - default: - break; - } - - if (func) - maskRepeat = FALSE; - } - else - { -#if 0 - /* FIXME: This code is commented out since it's apparently not - * actually faster than the generic code. - */ - if (pMask->bits.format == PIXMAN_a8) - { - if ((pSrc->bits.format == PIXMAN_x8r8g8b8 && - (pDst->bits.format == PIXMAN_x8r8g8b8 || - pDst->bits.format == PIXMAN_a8r8g8b8)) || - (pSrc->bits.format == PIXMAN_x8b8g8r8 && - (pDst->bits.format == PIXMAN_x8b8g8r8 || - pDst->bits.format == PIXMAN_a8b8g8r8))) - { -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeOver_x888x8x8888mmx; - else -#endif - func = fbCompositeOver_x888x8x8888; - } - } -#endif - } - } - } - else /* no mask */ - { - if (can_get_solid(pSrc)) - { - /* no mask and repeating source */ - if (pSrc->type == SOLID || pSrc->bits.format == PIXMAN_a8r8g8b8) - { - switch (pDst->bits.format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: #ifdef USE_MMX - if (pixman_have_mmx()) - { - srcRepeat = FALSE; - func = fbCompositeSolid_nx8888mmx; - } -#endif - break; - case PIXMAN_r5g6b5: -#ifdef USE_MMX - if (pixman_have_mmx()) - { - srcRepeat = FALSE; - func = fbCompositeSolid_nx0565mmx; - } -#endif - break; - default: - break; - } - break; - } - } - else if (! srcRepeat) - { - /* - * Formats without alpha bits are just Copy with Over - */ - if (pSrc->bits.format == pDst->bits.format && !PIXMAN_FORMAT_A(pSrc->bits.format)) - { -#ifdef USE_MMX - if (pixman_have_mmx() && - (pSrc->bits.format == PIXMAN_x8r8g8b8 || pSrc->bits.format == PIXMAN_x8b8g8r8)) - func = fbCompositeCopyAreammx; - else -#endif -#if 0 - /* FIXME */ - func = fbCompositeSrcSrc_nxn -#endif - ; - } - else switch (pSrc->bits.format) { - case PIXMAN_a8r8g8b8: - switch (pDst->bits.format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrc_8888x8888mmx; - else -#endif - func = fbCompositeSrc_8888x8888; - break; - case PIXMAN_r8g8b8: - func = fbCompositeSrc_8888x0888; - break; - case PIXMAN_r5g6b5: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrc_8888x0565mmx; - else -#endif - func = fbCompositeSrc_8888x0565; - break; - default: - break; - } - break; - case PIXMAN_x8r8g8b8: - switch (pDst->bits.format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeCopyAreammx; -#endif - break; - default: - break; - } - case PIXMAN_x8b8g8r8: - switch (pDst->bits.format) { - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeCopyAreammx; -#endif - break; - default: - break; - } - break; - case PIXMAN_a8b8g8r8: - switch (pDst->bits.format) { - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrc_8888x8888mmx; - else -#endif - func = fbCompositeSrc_8888x8888; - break; - case PIXMAN_b8g8r8: - func = fbCompositeSrc_8888x0888; - break; - case PIXMAN_b5g6r5: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrc_8888x0565mmx; - else -#endif - func = fbCompositeSrc_8888x0565; - break; - default: - break; - } - break; - default: - break; - } - } - } - break; - case PIXMAN_OP_ADD: - if (pMask == 0) - { - switch (pSrc->bits.format) { - case PIXMAN_a8r8g8b8: - switch (pDst->bits.format) { - case PIXMAN_a8r8g8b8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrcAdd_8888x8888mmx; - else -#endif - func = fbCompositeSrcAdd_8888x8888; - break; - default: - break; - } - break; - case PIXMAN_a8b8g8r8: - switch (pDst->bits.format) { - case PIXMAN_a8b8g8r8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrcAdd_8888x8888mmx; - else -#endif - func = fbCompositeSrcAdd_8888x8888; - break; - default: - break; - } - break; - case PIXMAN_a8: - switch (pDst->bits.format) { - case PIXMAN_a8: -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrcAdd_8000x8000mmx; - else -#endif - func = fbCompositeSrcAdd_8000x8000; - break; - default: - break; - } - break; - case PIXMAN_a1: - switch (pDst->bits.format) { - case PIXMAN_a1: -#if 0 - /* FIXME */ - func = fbCompositeSrcAdd_1000x1000; + + if (pixman_have_mmx()) + info = get_fast_path (mmx_fast_paths, op, pSrc, pMask, pDst, pixbuf); + if (!info) #endif - break; - default: - break; - } - break; - default: - break; - } - } - else + info = get_fast_path (c_fast_paths, op, pSrc, pMask, pDst, pixbuf); + + if (info) { - if (can_get_solid (pSrc) && - pMask->bits.format == PIXMAN_a8 && - pDst->bits.format == PIXMAN_a8) - { + func = info->func; + + if (info->src_format == PIXMAN_solid) srcRepeat = FALSE; -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeSrcAdd_8888x8x8mmx; - else -#endif - func = fbCompositeSrcAdd_8888x8x8; - } - } - break; - case PIXMAN_OP_SRC: - if (pMask) - { -#ifdef USE_MMX - if (can_get_solid (pSrc)) - { - if (pMask->bits.format == PIXMAN_a8) - { - switch (pDst->bits.format) - { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: - if (pixman_have_mmx()) - { - srcRepeat = FALSE; - func = fbCompositeSolidMaskSrc_nx8x8888mmx; - } - break; - default: - break; - } - } - } -#endif - } - else - { - if (can_get_solid (pSrc)) - { - switch (pDst->bits.format) - { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: - case PIXMAN_a8: - case PIXMAN_r5g6b5: - func = fbCompositeSolidFill; - srcRepeat = FALSE; - break; - default: - break; - } - } - else if (pSrc->bits.format == pDst->bits.format) - { -#ifdef USE_MMX - if (pSrc->bits.bits != pDst->bits.bits && pixman_have_mmx() && - (PIXMAN_FORMAT_BPP (pSrc->bits.format) == 16 || - PIXMAN_FORMAT_BPP (pSrc->bits.format) == 32)) - func = fbCompositeCopyAreammx; - else -#endif - /* FIXME */ -#if 0 - func = fbCompositeSrcSrc_nxn -#endif - ; - } - else if (((pSrc->bits.format == PIXMAN_a8r8g8b8 || - pSrc->bits.format == PIXMAN_x8r8g8b8) && - pDst->bits.format == PIXMAN_x8r8g8b8) || - ((pSrc->bits.format == PIXMAN_a8b8g8r8 || - pSrc->bits.format == PIXMAN_x8b8g8r8) && - pDst->bits.format == PIXMAN_x8b8g8r8)) + + if (info->mask_format == PIXMAN_solid || + info->flags & NEED_SOLID_MASK) { - func = fbCompositeSrc_8888xx888; + maskRepeat = FALSE; } } - break; - case PIXMAN_OP_IN: - if (pSrc->bits.format == PIXMAN_a8 && - pDst->bits.format == PIXMAN_a8 && - !pMask) - { -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeIn_8x8mmx; - else -#endif - func = fbCompositeSrcIn_8x8; - } - else if (srcRepeat && pMask && !pMask->common.component_alpha && - (pSrc->bits.format == PIXMAN_a8r8g8b8 || - pSrc->bits.format == PIXMAN_a8b8g8r8) && - (pMask->bits.format == PIXMAN_a8) && - pDst->bits.format == PIXMAN_a8) - { -#ifdef USE_MMX - if (pixman_have_mmx()) - func = fbCompositeIn_nx8x8mmx; - else -#endif - func = fbCompositeSolidMaskIn_nx8x8; - srcRepeat = FALSE; - } - break; - default: - break; } - + if ((srcRepeat && pSrc->bits.width == 1 && pSrc->bits.height == 1) || @@ -2031,8 +1719,9 @@ pixman_image_composite (pixman_op_t op, */ func = NULL; } - - if (!func) { + + if (!func) + { func = pixman_image_composite_rect; /* CompositeGeneral optimizes 1x1 repeating images itself */ @@ -2041,7 +1730,7 @@ pixman_image_composite (pixman_op_t op, { srcRepeat = FALSE; } - + if (pMask && pMask->type == BITS && pMask->bits.width == 1 && pMask->bits.height == 1) { @@ -2051,9 +1740,9 @@ pixman_image_composite (pixman_op_t op, /* if we are transforming, repeats are handled in fbFetchTransformed */ if (srcTransform) srcRepeat = FALSE; - + if (maskTransform) - maskTransform = FALSE; + maskRepeat = FALSE; } pixman_walk_composite_region (op, pSrc, pMask, pDst, xSrc, ySrc, @@ -2077,7 +1766,7 @@ pixman_image_composite (pixman_op_t op, enum CPUFeatures { NoFeatures = 0, MMX = 0x1, - MMX_Extensions = 0x2, + MMX_Extensions = 0x2, SSE = 0x6, SSE2 = 0x8, CMOV = 0x10 @@ -2143,9 +1832,9 @@ static unsigned int detectCPUFeatures(void) { "pop %%ebx\n" "1:\n" "mov %%edx, %0\n" - : "=r" (result), - "=m" (vendor[0]), - "=m" (vendor[4]), + : "=r" (result), + "=m" (vendor[0]), + "=m" (vendor[4]), "=m" (vendor[8]) : : "%eax", "%ecx", "%edx" @@ -2188,7 +1877,7 @@ static unsigned int detectCPUFeatures(void) { #else # error unsupported compiler #endif - + features = 0; if (result) { /* result now contains the standard feature bits */ @@ -2256,8 +1945,27 @@ pixman_have_mmx (void) mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions); initialized = TRUE; } - + return mmx_present; } + +#ifdef USE_SSE2 +pixman_bool_t +pixman_have_sse (void) +{ + static pixman_bool_t initialized = FALSE; + static pixman_bool_t sse_present; + + if (!initialized) + { + unsigned int features = detectCPUFeatures(); + sse_present = (features & (MMX|MMX_Extensions|SSE|SSE2)) == (MMX|MMX_Extensions|SSE|SSE2); + initialized = TRUE; + } + + return sse_present; +} +#endif + #endif /* __amd64__ */ -#endif +#endif diff --git a/lib/pixman/pixman/pixman-private.h b/lib/pixman/pixman/pixman-private.h index 775f7a7e5..5767c1084 100644 --- a/lib/pixman/pixman/pixman-private.h +++ b/lib/pixman/pixman/pixman-private.h @@ -27,6 +27,7 @@ # define BITMAP_BIT_ORDER LSBFirst #endif +#undef DEBUG #define DEBUG 0 #if defined (__GNUC__) @@ -37,16 +38,49 @@ # define FUNC ((const char*) ("???")) #endif +#ifndef INT16_MIN +# define INT16_MIN (-32767-1) +#endif + +#ifndef INT16_MAX +# define INT16_MAX (32767) +#endif + +#ifndef INT32_MIN +# define INT32_MIN (-2147483647-1) +#endif + +#ifndef INT32_MAX +# define INT32_MAX (2147483647) +#endif + +#ifndef UINT32_MIN +# define UINT32_MIN (0) +#endif + +#ifndef UINT32_MAX +# define UINT32_MAX (4294967295U) +#endif + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + +#ifdef _MSC_VER +#define inline __inline +#endif #define FB_SHIFT 5 #define FB_UNIT (1 << FB_SHIFT) #define FB_HALFUNIT (1 << (FB_SHIFT-1)) #define FB_MASK (FB_UNIT - 1) #define FB_ALLONES ((uint32_t) -1) - + /* Memory allocation helpers */ void *pixman_malloc_ab (unsigned int n, unsigned int b); void *pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c); +pixman_bool_t pixman_multiply_overflows_int (unsigned int a, unsigned int b); +pixman_bool_t pixman_addition_overflows_int (unsigned int a, unsigned int b); #if DEBUG @@ -112,6 +146,12 @@ typedef struct point point_t; typedef FASTCALL void (*CombineMaskU) (uint32_t *src, const uint32_t *mask, int width); typedef FASTCALL void (*CombineFuncU) (uint32_t *dest, const uint32_t *src, int width); typedef FASTCALL void (*CombineFuncC) (uint32_t *dest, uint32_t *src, uint32_t *mask, int width); +typedef FASTCALL void (*fetchProc)(bits_image_t *pict, int x, int y, int width, + uint32_t *buffer); +typedef FASTCALL uint32_t (*fetchPixelProc)(bits_image_t *pict, int offset, int line); +typedef FASTCALL void (*storeProc)(pixman_image_t *, uint32_t *bits, + const uint32_t *values, int x, int width, + const pixman_indexed_t *); typedef struct _FbComposeData { uint8_t op; @@ -141,6 +181,32 @@ void pixman_composite_rect_general_accessors (const FbComposeData *data, void pixman_composite_rect_general (const FbComposeData *data, uint32_t *scanline_buffer); +fetchProc pixman_fetchProcForPicture (bits_image_t *); +fetchPixelProc pixman_fetchPixelProcForPicture (bits_image_t *); +storeProc pixman_storeProcForPicture (bits_image_t *); +fetchProc pixman_fetchProcForPicture_accessors (bits_image_t *); +fetchPixelProc pixman_fetchPixelProcForPicture_accessors (bits_image_t *); +storeProc pixman_storeProcForPicture_accessors (bits_image_t *); + +void pixmanFetchSourcePict(source_image_t *, int x, int y, int width, + uint32_t *buffer, uint32_t *mask, uint32_t maskBits); + +void fbFetchTransformed(bits_image_t *, int x, int y, int width, + uint32_t *buffer, uint32_t *mask, uint32_t maskBits); +void fbStoreExternalAlpha(bits_image_t *, int x, int y, int width, + uint32_t *buffer); +void fbFetchExternalAlpha(bits_image_t *, int x, int y, int width, + uint32_t *buffer, uint32_t *mask, uint32_t maskBits); + +void fbFetchTransformed_accessors(bits_image_t *, int x, int y, int width, + uint32_t *buffer, uint32_t *mask, + uint32_t maskBits); +void fbStoreExternalAlpha_accessors(bits_image_t *, int x, int y, int width, + uint32_t *buffer); +void fbFetchExternalAlpha_accessors(bits_image_t *, int x, int y, int width, + uint32_t *buffer, uint32_t *mask, + uint32_t maskBits); + /* end */ typedef enum @@ -197,7 +263,7 @@ struct solid_fill source_image_t common; uint32_t color; /* FIXME: shouldn't this be a pixman_color_t? */ }; - + struct gradient { source_image_t common; @@ -239,7 +305,7 @@ struct conical_gradient gradient_t common; pixman_point_fixed_t center; pixman_fixed_t angle; -}; +}; struct bits_image { @@ -265,6 +331,11 @@ union pixman_image solid_fill_t solid; }; + +extern CombineFuncU pixman_fbCombineFuncU[]; +extern CombineFuncC pixman_fbCombineFuncC[]; +FASTCALL void pixman_fbCombineMaskU (uint32_t *src, const uint32_t *mask, int width); + #define LOG2_BITMAP_PAD 5 #define FB_STIP_SHIFT LOG2_BITMAP_PAD #define FB_STIP_UNIT (1 << FB_STIP_SHIFT) @@ -307,23 +378,23 @@ union pixman_image } #if IMAGE_BYTE_ORDER == MSBFirst -#define Fetch24(a) ((unsigned long) (a) & 1 ? \ - ((READ(a) << 16) | READ((uint16_t *) ((a)+1))) : \ - ((READ((uint16_t *) (a)) << 8) | READ((a)+2))) -#define Store24(a,v) ((unsigned long) (a) & 1 ? \ - (WRITE(a, (uint8_t) ((v) >> 16)), \ - WRITE((uint16_t *) ((a)+1), (uint16_t) (v))) : \ - (WRITE((uint16_t *) (a), (uint16_t) ((v) >> 8)), \ - WRITE((a)+2, (uint8_t) (v)))) +#define Fetch24(img, a) ((unsigned long) (a) & 1 ? \ + ((READ(img, a) << 16) | READ(img, (uint16_t *) ((a)+1))) : \ + ((READ(img, (uint16_t *) (a)) << 8) | READ(img, (a)+2))) +#define Store24(img,a,v) ((unsigned long) (a) & 1 ? \ + (WRITE(img, a, (uint8_t) ((v) >> 16)), \ + WRITE(img, (uint16_t *) ((a)+1), (uint16_t) (v))) : \ + (WRITE(img, (uint16_t *) (a), (uint16_t) ((v) >> 8)), \ + WRITE(img, (a)+2, (uint8_t) (v)))) #else -#define Fetch24(a) ((unsigned long) (a) & 1 ? \ - (READ(a) | (READ((uint16_t *) ((a)+1)) << 8)) : \ - (READ((uint16_t *) (a)) | (READ((a)+2) << 16))) -#define Store24(a,v) ((unsigned long) (a) & 1 ? \ - (WRITE(a, (uint8_t) (v)), \ - WRITE((uint16_t *) ((a)+1), (uint16_t) ((v) >> 8))) : \ - (WRITE((uint16_t *) (a), (uint16_t) (v)), \ - WRITE((a)+2, (uint8_t) ((v) >> 16)))) +#define Fetch24(img,a) ((unsigned long) (a) & 1 ? \ + (READ(img, a) | (READ(img, (uint16_t *) ((a)+1)) << 8)) : \ + (READ(img, (uint16_t *) (a)) | (READ(img, (a)+2) << 16))) +#define Store24(img,a,v) ((unsigned long) (a) & 1 ? \ + (WRITE(img, a, (uint8_t) (v)), \ + WRITE(img, (uint16_t *) ((a)+1), (uint16_t) ((v) >> 8))) : \ + (WRITE(img, (uint16_t *) (a), (uint16_t) (v)), \ + WRITE(img, (a)+2, (uint8_t) ((v) >> 16)))) #endif #define Alpha(x) ((x) >> 24) @@ -566,6 +637,8 @@ union pixman_image #define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) : \ ((a) - (b) + 1 - (((b) < 0) << 1)) / (b)) +#define CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a))) + #if 0 /* FIXME: the MOD macro above is equivalent, but faster I think */ #define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) @@ -612,43 +685,38 @@ union pixman_image #ifdef PIXMAN_FB_ACCESSORS -#define READ(ptr) \ - (image->common.read_func ((ptr), sizeof(*(ptr)))) -#define WRITE(ptr,val) \ - (image->common.write_func ((ptr), (val), sizeof (*(ptr)))) +#define READ(img, ptr) \ + ((img)->common.read_func ((ptr), sizeof(*(ptr)))) +#define WRITE(img, ptr,val) \ + ((img)->common.write_func ((ptr), (val), sizeof (*(ptr)))) -#define MEMCPY_WRAPPED(dst, src, size) \ +#define MEMCPY_WRAPPED(img, dst, src, size) \ do { \ size_t _i; \ uint8_t *_dst = (uint8_t*)(dst), *_src = (uint8_t*)(src); \ for(_i = 0; _i < size; _i++) { \ - WRITE(_dst +_i, READ(_src + _i)); \ + WRITE((img), _dst +_i, READ((img), _src + _i)); \ } \ } while (0) - -#define MEMSET_WRAPPED(dst, val, size) \ + +#define MEMSET_WRAPPED(img, dst, val, size) \ do { \ size_t _i; \ uint8_t *_dst = (uint8_t*)(dst); \ - for(_i = 0; _i < (size_t) size; _i++) { \ - WRITE(_dst +_i, (val)); \ + for(_i = 0; _i < (size_t) size; _i++) { \ + WRITE((img), _dst +_i, (val)); \ } \ } while (0) -/* FIXME */ -#define fbPrepareAccess(x) -#define fbFinishAccess(x) - #else -#define READ(ptr) (*(ptr)) -#define WRITE(ptr, val) (*(ptr) = (val)) -#define MEMCPY_WRAPPED(dst, src, size) \ +#define READ(img, ptr) (*(ptr)) +#define WRITE(img, ptr, val) (*(ptr) = (val)) +#define MEMCPY_WRAPPED(img, dst, src, size) \ memcpy(dst, src, size) -#define MEMSET_WRAPPED(dst, val, size) \ +#define MEMSET_WRAPPED(img, dst, val, size) \ memset(dst, val, size) -#define fbPrepareAccess(x) -#define fbFinishAccess(x) + #endif #define fbComposeGetSolid(img, res, fmt) \ @@ -668,21 +736,21 @@ union pixman_image switch (PIXMAN_FORMAT_BPP((img)->bits.format)) \ { \ case 32: \ - (res) = READ((uint32_t *)bits__); \ + (res) = READ(img, (uint32_t *)bits__); \ break; \ case 24: \ - (res) = Fetch24 ((uint8_t *) bits__); \ + (res) = Fetch24(img, (uint8_t *) bits__); \ break; \ case 16: \ - (res) = READ((uint16_t *) bits__); \ + (res) = READ(img, (uint16_t *) bits__); \ (res) = cvt0565to0888(res); \ break; \ case 8: \ - (res) = READ((uint8_t *) bits__); \ + (res) = READ(img, (uint8_t *) bits__); \ (res) = (res) << 24; \ break; \ case 1: \ - (res) = READ((uint32_t *) bits__); \ + (res) = READ(img, (uint32_t *) bits__); \ (res) = FbLeftStipBits((res),1) ? 0xff000000 : 0x00000000; \ break; \ default: \ @@ -712,7 +780,7 @@ union pixman_image __bits__ = pict->bits.bits; \ __stride__ = pict->bits.rowstride; \ __bpp__ = PIXMAN_FORMAT_BPP(pict->bits.format); \ - (out_stride) = __stride__ * sizeof (uint32_t) / sizeof (type); \ + (out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \ (line) = ((type *) __bits__) + \ (out_stride) * (y) + (mul) * (x); \ } while (0) @@ -724,7 +792,7 @@ union pixman_image #define MAX_ALPHA(n) ((1 << (n)) - 1) #define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1) -#define N_X_FRAC(n) ((1 << ((n)/2)) + 1) +#define N_X_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) + 1) #define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC(n)) #define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n)) @@ -774,6 +842,8 @@ pixman_rasterize_edges_accessors (pixman_image_t *image, pixman_fixed_t b); +#ifdef PIXMAN_TIMING + /* Timing */ static inline uint64_t oil_profile_stamp_rdtsc (void) @@ -812,10 +882,11 @@ void pixman_timer_register (PixmanTimer *timer); \ timer##tname.n_times++; \ begin##tname = OIL_STAMP(); - + #define TIMER_END(tname) \ timer##tname.total += OIL_STAMP() - begin##tname; \ } +#endif /* PIXMAN_TIMING */ #endif /* PIXMAN_PRIVATE_H */ diff --git a/lib/pixman/pixman/pixman-region.c b/lib/pixman/pixman/pixman-region.c index 94b6dcce2..496ce7728 100644 --- a/lib/pixman/pixman/pixman-region.c +++ b/lib/pixman/pixman/pixman-region.c @@ -45,14 +45,16 @@ SOFTWARE. ******************************************************************/ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + #include <stdlib.h> #include <limits.h> #include <string.h> #include <stdio.h> #include "pixman-private.h" -#include "pixman.h" typedef struct pixman_region16_point { int x, y; @@ -2515,6 +2517,8 @@ pixman_region_init_rects (pixman_region16_t *region, { int overlap; + /* if it's 1, then we just want to set the extents, so call + * the existing method. */ if (count == 1) { pixman_region_init_rect(region, boxes[0].x1, @@ -2525,6 +2529,15 @@ pixman_region_init_rects (pixman_region16_t *region, } pixman_region_init(region); + + /* if it's 0, don't call pixman_rect_alloc -- 0 rectangles is + * a special case, and causing pixman_rect_alloc would cause + * us to leak memory (because the 0-rect case should be the + * static pixman_region_emptyData data). + */ + if (count == 0) + return TRUE; + if (!pixman_rect_alloc(region, count)) return FALSE; diff --git a/lib/pixman/pixman/pixman-trap.c b/lib/pixman/pixman/pixman-trap.c index 4343e72fa..0dca6ccf0 100644 --- a/lib/pixman/pixman/pixman-trap.c +++ b/lib/pixman/pixman/pixman-trap.c @@ -1,6 +1,4 @@ /* - * $Id: pixman-trap.c,v 1.1 2007/10/03 20:48:54 matthieu Exp $ - * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its @@ -22,7 +20,10 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + #include <stdio.h> #include "pixman-private.h" @@ -48,7 +49,7 @@ pixman_add_traps (pixman_image_t * image, height = image->bits.height; bpp = PIXMAN_FORMAT_BPP (image->bits.format); - x_off_fixed = pixman_int_to_fixed(y_off); + x_off_fixed = pixman_int_to_fixed(x_off); y_off_fixed = pixman_int_to_fixed(y_off); while (ntrap--) @@ -82,8 +83,6 @@ pixman_add_traps (pixman_image_t * image, } traps++; } - - fbFinishAccess (pPicture->pDrawable); } static void diff --git a/lib/pixman/pixman/pixman-utils.c b/lib/pixman/pixman/pixman-utils.c index cdf115d5f..b100d096c 100644 --- a/lib/pixman/pixman/pixman-utils.c +++ b/lib/pixman/pixman/pixman-utils.c @@ -15,15 +15,18 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + #include <stdlib.h> -#include "pixman.h" + #include "pixman-private.h" #include "pixman-mmx.h" @@ -51,10 +54,10 @@ pixman_transform_point_3d (pixman_transform_t *transform, result.vector[j] = (pixman_fixed_48_16_t) v; } - + if (!result.vector[2]) return FALSE; - + *vector = result; return TRUE; } @@ -90,7 +93,7 @@ pixman_fill8 (uint32_t *bits, int height, uint32_t xor) { - int byte_stride = stride * sizeof (uint32_t); + int byte_stride = stride * (int) sizeof (uint32_t); uint8_t *dst = (uint8_t *) bits; uint8_t v = xor & 0xff; int i; @@ -115,7 +118,7 @@ pixman_fill16 (uint32_t *bits, int height, uint32_t xor) { - int short_stride = (stride * sizeof (uint32_t)) / sizeof (uint16_t); + int short_stride = (stride * (int) sizeof (uint32_t)) / (int) sizeof (uint16_t); uint16_t *dst = (uint16_t *)bits; uint16_t v = xor & 0xffff; int i; @@ -141,9 +144,9 @@ pixman_fill32 (uint32_t *bits, uint32_t xor) { int i; - + bits = bits + y * stride + x; - + while (height--) { for (i = 0; i < width; ++i) @@ -167,7 +170,7 @@ pixman_fill (uint32_t *bits, printf ("filling: %d %d %d %d (stride: %d, bpp: %d) pixel: %x\n", x, y, width, height, stride, bpp, xor); #endif - + #ifdef USE_MMX if (!pixman_have_mmx() || !pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor)) #endif @@ -177,11 +180,11 @@ pixman_fill (uint32_t *bits, case 8: pixman_fill8 (bits, stride, x, y, width, height, xor); break; - + case 16: pixman_fill16 (bits, stride, x, y, width, height, xor); break; - + case 32: pixman_fill32 (bits, stride, x, y, width, height, xor); break; @@ -191,10 +194,10 @@ pixman_fill (uint32_t *bits, break; } } - + return TRUE; } - + /* * Compute the smallest value no less than y which is on a @@ -206,7 +209,7 @@ pixman_sample_ceil_y (pixman_fixed_t y, int n) { pixman_fixed_t f = pixman_fixed_frac(y); pixman_fixed_t i = pixman_fixed_floor(y); - + f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); if (f > Y_FRAC_LAST(n)) { @@ -227,7 +230,7 @@ pixman_sample_floor_y (pixman_fixed_t y, int n) { pixman_fixed_t f = pixman_fixed_frac(y); pixman_fixed_t i = pixman_fixed_floor (y); - + f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); if (f < Y_FRAC_FIRST(n)) { @@ -246,9 +249,9 @@ pixman_edge_step (pixman_edge_t *e, int n) pixman_fixed_48_16_t ne; e->x += n * e->stepx; - + ne = e->e + n * (pixman_fixed_48_16_t) e->dx; - + if (n >= 0) { if (ne > 0) @@ -278,7 +281,7 @@ _pixman_edge_tMultiInit (pixman_edge_t *e, int n, pixman_fixed_t *stepx_p, pixma { pixman_fixed_t stepx; pixman_fixed_48_16_t ne; - + ne = n * (pixman_fixed_48_16_t) e->dx; stepx = n * e->stepx; if (ne > 0) @@ -328,7 +331,7 @@ pixman_edge_init (pixman_edge_t *e, e->dx = -dx % dy; e->e = 0; } - + _pixman_edge_tMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small); _pixman_edge_tMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big); } @@ -368,6 +371,20 @@ pixman_line_fixed_edge_init (pixman_edge_t *e, bot->y + y_off_fixed); } +pixman_bool_t +pixman_multiply_overflows_int (unsigned int a, + unsigned int b) +{ + return a >= INT32_MAX / b; +} + +pixman_bool_t +pixman_addition_overflows_int (unsigned int a, + unsigned int b) +{ + return a > INT32_MAX - b; +} + void * pixman_malloc_ab(unsigned int a, unsigned int b) @@ -390,3 +407,183 @@ pixman_malloc_abc (unsigned int a, else return malloc (a * b * c); } + + +/** + * pixman_version: + * + * Returns the version of the pixman library encoded in a single + * integer as per %PIXMAN_VERSION_ENCODE. The encoding ensures that + * later versions compare greater than earlier versions. + * + * A run-time comparison to check that pixman's version is greater than + * or equal to version X.Y.Z could be performed as follows: + * + * <informalexample><programlisting> + * if (pixman_version() >= PIXMAN_VERSION_ENCODE(X,Y,Z)) {...} + * </programlisting></informalexample> + * + * See also pixman_version_string() as well as the compile-time + * equivalents %PIXMAN_VERSION and %PIXMAN_VERSION_STRING. + * + * Return value: the encoded version. + **/ +int +pixman_version (void) +{ + return PIXMAN_VERSION; +} + +/** + * pixman_version_string: + * + * Returns the version of the pixman library as a human-readable string + * of the form "X.Y.Z". + * + * See also pixman_version() as well as the compile-time equivalents + * %PIXMAN_VERSION_STRING and %PIXMAN_VERSION. + * + * Return value: a string containing the version. + **/ +const char* +pixman_version_string (void) +{ + return PIXMAN_VERSION_STRING; +} + +/** + * pixman_format_supported_destination: + * @format: A pixman_format_code_t format + * + * Return value: whether the provided format code is a supported + * format for a pixman surface used as a destination in + * rendering. + * + * Currently, all pixman_format_code_t values are supported + * except for the YUV formats. + **/ +pixman_bool_t +pixman_format_supported_destination (pixman_format_code_t format) +{ + switch (format) { + /* 32 bpp formats */ + case PIXMAN_a8r8g8b8: + case PIXMAN_x8r8g8b8: + case PIXMAN_a8b8g8r8: + case PIXMAN_x8b8g8r8: + case PIXMAN_r8g8b8: + case PIXMAN_b8g8r8: + case PIXMAN_r5g6b5: + case PIXMAN_b5g6r5: + /* 16 bpp formats */ + case PIXMAN_a1r5g5b5: + case PIXMAN_x1r5g5b5: + case PIXMAN_a1b5g5r5: + case PIXMAN_x1b5g5r5: + case PIXMAN_a4r4g4b4: + case PIXMAN_x4r4g4b4: + case PIXMAN_a4b4g4r4: + case PIXMAN_x4b4g4r4: + /* 8bpp formats */ + case PIXMAN_a8: + case PIXMAN_r3g3b2: + case PIXMAN_b2g3r3: + case PIXMAN_a2r2g2b2: + case PIXMAN_a2b2g2r2: + case PIXMAN_c8: + case PIXMAN_g8: + case PIXMAN_x4a4: + /* Collides with PIXMAN_c8 + case PIXMAN_x4c4: + */ + /* Collides with PIXMAN_g8 + case PIXMAN_x4g4: + */ + /* 4bpp formats */ + case PIXMAN_a4: + case PIXMAN_r1g2b1: + case PIXMAN_b1g2r1: + case PIXMAN_a1r1g1b1: + case PIXMAN_a1b1g1r1: + case PIXMAN_c4: + case PIXMAN_g4: + /* 1bpp formats */ + case PIXMAN_a1: + case PIXMAN_g1: + return TRUE; + + /* YUV formats */ + case PIXMAN_yuy2: + case PIXMAN_yv12: + default: + return FALSE; + } +} + +/** + * pixman_format_supported_source: + * @format: A pixman_format_code_t format + * + * Return value: whether the provided format code is a supported + * format for a pixman surface used as a source in + * rendering. + * + * Currently, all pixman_format_code_t values are supported. + **/ +pixman_bool_t +pixman_format_supported_source (pixman_format_code_t format) +{ + switch (format) { + /* 32 bpp formats */ + case PIXMAN_a8r8g8b8: + case PIXMAN_x8r8g8b8: + case PIXMAN_a8b8g8r8: + case PIXMAN_x8b8g8r8: + case PIXMAN_r8g8b8: + case PIXMAN_b8g8r8: + case PIXMAN_r5g6b5: + case PIXMAN_b5g6r5: + /* 16 bpp formats */ + case PIXMAN_a1r5g5b5: + case PIXMAN_x1r5g5b5: + case PIXMAN_a1b5g5r5: + case PIXMAN_x1b5g5r5: + case PIXMAN_a4r4g4b4: + case PIXMAN_x4r4g4b4: + case PIXMAN_a4b4g4r4: + case PIXMAN_x4b4g4r4: + /* 8bpp formats */ + case PIXMAN_a8: + case PIXMAN_r3g3b2: + case PIXMAN_b2g3r3: + case PIXMAN_a2r2g2b2: + case PIXMAN_a2b2g2r2: + case PIXMAN_c8: + case PIXMAN_g8: + case PIXMAN_x4a4: + /* Collides with PIXMAN_c8 + case PIXMAN_x4c4: + */ + /* Collides with PIXMAN_g8 + case PIXMAN_x4g4: + */ + /* 4bpp formats */ + case PIXMAN_a4: + case PIXMAN_r1g2b1: + case PIXMAN_b1g2r1: + case PIXMAN_a1r1g1b1: + case PIXMAN_a1b1g1r1: + case PIXMAN_c4: + case PIXMAN_g4: + /* 1bpp formats */ + case PIXMAN_a1: + case PIXMAN_g1: + /* YUV formats */ + case PIXMAN_yuy2: + case PIXMAN_yv12: + return TRUE; + + default: + return FALSE; + } +} diff --git a/lib/pixman/pixman/pixman.h b/lib/pixman/pixman/pixman.h index d76cc1257..6a27a3fbc 100644 --- a/lib/pixman/pixman/pixman.h +++ b/lib/pixman/pixman/pixman.h @@ -69,6 +69,8 @@ SOFTWARE. #ifndef PIXMAN_H__ #define PIXMAN_H__ +#include <pixman-version.h> + /* * Standard integers */ @@ -90,6 +92,13 @@ typedef unsigned __int64 uint64_t; # include <stdint.h> #endif +/* GCC visibility */ +#if defined(__GNUC__) && __GNUC__ >= 4 +#define PIXMAN_EXPORT __attribute__ ((visibility("default"))) +#else +#define PIXMAN_EXPORT +#endif + /* * Boolean */ @@ -158,6 +167,7 @@ struct pixman_transform pixman_fixed_t matrix[3][3]; }; +PIXMAN_EXPORT pixman_bool_t pixman_transform_point_3d (pixman_transform_t *transform, pixman_vector_t *vector); @@ -221,7 +231,9 @@ typedef enum PIXMAN_OP_CONJOINT_OUT_REVERSE = 0x28, PIXMAN_OP_CONJOINT_ATOP = 0x29, PIXMAN_OP_CONJOINT_ATOP_REVERSE = 0x2a, - PIXMAN_OP_CONJOINT_XOR = 0x2b + PIXMAN_OP_CONJOINT_XOR = 0x2b, + + PIXMAN_OP_NONE } pixman_op_t; /* @@ -262,65 +274,94 @@ typedef enum PIXMAN_REGION_PART } pixman_region_overlap_t; +PIXMAN_EXPORT +int pixman_version (void); + +PIXMAN_EXPORT +const char* pixman_version_string (void); + /* This function exists only to make it possible to preserve the X ABI - it should * go away at first opportunity. */ +PIXMAN_EXPORT void pixman_region_set_static_pointers (pixman_box16_t *empty_box, pixman_region16_data_t *empty_data, pixman_region16_data_t *broken_data); /* creation/destruction */ +PIXMAN_EXPORT void pixman_region_init (pixman_region16_t *region); +PIXMAN_EXPORT void pixman_region_init_rect (pixman_region16_t *region, int x, int y, unsigned int width, unsigned int height); +PIXMAN_EXPORT void pixman_region_init_with_extents (pixman_region16_t *region, pixman_box16_t *extents); +PIXMAN_EXPORT void pixman_region_fini (pixman_region16_t *region); /* manipulation */ +PIXMAN_EXPORT void pixman_region_translate (pixman_region16_t *region, int x, int y); +PIXMAN_EXPORT pixman_bool_t pixman_region_copy (pixman_region16_t *dest, pixman_region16_t *source); +PIXMAN_EXPORT pixman_bool_t pixman_region_intersect (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2); +PIXMAN_EXPORT pixman_bool_t pixman_region_union (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2); +PIXMAN_EXPORT pixman_bool_t pixman_region_union_rect (pixman_region16_t *dest, pixman_region16_t *source, int x, int y, unsigned int width, unsigned int height); +PIXMAN_EXPORT pixman_bool_t pixman_region_subtract (pixman_region16_t *regD, pixman_region16_t *regM, pixman_region16_t *regS); +PIXMAN_EXPORT pixman_bool_t pixman_region_inverse (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_box16_t *invRect); +PIXMAN_EXPORT pixman_bool_t pixman_region_contains_point (pixman_region16_t *region, int x, int y, pixman_box16_t *box); +PIXMAN_EXPORT pixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t, pixman_box16_t *prect); +PIXMAN_EXPORT pixman_bool_t pixman_region_not_empty (pixman_region16_t *region); +PIXMAN_EXPORT pixman_box16_t * pixman_region_extents (pixman_region16_t *region); +PIXMAN_EXPORT int pixman_region_n_rects (pixman_region16_t *region); +PIXMAN_EXPORT pixman_box16_t * pixman_region_rectangles (pixman_region16_t *region, int *n_rects); +PIXMAN_EXPORT pixman_bool_t pixman_region_equal (pixman_region16_t *region1, pixman_region16_t *region2); +PIXMAN_EXPORT pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region); +PIXMAN_EXPORT void pixman_region_reset (pixman_region16_t *region, pixman_box16_t *box); +PIXMAN_EXPORT pixman_bool_t pixman_region_init_rects (pixman_region16_t *region, pixman_box16_t *boxes, int count); /* Copy / Fill */ +PIXMAN_EXPORT pixman_bool_t pixman_blt (uint32_t *src_bits, uint32_t *dst_bits, int src_stride, @@ -330,6 +371,7 @@ pixman_bool_t pixman_blt (uint32_t *src_bits, int src_x, int src_y, int dst_x, int dst_y, int width, int height); +PIXMAN_EXPORT pixman_bool_t pixman_fill (uint32_t *bits, int stride, int bpp, @@ -337,7 +379,7 @@ pixman_bool_t pixman_fill (uint32_t *bits, int y, int width, int height, - uint32_t xor); + uint32_t _xor); /* * Images */ @@ -397,6 +439,8 @@ struct pixman_indexed #define PIXMAN_TYPE_ABGR 3 #define PIXMAN_TYPE_COLOR 4 #define PIXMAN_TYPE_GRAY 5 +#define PIXMAN_TYPE_YUY2 6 +#define PIXMAN_TYPE_YV12 7 #define PIXMAN_FORMAT_COLOR(f) (PIXMAN_FORMAT_TYPE(f) & 2) @@ -453,24 +497,40 @@ typedef enum { PIXMAN_a1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0), PIXMAN_g1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0), + +/* YUV formats */ + PIXMAN_yuy2 = PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0), + PIXMAN_yv12 = PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0), } pixman_format_code_t; +/* Querying supported format values. */ +PIXMAN_EXPORT +pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format); + +PIXMAN_EXPORT +pixman_bool_t pixman_format_supported_source (pixman_format_code_t format); + /* Constructors */ +PIXMAN_EXPORT pixman_image_t *pixman_image_create_solid_fill (pixman_color_t *color); +PIXMAN_EXPORT pixman_image_t *pixman_image_create_linear_gradient (pixman_point_fixed_t *p1, pixman_point_fixed_t *p2, const pixman_gradient_stop_t *stops, int n_stops); +PIXMAN_EXPORT pixman_image_t *pixman_image_create_radial_gradient (pixman_point_fixed_t *inner, pixman_point_fixed_t *outer, pixman_fixed_t inner_radius, pixman_fixed_t outer_radius, const pixman_gradient_stop_t *stops, int n_stops); +PIXMAN_EXPORT pixman_image_t *pixman_image_create_conical_gradient (pixman_point_fixed_t *center, pixman_fixed_t angle, const pixman_gradient_stop_t *stops, int n_stops); +PIXMAN_EXPORT pixman_image_t *pixman_image_create_bits (pixman_format_code_t format, int width, int height, @@ -478,44 +538,63 @@ pixman_image_t *pixman_image_create_bits (pixman_format_code_t int rowstride_bytes); /* Destructor */ +PIXMAN_EXPORT pixman_image_t *pixman_image_ref (pixman_image_t *image); +PIXMAN_EXPORT pixman_bool_t pixman_image_unref (pixman_image_t *image); /* Set properties */ +PIXMAN_EXPORT pixman_bool_t pixman_image_set_clip_region (pixman_image_t *image, pixman_region16_t *region); +PIXMAN_EXPORT void pixman_image_set_has_client_clip (pixman_image_t *image, pixman_bool_t clien_clip); +PIXMAN_EXPORT pixman_bool_t pixman_image_set_transform (pixman_image_t *image, const pixman_transform_t *transform); +PIXMAN_EXPORT void pixman_image_set_repeat (pixman_image_t *image, pixman_repeat_t repeat); +PIXMAN_EXPORT pixman_bool_t pixman_image_set_filter (pixman_image_t *image, pixman_filter_t filter, const pixman_fixed_t *filter_params, int n_filter_params); +PIXMAN_EXPORT void pixman_image_set_filter_params (pixman_image_t *image, pixman_fixed_t *params, int n_params); -void pixman_image_set_source_cliping (pixman_image_t *image, +PIXMAN_EXPORT +void pixman_image_set_source_clipping (pixman_image_t *image, pixman_bool_t source_clipping); +PIXMAN_EXPORT void pixman_image_set_alpha_map (pixman_image_t *image, pixman_image_t *alpha_map, int16_t x, int16_t y); +PIXMAN_EXPORT void pixman_image_set_component_alpha (pixman_image_t *image, pixman_bool_t component_alpha); +PIXMAN_EXPORT void pixman_image_set_accessors (pixman_image_t *image, pixman_read_memory_func_t read_func, pixman_write_memory_func_t write_func); +PIXMAN_EXPORT void pixman_image_set_indexed (pixman_image_t *image, const pixman_indexed_t *indexed); +PIXMAN_EXPORT uint32_t *pixman_image_get_data (pixman_image_t *image); +PIXMAN_EXPORT int pixman_image_get_width (pixman_image_t *image); +PIXMAN_EXPORT int pixman_image_get_height (pixman_image_t *image); +PIXMAN_EXPORT int pixman_image_get_stride (pixman_image_t *image); +PIXMAN_EXPORT int pixman_image_get_depth (pixman_image_t *image); +PIXMAN_EXPORT pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op, pixman_image_t *image, pixman_color_t *color, @@ -523,6 +602,7 @@ pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op, const pixman_rectangle16_t *rects); /* Composite */ +PIXMAN_EXPORT pixman_bool_t pixman_compute_composite_region (pixman_region16_t * pRegion, pixman_image_t * pSrc, pixman_image_t * pMask, @@ -535,6 +615,7 @@ pixman_bool_t pixman_compute_composite_region (pixman_region16_t * pRegion, int16_t yDst, uint16_t width, uint16_t height); +PIXMAN_EXPORT void pixman_image_composite (pixman_op_t op, pixman_image_t *src, pixman_image_t *mask, @@ -599,12 +680,16 @@ struct pixman_trap pixman_span_fix_t top, bot; }; +PIXMAN_EXPORT pixman_fixed_t pixman_sample_ceil_y (pixman_fixed_t y, int bpp); +PIXMAN_EXPORT pixman_fixed_t pixman_sample_floor_y (pixman_fixed_t y, int bpp); +PIXMAN_EXPORT void pixman_edge_step (pixman_edge_t *e, int n); +PIXMAN_EXPORT void pixman_edge_init (pixman_edge_t *e, int bpp, pixman_fixed_t y_start, @@ -612,31 +697,35 @@ void pixman_edge_init (pixman_edge_t *e, pixman_fixed_t y_top, pixman_fixed_t x_bot, pixman_fixed_t y_bot); +PIXMAN_EXPORT void pixman_line_fixed_edge_init (pixman_edge_t *e, int bpp, pixman_fixed_t y, const pixman_line_fixed_t *line, int x_off, int y_off); +PIXMAN_EXPORT void pixman_rasterize_edges (pixman_image_t *image, pixman_edge_t *l, pixman_edge_t *r, pixman_fixed_t t, pixman_fixed_t b); +PIXMAN_EXPORT void pixman_add_traps (pixman_image_t *image, int16_t x_off, int16_t y_off, int ntrap, pixman_trap_t *traps); +PIXMAN_EXPORT void pixman_add_trapezoids (pixman_image_t *image, int16_t x_off, int y_off, int ntraps, const pixman_trapezoid_t *traps); +PIXMAN_EXPORT void pixman_rasterize_trapezoid (pixman_image_t *image, const pixman_trapezoid_t *trap, int x_off, int y_off); - #endif /* PIXMAN_H__ */ diff --git a/lib/pixman/test/Makefile.am b/lib/pixman/test/Makefile.am index 6548ba55f..3db77b341 100644 --- a/lib/pixman/test/Makefile.am +++ b/lib/pixman/test/Makefile.am @@ -1,7 +1,8 @@ if HAVE_GTK TESTPROGRAMS = \ composite-test \ - gradient-test + gradient-test \ + fetch-test noinst_PROGRAMS = $(TESTPROGRAMS) @@ -9,5 +10,6 @@ INCLUDES = -I$(top_srcdir)/pixman $(GTK_CFLAGS) composite_test_LDADD = $(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS) gradient_test_LDADD = $(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS) +fetch_test_LDADD = $(top_builddir)/pixman/libpixman-1.la -endif
\ No newline at end of file +endif diff --git a/lib/pixman/test/Makefile.in b/lib/pixman/test/Makefile.in index 24d22e5a4..c49b472b8 100644 --- a/lib/pixman/test/Makefile.in +++ b/lib/pixman/test/Makefile.in @@ -47,7 +47,7 @@ mkinstalldirs = $(SHELL) $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @HAVE_GTK_TRUE@am__EXEEXT_1 = composite-test$(EXEEXT) \ -@HAVE_GTK_TRUE@ gradient-test$(EXEEXT) +@HAVE_GTK_TRUE@ gradient-test$(EXEEXT) fetch-test$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) composite_test_SOURCES = composite-test.c composite_test_OBJECTS = composite-test.$(OBJEXT) @@ -55,6 +55,10 @@ am__DEPENDENCIES_1 = @HAVE_GTK_TRUE@composite_test_DEPENDENCIES = \ @HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \ @HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1) +fetch_test_SOURCES = fetch-test.c +fetch_test_OBJECTS = fetch-test.$(OBJEXT) +@HAVE_GTK_TRUE@fetch_test_DEPENDENCIES = \ +@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la gradient_test_SOURCES = gradient-test.c gradient_test_OBJECTS = gradient-test.$(OBJEXT) @HAVE_GTK_TRUE@gradient_test_DEPENDENCIES = \ @@ -71,8 +75,8 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = composite-test.c gradient-test.c -DIST_SOURCES = composite-test.c gradient-test.c +SOURCES = composite-test.c fetch-test.c gradient-test.c +DIST_SOURCES = composite-test.c fetch-test.c gradient-test.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -132,13 +136,19 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PIXMAN_MAJOR = @PIXMAN_MAJOR@ +PIXMAN_VERSION_MAJOR = @PIXMAN_VERSION_MAJOR@ +PIXMAN_VERSION_MICRO = @PIXMAN_VERSION_MICRO@ +PIXMAN_VERSION_MINOR = @PIXMAN_VERSION_MINOR@ +PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SSE_CFLAGS = @SSE_CFLAGS@ STRIP = @STRIP@ USE_MMX_FALSE = @USE_MMX_FALSE@ USE_MMX_TRUE = @USE_MMX_TRUE@ +USE_SSE2_FALSE = @USE_SSE2_FALSE@ +USE_SSE2_TRUE = @USE_SSE2_TRUE@ USE_SSE_FALSE = @USE_SSE_FALSE@ USE_SSE_TRUE = @USE_SSE_TRUE@ VERSION = @VERSION@ @@ -148,6 +158,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -187,11 +198,13 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ @HAVE_GTK_TRUE@TESTPROGRAMS = \ @HAVE_GTK_TRUE@ composite-test \ -@HAVE_GTK_TRUE@ gradient-test +@HAVE_GTK_TRUE@ gradient-test \ +@HAVE_GTK_TRUE@ fetch-test @HAVE_GTK_TRUE@INCLUDES = -I$(top_srcdir)/pixman $(GTK_CFLAGS) @HAVE_GTK_TRUE@composite_test_LDADD = $(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS) @HAVE_GTK_TRUE@gradient_test_LDADD = $(top_builddir)/pixman/libpixman-1.la $(GTK_LIBS) +@HAVE_GTK_TRUE@fetch_test_LDADD = $(top_builddir)/pixman/libpixman-1.la all: all-am .SUFFIXES: @@ -235,6 +248,9 @@ clean-noinstPROGRAMS: composite-test$(EXEEXT): $(composite_test_OBJECTS) $(composite_test_DEPENDENCIES) @rm -f composite-test$(EXEEXT) $(LINK) $(composite_test_LDFLAGS) $(composite_test_OBJECTS) $(composite_test_LDADD) $(LIBS) +fetch-test$(EXEEXT): $(fetch_test_OBJECTS) $(fetch_test_DEPENDENCIES) + @rm -f fetch-test$(EXEEXT) + $(LINK) $(fetch_test_LDFLAGS) $(fetch_test_OBJECTS) $(fetch_test_LDADD) $(LIBS) gradient-test$(EXEEXT): $(gradient_test_OBJECTS) $(gradient_test_DEPENDENCIES) @rm -f gradient-test$(EXEEXT) $(LINK) $(gradient_test_LDFLAGS) $(gradient_test_OBJECTS) $(gradient_test_LDADD) $(LIBS) @@ -246,6 +262,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/composite-test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fetch-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradient-test.Po@am__quote@ .c.o: |