aboutsummaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-11-19 10:38:33 +0100
committermarha <marha@users.sourceforge.net>2012-11-19 10:38:33 +0100
commit24635abae6008bef13e30d798b3f33abab412770 (patch)
treee799fbde24e0fd935af76b0bc48d30ef69f75d54 /pixman
parente0844ae8b5ef87049537a7e0ebff81acc2695256 (diff)
parent6ce1d8f0f8c23e186175a7c84c21d7bfbe168dc5 (diff)
downloadvcxsrv-24635abae6008bef13e30d798b3f33abab412770.tar.gz
vcxsrv-24635abae6008bef13e30d798b3f33abab412770.tar.bz2
vcxsrv-24635abae6008bef13e30d798b3f33abab412770.zip
Merge remote-tracking branch 'origin/released'
* origin/released: Changed file permissions dos -> unix Conflicts: libX11/include/X11/Xregion.h libX11/src/ConvSel.c libX11/src/CrGlCur.c libX11/src/CrWindow.c libX11/src/GetDflt.c libX11/src/StrKeysym.c libX11/src/Window.c libX11/src/xkb/XKBBind.c libX11/src/xkb/XKBGetMap.c libX11/src/xkb/XKBSetGeom.c libX11/src/xkb/XKBUse.c libX11/src/xlibi18n/XimProto.h libX11/src/xlibi18n/lcDynamic.c libXdmcp/Key.c libXdmcp/Write.c libxcb/src/xcb_windefs.h xkbcomp/keycodes.c xkbcomp/xkbpath.c xorg-server/hw/xwin/glx/winpriv.h xorg-server/xkeyboard-config/rules/bin/ml1_s.sh xorg-server/xkeyboard-config/rules/bin/ml1v1_s.sh xorg-server/xkeyboard-config/rules/bin/ml1v_s.sh xorg-server/xkeyboard-config/rules/bin/ml_s.sh xorg-server/xkeyboard-config/rules/bin/mln_s.sh xorg-server/xkeyboard-config/rules/bin/mlnvn_s.sh xorg-server/xkeyboard-config/rules/bin/mlv_s.sh xorg-server/xkeyboard-config/rules/compat/.gitignore
Diffstat (limited to 'pixman')
-rw-r--r--pixman/CODING_STYLE398
-rw-r--r--pixman/INSTALL468
-rw-r--r--pixman/README44
-rw-r--r--pixman/pixman-1-uninstalled.pc.in10
-rw-r--r--pixman/pixman/pixman-access-accessors.c6
-rw-r--r--pixman/pixman/pixman-edge-accessors.c8
-rw-r--r--pixman/pixman/pixman-edge-imp.h364
-rw-r--r--pixman/pixman/pixman-edge.c768
-rw-r--r--pixman/pixman/pixman-region16.c134
-rw-r--r--pixman/pixman/pixman-region32.c94
-rw-r--r--pixman/pixman/pixman-timer.c132
-rw-r--r--pixman/pixman/pixman-version.h.in100
-rw-r--r--pixman/pixman/refactor956
-rw-r--r--pixman/pixman/solaris-hwcap.mapfile60
-rw-r--r--pixman/test/alpha-loop.c58
-rw-r--r--pixman/test/region-test.c246
16 files changed, 1923 insertions, 1923 deletions
diff --git a/pixman/CODING_STYLE b/pixman/CODING_STYLE
index 28dcf956e..9f5171d10 100644
--- a/pixman/CODING_STYLE
+++ b/pixman/CODING_STYLE
@@ -1,199 +1,199 @@
-Pixman coding style.
-====================
-
-The pixman coding style is close to cairo's with one exception: braces
-go on their own line, rather than on the line of the if/while/for:
-
- if (condition)
- {
- do_something();
- do_something_else();
- }
-
-not
-
- if (condition) {
- do_something();
- do_something_else();
- }
-
-
-
-Indentation
-===========
-
-Each new level is indented four spaces:
-
- if (condition)
- do_something();
-
-This may be achieved with space characters or with a combination of
-tab characters and space characters. Tab characters are interpreted as
-
- Advance to the next column which is a multiple of 8.
-
-
-Names
-=====
-
-In all names, words are separated with underscores. Do not use
-CamelCase for any names.
-
-Macros have ALL_CAPITAL_NAMES
-
-Type names are in lower case and end with "_t". For example
-pixman_image_t.
-
-Labels, functions and variables have lower case names.
-
-
-Braces
-======
-
-Braces always go on their own line:
-
- if (condition)
- {
- do_this ();
- do_that ();
- }
- else
- {
- do_the_other ();
- }
-
-Rules for braces and substatements of if/while/for/do:
-
-* If a substatement spans multiple lines, then there must be braces
- around it.
-
-* If the condition of an if/while/for spans multiple lines, then
- braces must be used for the substatements.
-
-* If one substatement of an if statement has braces, then the other
- must too.
-
-* Otherwise, don't add braces.
-
-
-Comments
-========
-
-For comments either like this:
-
- /* One line comment */
-
-or like this:
-
- /* This is a multi-line comment
- *
- * It extends over multiple lines
- */
-
-Generally comments should say things that aren't clear from the code
-itself. If too many comments say obvious things, then people will just
-stop reading all comments, including the good ones.
-
-
-Whitespace
-==========
-
-* Put a single space after commas
-
-* Put spaces around arithmetic operators such a +, -, *, /:
-
- y * stride + x
-
- x / unit_x
-
-* Do not put spaces after the address-of operator, the * when used as
- a pointer derefernce or the ! and ~ operators:
-
- &foo;
-
- ~0x00000000
-
- !condition
-
- *result = 100
-
-* Break up long lines (> ~80 characters) and use whitespace to align
- things nicely. This is one way:
-
- some_very_long_function name (
- implementation, op, src, mask, dest,
- src_x, src_y, mask_x, mask_y, dest_x, dest_y,
- width, height);
-
- This is another:
-
- some_very_long_function_name (implementation, op,
- src, mask, dest,
- src_x, src_y,
- mask_x, mask_y,
- dest_x, dest_y,
- width, height);
-
-* Separate logically distinct chunks with a single newline. This
- obviously applies between functions, but also applies within a
- function or block or structure definition.
-
-* Use a newline after a block of variable declarations.
-
-* Use a single space before a left parenthesis, except where the
- standard will not allow it, (eg. when defining a parameterized macro).
-
-* Don't eliminate newlines just because things would still fit on one
- line. This breaks the expected visual structure of the code making
- it much harder to read and understand:
-
- if (condition) foo (); else bar (); /* Yuck! */
-
-
-Function Definitions
-====================
-
-Function definitions should take the following form:
-
- void
- my_function (int argument)
- {
- do_my_things ();
- }
-
-If all the parameters to a function fit naturally on one line, format
-them that way. Otherwise, put one argument on each line, adding
-whitespace so that the parameter names are aligned with each other.
-
-I.e., do either this:
-
- void
- short_arguments (const char *str, int x, int y, int z)
- {
- }
-
-or this:
-
- void
- long_arguments (const char *char_star_arg,
- int int_arg,
- double *double_star_arg,
- double double_arg)
- {
- }
-
-
-Mode lines
-==========
-
-Given the rules above, what is the best way to simplify one's life as
-a code monkey? Get your editor to do most of the tedious work of
-beautifying your code!
-
-As a reward for reading this far, here are some mode lines for the more
-popular editors:
-/*
- * vim:sw=4:sts=4:ts=8:tw=78:fo=tcroq:cindent:cino=\:0,(0
- * vim:isk=a-z,A-Z,48-57,_,.,-,>
- */
-
+Pixman coding style.
+====================
+
+The pixman coding style is close to cairo's with one exception: braces
+go on their own line, rather than on the line of the if/while/for:
+
+ if (condition)
+ {
+ do_something();
+ do_something_else();
+ }
+
+not
+
+ if (condition) {
+ do_something();
+ do_something_else();
+ }
+
+
+
+Indentation
+===========
+
+Each new level is indented four spaces:
+
+ if (condition)
+ do_something();
+
+This may be achieved with space characters or with a combination of
+tab characters and space characters. Tab characters are interpreted as
+
+ Advance to the next column which is a multiple of 8.
+
+
+Names
+=====
+
+In all names, words are separated with underscores. Do not use
+CamelCase for any names.
+
+Macros have ALL_CAPITAL_NAMES
+
+Type names are in lower case and end with "_t". For example
+pixman_image_t.
+
+Labels, functions and variables have lower case names.
+
+
+Braces
+======
+
+Braces always go on their own line:
+
+ if (condition)
+ {
+ do_this ();
+ do_that ();
+ }
+ else
+ {
+ do_the_other ();
+ }
+
+Rules for braces and substatements of if/while/for/do:
+
+* If a substatement spans multiple lines, then there must be braces
+ around it.
+
+* If the condition of an if/while/for spans multiple lines, then
+ braces must be used for the substatements.
+
+* If one substatement of an if statement has braces, then the other
+ must too.
+
+* Otherwise, don't add braces.
+
+
+Comments
+========
+
+For comments either like this:
+
+ /* One line comment */
+
+or like this:
+
+ /* This is a multi-line comment
+ *
+ * It extends over multiple lines
+ */
+
+Generally comments should say things that aren't clear from the code
+itself. If too many comments say obvious things, then people will just
+stop reading all comments, including the good ones.
+
+
+Whitespace
+==========
+
+* Put a single space after commas
+
+* Put spaces around arithmetic operators such a +, -, *, /:
+
+ y * stride + x
+
+ x / unit_x
+
+* Do not put spaces after the address-of operator, the * when used as
+ a pointer derefernce or the ! and ~ operators:
+
+ &foo;
+
+ ~0x00000000
+
+ !condition
+
+ *result = 100
+
+* Break up long lines (> ~80 characters) and use whitespace to align
+ things nicely. This is one way:
+
+ some_very_long_function name (
+ implementation, op, src, mask, dest,
+ src_x, src_y, mask_x, mask_y, dest_x, dest_y,
+ width, height);
+
+ This is another:
+
+ some_very_long_function_name (implementation, op,
+ src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height);
+
+* Separate logically distinct chunks with a single newline. This
+ obviously applies between functions, but also applies within a
+ function or block or structure definition.
+
+* Use a newline after a block of variable declarations.
+
+* Use a single space before a left parenthesis, except where the
+ standard will not allow it, (eg. when defining a parameterized macro).
+
+* Don't eliminate newlines just because things would still fit on one
+ line. This breaks the expected visual structure of the code making
+ it much harder to read and understand:
+
+ if (condition) foo (); else bar (); /* Yuck! */
+
+
+Function Definitions
+====================
+
+Function definitions should take the following form:
+
+ void
+ my_function (int argument)
+ {
+ do_my_things ();
+ }
+
+If all the parameters to a function fit naturally on one line, format
+them that way. Otherwise, put one argument on each line, adding
+whitespace so that the parameter names are aligned with each other.
+
+I.e., do either this:
+
+ void
+ short_arguments (const char *str, int x, int y, int z)
+ {
+ }
+
+or this:
+
+ void
+ long_arguments (const char *char_star_arg,
+ int int_arg,
+ double *double_star_arg,
+ double double_arg)
+ {
+ }
+
+
+Mode lines
+==========
+
+Given the rules above, what is the best way to simplify one's life as
+a code monkey? Get your editor to do most of the tedious work of
+beautifying your code!
+
+As a reward for reading this far, here are some mode lines for the more
+popular editors:
+/*
+ * vim:sw=4:sts=4:ts=8:tw=78:fo=tcroq:cindent:cino=\:0,(0
+ * vim:isk=a-z,A-Z,48-57,_,.,-,>
+ */
+
diff --git a/pixman/INSTALL b/pixman/INSTALL
index cf1202b66..5458714e1 100644
--- a/pixman/INSTALL
+++ b/pixman/INSTALL
@@ -1,234 +1,234 @@
-Installation Instructions
-*************************
-
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006 Free Software Foundation, Inc.
-
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
-
-Basic Installation
-==================
-
-Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package. The following
-more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
-
- It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
- The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system.
-
- Running `configure' might take a while. While running, it prints
- some messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about. Run `./configure --help' for
-details on some of the pertinent environment variables.
-
- You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment. Here
-is an example:
-
- ./configure CC=c99 CFLAGS=-g LIBS=-lposix
-
- *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
-You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you can use GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- With a non-GNU `make', it is safer to compile the package for one
-architecture at a time in the source code directory. After you have
-installed the package for one architecture, use `make distclean' before
-reconfiguring for another architecture.
-
-Installation Names
-==================
-
-By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc. You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
-PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
-Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
-`--build=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
- CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
- OS KERNEL-OS
-
- See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
- If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
-produce code for.
-
- If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
-Variables not defined in a site shell script can be set in the
-environment passed to `configure'. However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost. In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'. For example:
-
- ./configure CC=/usr/local2/bin/gcc
-
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).
-
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug. Until the bug is fixed you can use this workaround:
-
- CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-`configure' Invocation
-======================
-
-`configure' recognizes the following options to control how it operates.
-
-`--help'
-`-h'
- Print a summary of the options to `configure', and exit.
-
-`--version'
-`-V'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`--cache-file=FILE'
- Enable the cache: use and save the results of the tests in FILE,
- traditionally `config.cache'. FILE defaults to `/dev/null' to
- disable caching.
-
-`--config-cache'
-`-C'
- Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`configure' also accepts some other, not widely useful, options. Run
-`configure --help' for more details.
-
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/pixman/README b/pixman/README
index f3c02e4cd..3cfbc5053 100644
--- a/pixman/README
+++ b/pixman/README
@@ -1,22 +1,22 @@
-pixman is a library that provides low-level pixel manipulation
-features such as image compositing and trapezoid rasterization.
-
-All questions regarding this software should be directed to the pixman
-mailing list:
-
- http://lists.freedesktop.org/mailman/listinfo/pixman
-
-Please send patches and bug reports either to the mailing list above,
-or file them at the freedesktop bug tracker:
-
- https://bugs.freedesktop.org/enter_bug.cgi?product=pixman
-
-The master development code repository can be found at:
-
- git://anongit.freedesktop.org/git/pixman
-
- http://gitweb.freedesktop.org/?p=pixman;a=summary
-
-For more information on the git code manager, see:
-
- http://wiki.x.org/wiki/GitPage
+pixman is a library that provides low-level pixel manipulation
+features such as image compositing and trapezoid rasterization.
+
+All questions regarding this software should be directed to the pixman
+mailing list:
+
+ http://lists.freedesktop.org/mailman/listinfo/pixman
+
+Please send patches and bug reports either to the mailing list above,
+or file them at the freedesktop bug tracker:
+
+ https://bugs.freedesktop.org/enter_bug.cgi?product=pixman
+
+The master development code repository can be found at:
+
+ git://anongit.freedesktop.org/git/pixman
+
+ http://gitweb.freedesktop.org/?p=pixman;a=summary
+
+For more information on the git code manager, see:
+
+ http://wiki.x.org/wiki/GitPage
diff --git a/pixman/pixman-1-uninstalled.pc.in b/pixman/pixman-1-uninstalled.pc.in
index c15e86547..e0347d010 100644
--- a/pixman/pixman-1-uninstalled.pc.in
+++ b/pixman/pixman-1-uninstalled.pc.in
@@ -1,5 +1,5 @@
-Name: Pixman
-Description: The pixman library (version 1)
-Version: @PACKAGE_VERSION@
-Cflags: -I${pc_top_builddir}/${pcfiledir}/pixman
-Libs: ${pc_top_builddir}/${pcfiledir}/pixman/libpixman-1.la
+Name: Pixman
+Description: The pixman library (version 1)
+Version: @PACKAGE_VERSION@
+Cflags: -I${pc_top_builddir}/${pcfiledir}/pixman
+Libs: ${pc_top_builddir}/${pcfiledir}/pixman/libpixman-1.la
diff --git a/pixman/pixman/pixman-access-accessors.c b/pixman/pixman/pixman-access-accessors.c
index bde67a70e..3263582f1 100644
--- a/pixman/pixman/pixman-access-accessors.c
+++ b/pixman/pixman/pixman-access-accessors.c
@@ -1,3 +1,3 @@
-#define PIXMAN_FB_ACCESSORS
-
-#include "pixman-access.c"
+#define PIXMAN_FB_ACCESSORS
+
+#include "pixman-access.c"
diff --git a/pixman/pixman/pixman-edge-accessors.c b/pixman/pixman/pixman-edge-accessors.c
index 0f2c56e74..ea3a31e2f 100644
--- a/pixman/pixman/pixman-edge-accessors.c
+++ b/pixman/pixman/pixman-edge-accessors.c
@@ -1,4 +1,4 @@
-
-#define PIXMAN_FB_ACCESSORS
-
-#include "pixman-edge.c"
+
+#define PIXMAN_FB_ACCESSORS
+
+#include "pixman-edge.c"
diff --git a/pixman/pixman/pixman-edge-imp.h b/pixman/pixman/pixman-edge-imp.h
index 20ffda896..a4698eddb 100644
--- a/pixman/pixman/pixman-edge-imp.h
+++ b/pixman/pixman/pixman-edge-imp.h
@@ -1,182 +1,182 @@
-/*
- * Copyright © 2004 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef rasterize_span
-#endif
-
-static void
-RASTERIZE_EDGES (pixman_image_t *image,
- pixman_edge_t *l,
- pixman_edge_t *r,
- pixman_fixed_t t,
- pixman_fixed_t b)
-{
- pixman_fixed_t y = t;
- uint32_t *line;
- 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 (;;)
- {
- pixman_fixed_t lx;
- pixman_fixed_t rx;
- int lxi;
- int rxi;
-
- lx = l->x;
- rx = r->x;
-#if N_BITS == 1
- /* For the non-antialiased case, round the coordinates up, in effect
- * sampling just slightly to the left of the pixel. This is so that
- * when the sample point lies exactly on the line, we round towards
- * north-west.
- *
- * (The AA case does a similar adjustment in RENDER_SAMPLES_X)
- */
- lx += X_FRAC_FIRST(1) - pixman_fixed_e;
- rx += X_FRAC_FIRST(1) - pixman_fixed_e;
-#endif
- /* clip X */
- if (lx < 0)
- lx = 0;
- 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
- {
-
-#define LEFT_MASK(x) \
- (((x) & 0x1f) ? \
- SCREEN_SHIFT_RIGHT (0xffffffff, (x) & 0x1f) : 0)
-#define RIGHT_MASK(x) \
- (((32 - (x)) & 0x1f) ? \
- SCREEN_SHIFT_LEFT (0xffffffff, (32 - (x)) & 0x1f) : 0)
-
-#define MASK_BITS(x,w,l,n,r) { \
- n = (w); \
- r = RIGHT_MASK ((x) + n); \
- l = LEFT_MASK (x); \
- if (l) { \
- n -= 32 - ((x) & 0x1f); \
- if (n < 0) { \
- n = 0; \
- l &= r; \
- r = 0; \
- } \
- } \
- n >>= 5; \
- }
-
- uint32_t *a = line;
- uint32_t startmask;
- uint32_t endmask;
- int nmiddle;
- int width = rxi - lxi;
- int x = lxi;
-
- a += x >> 5;
- x &= 0x1f;
-
- MASK_BITS (x, width, startmask, nmiddle, endmask);
-
- if (startmask) {
- WRITE(image, a, READ(image, a) | startmask);
- a++;
- }
- while (nmiddle--)
- WRITE(image, a++, 0xffffffff);
- if (endmask)
- WRITE(image, a, READ(image, a) | endmask);
- }
-#else
- {
- DEFINE_ALPHA(line,lxi);
- int lxs;
- int rxs;
-
- /* Sample coverage for edge pixels */
- lxs = RENDER_SAMPLES_X (lx, N_BITS);
- rxs = RENDER_SAMPLES_X (rx, N_BITS);
-
- /* Add coverage across row */
- if (lxi == rxi)
- {
- ADD_ALPHA (rxs - lxs);
- }
- else
- {
- int xi;
-
- ADD_ALPHA (N_X_FRAC(N_BITS) - lxs);
- STEP_ALPHA;
- for (xi = lxi + 1; xi < rxi; xi++)
- {
- ADD_ALPHA (N_X_FRAC(N_BITS));
- STEP_ALPHA;
- }
- ADD_ALPHA (rxs);
- }
- }
-#endif
- }
-
- if (y == b)
- break;
-
-#if N_BITS > 1
- if (pixman_fixed_frac (y) != Y_FRAC_LAST(N_BITS))
- {
- RENDER_EDGE_STEP_SMALL (l);
- RENDER_EDGE_STEP_SMALL (r);
- y += STEP_Y_SMALL(N_BITS);
- }
- else
-#endif
- {
- RENDER_EDGE_STEP_BIG (l);
- RENDER_EDGE_STEP_BIG (r);
- y += STEP_Y_BIG(N_BITS);
- line += stride;
- }
- }
-}
-
-#undef rasterize_span
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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 CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef rasterize_span
+#endif
+
+static void
+RASTERIZE_EDGES (pixman_image_t *image,
+ pixman_edge_t *l,
+ pixman_edge_t *r,
+ pixman_fixed_t t,
+ pixman_fixed_t b)
+{
+ pixman_fixed_t y = t;
+ uint32_t *line;
+ 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 (;;)
+ {
+ pixman_fixed_t lx;
+ pixman_fixed_t rx;
+ int lxi;
+ int rxi;
+
+ lx = l->x;
+ rx = r->x;
+#if N_BITS == 1
+ /* For the non-antialiased case, round the coordinates up, in effect
+ * sampling just slightly to the left of the pixel. This is so that
+ * when the sample point lies exactly on the line, we round towards
+ * north-west.
+ *
+ * (The AA case does a similar adjustment in RENDER_SAMPLES_X)
+ */
+ lx += X_FRAC_FIRST(1) - pixman_fixed_e;
+ rx += X_FRAC_FIRST(1) - pixman_fixed_e;
+#endif
+ /* clip X */
+ if (lx < 0)
+ lx = 0;
+ 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
+ {
+
+#define LEFT_MASK(x) \
+ (((x) & 0x1f) ? \
+ SCREEN_SHIFT_RIGHT (0xffffffff, (x) & 0x1f) : 0)
+#define RIGHT_MASK(x) \
+ (((32 - (x)) & 0x1f) ? \
+ SCREEN_SHIFT_LEFT (0xffffffff, (32 - (x)) & 0x1f) : 0)
+
+#define MASK_BITS(x,w,l,n,r) { \
+ n = (w); \
+ r = RIGHT_MASK ((x) + n); \
+ l = LEFT_MASK (x); \
+ if (l) { \
+ n -= 32 - ((x) & 0x1f); \
+ if (n < 0) { \
+ n = 0; \
+ l &= r; \
+ r = 0; \
+ } \
+ } \
+ n >>= 5; \
+ }
+
+ uint32_t *a = line;
+ uint32_t startmask;
+ uint32_t endmask;
+ int nmiddle;
+ int width = rxi - lxi;
+ int x = lxi;
+
+ a += x >> 5;
+ x &= 0x1f;
+
+ MASK_BITS (x, width, startmask, nmiddle, endmask);
+
+ if (startmask) {
+ WRITE(image, a, READ(image, a) | startmask);
+ a++;
+ }
+ while (nmiddle--)
+ WRITE(image, a++, 0xffffffff);
+ if (endmask)
+ WRITE(image, a, READ(image, a) | endmask);
+ }
+#else
+ {
+ DEFINE_ALPHA(line,lxi);
+ int lxs;
+ int rxs;
+
+ /* Sample coverage for edge pixels */
+ lxs = RENDER_SAMPLES_X (lx, N_BITS);
+ rxs = RENDER_SAMPLES_X (rx, N_BITS);
+
+ /* Add coverage across row */
+ if (lxi == rxi)
+ {
+ ADD_ALPHA (rxs - lxs);
+ }
+ else
+ {
+ int xi;
+
+ ADD_ALPHA (N_X_FRAC(N_BITS) - lxs);
+ STEP_ALPHA;
+ for (xi = lxi + 1; xi < rxi; xi++)
+ {
+ ADD_ALPHA (N_X_FRAC(N_BITS));
+ STEP_ALPHA;
+ }
+ ADD_ALPHA (rxs);
+ }
+ }
+#endif
+ }
+
+ if (y == b)
+ break;
+
+#if N_BITS > 1
+ if (pixman_fixed_frac (y) != Y_FRAC_LAST(N_BITS))
+ {
+ RENDER_EDGE_STEP_SMALL (l);
+ RENDER_EDGE_STEP_SMALL (r);
+ y += STEP_Y_SMALL(N_BITS);
+ }
+ else
+#endif
+ {
+ RENDER_EDGE_STEP_BIG (l);
+ RENDER_EDGE_STEP_BIG (r);
+ y += STEP_Y_BIG(N_BITS);
+ line += stride;
+ }
+ }
+}
+
+#undef rasterize_span
diff --git a/pixman/pixman/pixman-edge.c b/pixman/pixman/pixman-edge.c
index 22b0158ba..8d498ab44 100644
--- a/pixman/pixman/pixman-edge.c
+++ b/pixman/pixman/pixman-edge.c
@@ -1,384 +1,384 @@
-/*
- * Copyright © 2004 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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 CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "pixman-private.h"
-#include "pixman-accessor.h"
-
-/*
- * Step across a small sample grid gap
- */
-#define RENDER_EDGE_STEP_SMALL(edge) \
- { \
- edge->x += edge->stepx_small; \
- edge->e += edge->dx_small; \
- if (edge->e > 0) \
- { \
- edge->e -= edge->dy; \
- edge->x += edge->signdx; \
- } \
- }
-
-/*
- * Step across a large sample grid gap
- */
-#define RENDER_EDGE_STEP_BIG(edge) \
- { \
- edge->x += edge->stepx_big; \
- edge->e += edge->dx_big; \
- if (edge->e > 0) \
- { \
- edge->e -= edge->dy; \
- edge->x += edge->signdx; \
- } \
- }
-
-#ifdef PIXMAN_FB_ACCESSORS
-#define PIXMAN_RASTERIZE_EDGES pixman_rasterize_edges_accessors
-#else
-#define PIXMAN_RASTERIZE_EDGES pixman_rasterize_edges_no_accessors
-#endif
-
-/*
- * 4 bit alpha
- */
-
-#define N_BITS 4
-#define RASTERIZE_EDGES rasterize_edges_4
-
-#ifndef WORDS_BIGENDIAN
-#define SHIFT_4(o) ((o) << 2)
-#else
-#define SHIFT_4(o) ((1 - (o)) << 2)
-#endif
-
-#define GET_4(x, o) (((x) >> SHIFT_4 (o)) & 0xf)
-#define PUT_4(x, o, v) \
- (((x) & ~(0xf << SHIFT_4 (o))) | (((v) & 0xf) << SHIFT_4 (o)))
-
-#define DEFINE_ALPHA(line, x) \
- uint8_t *__ap = (uint8_t *) line + ((x) >> 1); \
- int __ao = (x) & 1
-
-#define STEP_ALPHA ((__ap += __ao), (__ao ^= 1))
-
-#define ADD_ALPHA(a) \
- { \
- uint8_t __o = READ (image, __ap); \
- uint8_t __a = (a) + GET_4 (__o, __ao); \
- WRITE (image, __ap, PUT_4 (__o, __ao, __a | (0 - ((__a) >> 4)))); \
- }
-
-#include "pixman-edge-imp.h"
-
-#undef ADD_ALPHA
-#undef STEP_ALPHA
-#undef DEFINE_ALPHA
-#undef RASTERIZE_EDGES
-#undef N_BITS
-
-
-/*
- * 1 bit alpha
- */
-
-#define N_BITS 1
-#define RASTERIZE_EDGES rasterize_edges_1
-
-#include "pixman-edge-imp.h"
-
-#undef RASTERIZE_EDGES
-#undef N_BITS
-
-/*
- * 8 bit alpha
- */
-
-static force_inline uint8_t
-clip255 (int x)
-{
- if (x > 255)
- return 255;
-
- return x;
-}
-
-#define ADD_SATURATE_8(buf, val, length) \
- do \
- { \
- int i__ = (length); \
- uint8_t *buf__ = (buf); \
- int val__ = (val); \
- \
- while (i__--) \
- { \
- WRITE (image, (buf__), clip255 (READ (image, (buf__)) + (val__))); \
- (buf__)++; \
- } \
- } while (0)
-
-/*
- * We want to detect the case where we add the same value to a long
- * span of pixels. The triangles on the end are filled in while we
- * count how many sub-pixel scanlines contribute to the middle section.
- *
- * +--------------------------+
- * fill_height =| \ /
- * +------------------+
- * |================|
- * fill_start fill_end
- */
-static void
-rasterize_edges_8 (pixman_image_t *image,
- pixman_edge_t * l,
- pixman_edge_t * r,
- pixman_fixed_t t,
- pixman_fixed_t b)
-{
- pixman_fixed_t y = t;
- uint32_t *line;
- int fill_start = -1, fill_end = -1;
- int fill_size = 0;
- 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)
- {
- /* 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 = RENDER_SAMPLES_X (lx, 8);
- rxs = RENDER_SAMPLES_X (rx, 8);
-
- /* Add coverage across row */
- if (lxi == rxi)
- {
- WRITE (image, ap + lxi,
- clip255 (READ (image, ap + lxi) + rxs - lxs));
- }
- else
- {
- 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)
- {
- if (fill_start < 0)
- {
- fill_start = lxi;
- fill_end = rxi;
- fill_size++;
- }
- else
- {
- if (lxi >= fill_end || rxi < fill_start)
- {
- /* We're beyond what we saved, just fill it */
- ADD_SATURATE_8 (ap + fill_start,
- fill_size * N_X_FRAC (8),
- fill_end - fill_start);
- fill_start = lxi;
- fill_end = rxi;
- fill_size = 1;
- }
- else
- {
- /* Update fill_start */
- if (lxi > fill_start)
- {
- ADD_SATURATE_8 (ap + fill_start,
- fill_size * N_X_FRAC (8),
- lxi - fill_start);
- fill_start = lxi;
- }
- else if (lxi < fill_start)
- {
- ADD_SATURATE_8 (ap + lxi, N_X_FRAC (8),
- fill_start - lxi);
- }
-
- /* Update fill_end */
- if (rxi < fill_end)
- {
- ADD_SATURATE_8 (ap + rxi,
- fill_size * N_X_FRAC (8),
- fill_end - rxi);
- fill_end = rxi;
- }
- else if (fill_end < rxi)
- {
- ADD_SATURATE_8 (ap + fill_end,
- N_X_FRAC (8),
- rxi - fill_end);
- }
- fill_size++;
- }
- }
- }
- else
- {
- ADD_SATURATE_8 (ap + lxi, N_X_FRAC (8), rxi - lxi);
- }
-
- 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 (image, ap + fill_start,
- 0xff, fill_end - fill_start);
- }
- else
- {
- ADD_SATURATE_8 (ap + fill_start, fill_size * N_X_FRAC (8),
- fill_end - fill_start);
- }
- }
- break;
- }
-
- if (pixman_fixed_frac (y) != Y_FRAC_LAST (8))
- {
- RENDER_EDGE_STEP_SMALL (l);
- RENDER_EDGE_STEP_SMALL (r);
- y += STEP_Y_SMALL (8);
- }
- else
- {
- RENDER_EDGE_STEP_BIG (l);
- RENDER_EDGE_STEP_BIG (r);
- y += STEP_Y_BIG (8);
- if (fill_start != fill_end)
- {
- if (fill_size == N_Y_FRAC (8))
- {
- MEMSET_WRAPPED (image, ap + fill_start,
- 0xff, fill_end - fill_start);
- }
- else
- {
- ADD_SATURATE_8 (ap + fill_start, fill_size * N_X_FRAC (8),
- fill_end - fill_start);
- }
-
- fill_start = fill_end = -1;
- fill_size = 0;
- }
-
- line += stride;
- }
- }
-}
-
-#ifndef PIXMAN_FB_ACCESSORS
-static
-#endif
-void
-PIXMAN_RASTERIZE_EDGES (pixman_image_t *image,
- pixman_edge_t * l,
- pixman_edge_t * r,
- pixman_fixed_t t,
- pixman_fixed_t b)
-{
- switch (PIXMAN_FORMAT_BPP (image->bits.format))
- {
- case 1:
- rasterize_edges_1 (image, l, r, t, b);
- break;
-
- case 4:
- rasterize_edges_4 (image, l, r, t, b);
- break;
-
- case 8:
- rasterize_edges_8 (image, l, r, t, b);
- break;
-
- default:
- break;
- }
-}
-
-#ifndef PIXMAN_FB_ACCESSORS
-
-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)
-{
- return_if_fail (image->type == BITS);
-
- if (image->bits.read_func || image->bits.write_func)
- pixman_rasterize_edges_accessors (image, l, r, t, b);
- else
- pixman_rasterize_edges_no_accessors (image, l, r, t, b);
-}
-
-#endif
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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 CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include "pixman-private.h"
+#include "pixman-accessor.h"
+
+/*
+ * Step across a small sample grid gap
+ */
+#define RENDER_EDGE_STEP_SMALL(edge) \
+ { \
+ edge->x += edge->stepx_small; \
+ edge->e += edge->dx_small; \
+ if (edge->e > 0) \
+ { \
+ edge->e -= edge->dy; \
+ edge->x += edge->signdx; \
+ } \
+ }
+
+/*
+ * Step across a large sample grid gap
+ */
+#define RENDER_EDGE_STEP_BIG(edge) \
+ { \
+ edge->x += edge->stepx_big; \
+ edge->e += edge->dx_big; \
+ if (edge->e > 0) \
+ { \
+ edge->e -= edge->dy; \
+ edge->x += edge->signdx; \
+ } \
+ }
+
+#ifdef PIXMAN_FB_ACCESSORS
+#define PIXMAN_RASTERIZE_EDGES pixman_rasterize_edges_accessors
+#else
+#define PIXMAN_RASTERIZE_EDGES pixman_rasterize_edges_no_accessors
+#endif
+
+/*
+ * 4 bit alpha
+ */
+
+#define N_BITS 4
+#define RASTERIZE_EDGES rasterize_edges_4
+
+#ifndef WORDS_BIGENDIAN
+#define SHIFT_4(o) ((o) << 2)
+#else
+#define SHIFT_4(o) ((1 - (o)) << 2)
+#endif
+
+#define GET_4(x, o) (((x) >> SHIFT_4 (o)) & 0xf)
+#define PUT_4(x, o, v) \
+ (((x) & ~(0xf << SHIFT_4 (o))) | (((v) & 0xf) << SHIFT_4 (o)))
+
+#define DEFINE_ALPHA(line, x) \
+ uint8_t *__ap = (uint8_t *) line + ((x) >> 1); \
+ int __ao = (x) & 1
+
+#define STEP_ALPHA ((__ap += __ao), (__ao ^= 1))
+
+#define ADD_ALPHA(a) \
+ { \
+ uint8_t __o = READ (image, __ap); \
+ uint8_t __a = (a) + GET_4 (__o, __ao); \
+ WRITE (image, __ap, PUT_4 (__o, __ao, __a | (0 - ((__a) >> 4)))); \
+ }
+
+#include "pixman-edge-imp.h"
+
+#undef ADD_ALPHA
+#undef STEP_ALPHA
+#undef DEFINE_ALPHA
+#undef RASTERIZE_EDGES
+#undef N_BITS
+
+
+/*
+ * 1 bit alpha
+ */
+
+#define N_BITS 1
+#define RASTERIZE_EDGES rasterize_edges_1
+
+#include "pixman-edge-imp.h"
+
+#undef RASTERIZE_EDGES
+#undef N_BITS
+
+/*
+ * 8 bit alpha
+ */
+
+static force_inline uint8_t
+clip255 (int x)
+{
+ if (x > 255)
+ return 255;
+
+ return x;
+}
+
+#define ADD_SATURATE_8(buf, val, length) \
+ do \
+ { \
+ int i__ = (length); \
+ uint8_t *buf__ = (buf); \
+ int val__ = (val); \
+ \
+ while (i__--) \
+ { \
+ WRITE (image, (buf__), clip255 (READ (image, (buf__)) + (val__))); \
+ (buf__)++; \
+ } \
+ } while (0)
+
+/*
+ * We want to detect the case where we add the same value to a long
+ * span of pixels. The triangles on the end are filled in while we
+ * count how many sub-pixel scanlines contribute to the middle section.
+ *
+ * +--------------------------+
+ * fill_height =| \ /
+ * +------------------+
+ * |================|
+ * fill_start fill_end
+ */
+static void
+rasterize_edges_8 (pixman_image_t *image,
+ pixman_edge_t * l,
+ pixman_edge_t * r,
+ pixman_fixed_t t,
+ pixman_fixed_t b)
+{
+ pixman_fixed_t y = t;
+ uint32_t *line;
+ int fill_start = -1, fill_end = -1;
+ int fill_size = 0;
+ 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)
+ {
+ /* 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 = RENDER_SAMPLES_X (lx, 8);
+ rxs = RENDER_SAMPLES_X (rx, 8);
+
+ /* Add coverage across row */
+ if (lxi == rxi)
+ {
+ WRITE (image, ap + lxi,
+ clip255 (READ (image, ap + lxi) + rxs - lxs));
+ }
+ else
+ {
+ 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)
+ {
+ if (fill_start < 0)
+ {
+ fill_start = lxi;
+ fill_end = rxi;
+ fill_size++;
+ }
+ else
+ {
+ if (lxi >= fill_end || rxi < fill_start)
+ {
+ /* We're beyond what we saved, just fill it */
+ ADD_SATURATE_8 (ap + fill_start,
+ fill_size * N_X_FRAC (8),
+ fill_end - fill_start);
+ fill_start = lxi;
+ fill_end = rxi;
+ fill_size = 1;
+ }
+ else
+ {
+ /* Update fill_start */
+ if (lxi > fill_start)
+ {
+ ADD_SATURATE_8 (ap + fill_start,
+ fill_size * N_X_FRAC (8),
+ lxi - fill_start);
+ fill_start = lxi;
+ }
+ else if (lxi < fill_start)
+ {
+ ADD_SATURATE_8 (ap + lxi, N_X_FRAC (8),
+ fill_start - lxi);
+ }
+
+ /* Update fill_end */
+ if (rxi < fill_end)
+ {
+ ADD_SATURATE_8 (ap + rxi,
+ fill_size * N_X_FRAC (8),
+ fill_end - rxi);
+ fill_end = rxi;
+ }
+ else if (fill_end < rxi)
+ {
+ ADD_SATURATE_8 (ap + fill_end,
+ N_X_FRAC (8),
+ rxi - fill_end);
+ }
+ fill_size++;
+ }
+ }
+ }
+ else
+ {
+ ADD_SATURATE_8 (ap + lxi, N_X_FRAC (8), rxi - lxi);
+ }
+
+ 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 (image, ap + fill_start,
+ 0xff, fill_end - fill_start);
+ }
+ else
+ {
+ ADD_SATURATE_8 (ap + fill_start, fill_size * N_X_FRAC (8),
+ fill_end - fill_start);
+ }
+ }
+ break;
+ }
+
+ if (pixman_fixed_frac (y) != Y_FRAC_LAST (8))
+ {
+ RENDER_EDGE_STEP_SMALL (l);
+ RENDER_EDGE_STEP_SMALL (r);
+ y += STEP_Y_SMALL (8);
+ }
+ else
+ {
+ RENDER_EDGE_STEP_BIG (l);
+ RENDER_EDGE_STEP_BIG (r);
+ y += STEP_Y_BIG (8);
+ if (fill_start != fill_end)
+ {
+ if (fill_size == N_Y_FRAC (8))
+ {
+ MEMSET_WRAPPED (image, ap + fill_start,
+ 0xff, fill_end - fill_start);
+ }
+ else
+ {
+ ADD_SATURATE_8 (ap + fill_start, fill_size * N_X_FRAC (8),
+ fill_end - fill_start);
+ }
+
+ fill_start = fill_end = -1;
+ fill_size = 0;
+ }
+
+ line += stride;
+ }
+ }
+}
+
+#ifndef PIXMAN_FB_ACCESSORS
+static
+#endif
+void
+PIXMAN_RASTERIZE_EDGES (pixman_image_t *image,
+ pixman_edge_t * l,
+ pixman_edge_t * r,
+ pixman_fixed_t t,
+ pixman_fixed_t b)
+{
+ switch (PIXMAN_FORMAT_BPP (image->bits.format))
+ {
+ case 1:
+ rasterize_edges_1 (image, l, r, t, b);
+ break;
+
+ case 4:
+ rasterize_edges_4 (image, l, r, t, b);
+ break;
+
+ case 8:
+ rasterize_edges_8 (image, l, r, t, b);
+ break;
+
+ default:
+ break;
+ }
+}
+
+#ifndef PIXMAN_FB_ACCESSORS
+
+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)
+{
+ return_if_fail (image->type == BITS);
+
+ if (image->bits.read_func || image->bits.write_func)
+ pixman_rasterize_edges_accessors (image, l, r, t, b);
+ else
+ pixman_rasterize_edges_no_accessors (image, l, r, t, b);
+}
+
+#endif
diff --git a/pixman/pixman/pixman-region16.c b/pixman/pixman/pixman-region16.c
index 39d122590..d88d3380f 100644
--- a/pixman/pixman/pixman-region16.c
+++ b/pixman/pixman/pixman-region16.c
@@ -1,67 +1,67 @@
-/*
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Red Hat, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. Red Hat, Inc. makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Soren Sandmann <sandmann@redhat.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#undef PIXMAN_DISABLE_DEPRECATED
-
-#include "pixman-private.h"
-
-#include <stdlib.h>
-
-typedef pixman_box16_t box_type_t;
-typedef pixman_region16_data_t region_data_type_t;
-typedef pixman_region16_t region_type_t;
-typedef int32_t overflow_int_t;
-
-typedef struct {
- int x, y;
-} point_type_t;
-
-#define PREFIX(x) pixman_region##x
-
-#define PIXMAN_REGION_MAX INT16_MAX
-#define PIXMAN_REGION_MIN INT16_MIN
-
-#include "pixman-region.c"
-
-/* This function exists only to make it possible to preserve the X ABI -
- * it should go away at first opportunity.
- *
- * The problem is that the X ABI exports the three structs and has used
- * them through macros. So the X server calls this function with
- * the addresses of those structs which makes the existing code continue to
- * work.
- */
-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)
-{
- pixman_region_empty_box = empty_box;
- pixman_region_empty_data = empty_data;
- pixman_broken_data = broken_data;
-}
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Soren Sandmann <sandmann@redhat.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#undef PIXMAN_DISABLE_DEPRECATED
+
+#include "pixman-private.h"
+
+#include <stdlib.h>
+
+typedef pixman_box16_t box_type_t;
+typedef pixman_region16_data_t region_data_type_t;
+typedef pixman_region16_t region_type_t;
+typedef int32_t overflow_int_t;
+
+typedef struct {
+ int x, y;
+} point_type_t;
+
+#define PREFIX(x) pixman_region##x
+
+#define PIXMAN_REGION_MAX INT16_MAX
+#define PIXMAN_REGION_MIN INT16_MIN
+
+#include "pixman-region.c"
+
+/* This function exists only to make it possible to preserve the X ABI -
+ * it should go away at first opportunity.
+ *
+ * The problem is that the X ABI exports the three structs and has used
+ * them through macros. So the X server calls this function with
+ * the addresses of those structs which makes the existing code continue to
+ * work.
+ */
+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)
+{
+ pixman_region_empty_box = empty_box;
+ pixman_region_empty_data = empty_data;
+ pixman_broken_data = broken_data;
+}
diff --git a/pixman/pixman/pixman-region32.c b/pixman/pixman/pixman-region32.c
index ccab36050..abd6b1a93 100644
--- a/pixman/pixman/pixman-region32.c
+++ b/pixman/pixman/pixman-region32.c
@@ -1,47 +1,47 @@
-/*
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Red Hat, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. Red Hat, Inc. makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Soren Sandmann <sandmann@redhat.com>
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pixman-private.h"
-
-#include <stdlib.h>
-
-typedef pixman_box32_t box_type_t;
-typedef pixman_region32_data_t region_data_type_t;
-typedef pixman_region32_t region_type_t;
-typedef int64_t overflow_int_t;
-
-typedef struct {
- int x, y;
-} point_type_t;
-
-#define PREFIX(x) pixman_region32##x
-
-#define PIXMAN_REGION_MAX INT32_MAX
-#define PIXMAN_REGION_MIN INT32_MIN
-
-#include "pixman-region.c"
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Soren Sandmann <sandmann@redhat.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "pixman-private.h"
+
+#include <stdlib.h>
+
+typedef pixman_box32_t box_type_t;
+typedef pixman_region32_data_t region_data_type_t;
+typedef pixman_region32_t region_type_t;
+typedef int64_t overflow_int_t;
+
+typedef struct {
+ int x, y;
+} point_type_t;
+
+#define PREFIX(x) pixman_region32##x
+
+#define PIXMAN_REGION_MAX INT32_MAX
+#define PIXMAN_REGION_MIN INT32_MIN
+
+#include "pixman-region.c"
diff --git a/pixman/pixman/pixman-timer.c b/pixman/pixman/pixman-timer.c
index c45d7b4fa..f5ae18e89 100644
--- a/pixman/pixman/pixman-timer.c
+++ b/pixman/pixman/pixman-timer.c
@@ -1,66 +1,66 @@
-/*
- * Copyright © 2007 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Red Hat not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Red Hat makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
- * 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
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "pixman-private.h"
-
-#ifdef PIXMAN_TIMERS
-
-static pixman_timer_t *timers;
-
-static void
-dump_timers (void)
-{
- pixman_timer_t *timer;
-
- for (timer = timers; timer != NULL; timer = timer->next)
- {
- printf ("%s: total: %llu n: %llu avg: %f\n",
- timer->name,
- timer->total,
- timer->n_times,
- timer->total / (double)timer->n_times);
- }
-}
-
-void
-pixman_timer_register (pixman_timer_t *timer)
-{
- static int initialized;
-
- int atexit (void (*function)(void));
-
- if (!initialized)
- {
- atexit (dump_timers);
- initialized = 1;
- }
-
- timer->next = timers;
- timers = timer;
-}
-
-#endif
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Red Hat not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. Red Hat makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
+ * 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
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "pixman-private.h"
+
+#ifdef PIXMAN_TIMERS
+
+static pixman_timer_t *timers;
+
+static void
+dump_timers (void)
+{
+ pixman_timer_t *timer;
+
+ for (timer = timers; timer != NULL; timer = timer->next)
+ {
+ printf ("%s: total: %llu n: %llu avg: %f\n",
+ timer->name,
+ timer->total,
+ timer->n_times,
+ timer->total / (double)timer->n_times);
+ }
+}
+
+void
+pixman_timer_register (pixman_timer_t *timer)
+{
+ static int initialized;
+
+ int atexit (void (*function)(void));
+
+ if (!initialized)
+ {
+ atexit (dump_timers);
+ initialized = 1;
+ }
+
+ timer->next = timers;
+ timers = timer;
+}
+
+#endif
diff --git a/pixman/pixman/pixman-version.h.in b/pixman/pixman/pixman-version.h.in
index 022bf1a3c..256b2e6f1 100644
--- a/pixman/pixman/pixman-version.h.in
+++ b/pixman/pixman/pixman-version.h.in
@@ -1,50 +1,50 @@
-/*
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Author: Carl D. Worth <cworth@cworth.org>
- */
-
-#ifndef PIXMAN_VERSION_H__
-#define PIXMAN_VERSION_H__
-
-#ifndef PIXMAN_H__
-# error pixman-version.h should only be included by pixman.h
-#endif
-
-#define PIXMAN_VERSION_MAJOR @PIXMAN_VERSION_MAJOR@
-#define PIXMAN_VERSION_MINOR @PIXMAN_VERSION_MINOR@
-#define PIXMAN_VERSION_MICRO @PIXMAN_VERSION_MICRO@
-
-#define PIXMAN_VERSION_STRING "@PIXMAN_VERSION_MAJOR@.@PIXMAN_VERSION_MINOR@.@PIXMAN_VERSION_MICRO@"
-
-#define PIXMAN_VERSION_ENCODE(major, minor, micro) ( \
- ((major) * 10000) \
- + ((minor) * 100) \
- + ((micro) * 1))
-
-#define PIXMAN_VERSION PIXMAN_VERSION_ENCODE( \
- PIXMAN_VERSION_MAJOR, \
- PIXMAN_VERSION_MINOR, \
- PIXMAN_VERSION_MICRO)
-
-#endif /* PIXMAN_VERSION_H__ */
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#ifndef PIXMAN_VERSION_H__
+#define PIXMAN_VERSION_H__
+
+#ifndef PIXMAN_H__
+# error pixman-version.h should only be included by pixman.h
+#endif
+
+#define PIXMAN_VERSION_MAJOR @PIXMAN_VERSION_MAJOR@
+#define PIXMAN_VERSION_MINOR @PIXMAN_VERSION_MINOR@
+#define PIXMAN_VERSION_MICRO @PIXMAN_VERSION_MICRO@
+
+#define PIXMAN_VERSION_STRING "@PIXMAN_VERSION_MAJOR@.@PIXMAN_VERSION_MINOR@.@PIXMAN_VERSION_MICRO@"
+
+#define PIXMAN_VERSION_ENCODE(major, minor, micro) ( \
+ ((major) * 10000) \
+ + ((minor) * 100) \
+ + ((micro) * 1))
+
+#define PIXMAN_VERSION PIXMAN_VERSION_ENCODE( \
+ PIXMAN_VERSION_MAJOR, \
+ PIXMAN_VERSION_MINOR, \
+ PIXMAN_VERSION_MICRO)
+
+#endif /* PIXMAN_VERSION_H__ */
diff --git a/pixman/pixman/refactor b/pixman/pixman/refactor
index b93b75c08..52fceab17 100644
--- a/pixman/pixman/refactor
+++ b/pixman/pixman/refactor
@@ -1,478 +1,478 @@
-Roadmap
-
-- Move all the fetchers etc. into pixman-image to make pixman-compose.c
- less intimidating.
-
- DONE
-
-- Make combiners for unified alpha take a mask argument. That way
- we won't need two separate paths for unified vs component in the
- general compositing code.
-
- DONE, except that the Altivec code needs to be updated. Luca is
- looking into that.
-
-- Delete separate 'unified alpha' path
-
- DONE
-
-- Split images into their own files
-
- DONE
-
-- Split the gradient walker code out into its own file
-
- DONE
-
-- Add scanline getters per image
-
- DONE
-
-- Generic 64 bit fetcher
-
- DONE
-
-- Split fast path tables into their respective architecture dependent
- files.
-
-See "Render Algorithm" below for rationale
-
-Images will eventually have these virtual functions:
-
- get_scanline()
- get_scanline_wide()
- get_pixel()
- get_pixel_wide()
- get_untransformed_pixel()
- get_untransformed_pixel_wide()
- get_unfiltered_pixel()
- get_unfiltered_pixel_wide()
-
- store_scanline()
- store_scanline_wide()
-
-1.
-
-Initially we will just have get_scanline() and get_scanline_wide();
-these will be based on the ones in pixman-compose. Hopefully this will
-reduce the complexity in pixman_composite_rect_general().
-
-Note that there is access considerations - the compose function is
-being compiled twice.
-
-
-2.
-
-Split image types into their own source files. Export noop virtual
-reinit() call. Call this whenever a property of the image changes.
-
-
-3.
-
-Split the get_scanline() call into smaller functions that are
-initialized by the reinit() call.
-
-The Render Algorithm:
- (first repeat, then filter, then transform, then clip)
-
-Starting from a destination pixel (x, y), do
-
- 1 x = x - xDst + xSrc
- y = y - yDst + ySrc
-
- 2 reject pixel that is outside the clip
-
- This treats clipping as something that happens after
- transformation, which I think is correct for client clips. For
- hierarchy clips it is wrong, but who really cares? Without
- GraphicsExposes hierarchy clips are basically irrelevant. Yes,
- you could imagine cases where the pixels of a subwindow of a
- redirected, transformed window should be treated as
- transparent. I don't really care
-
- Basically, I think the render spec should say that pixels that
- are unavailable due to the hierarcy have undefined content,
- and that GraphicsExposes are not generated. Ie., basically
- that using non-redirected windows as sources is fail. This is
- at least consistent with the current implementation and we can
- update the spec later if someone makes it work.
-
- The implication for render is that it should stop passing the
- hierarchy clip to pixman. In pixman, if a souce image has a
- clip it should be used in computing the composite region and
- nowhere else, regardless of what "has_client_clip" says. The
- default should be for there to not be any clip.
-
- I would really like to get rid of the client clip as well for
- source images, but unfortunately there is at least one
- application in the wild that uses them.
-
- 3 Transform pixel: (x, y) = T(x, y)
-
- 4 Call p = GetUntransformedPixel (x, y)
-
- 5 If the image has an alpha map, then
-
- Call GetUntransformedPixel (x, y) on the alpha map
-
- add resulting alpha channel to p
-
- return p
-
- Where GetUnTransformedPixel is:
-
- 6 switch (filter)
- {
- case NEAREST:
- return GetUnfilteredPixel (x, y);
- break;
-
- case BILINEAR:
- return GetUnfilteredPixel (...) // 4 times
- break;
-
- case CONVOLUTION:
- return GetUnfilteredPixel (...) // as many times as necessary.
- break;
- }
-
- Where GetUnfilteredPixel (x, y) is
-
- 7 switch (repeat)
- {
- case REPEAT_NORMAL:
- case REPEAT_PAD:
- case REPEAT_REFLECT:
- // adjust x, y as appropriate
- break;
-
- case REPEAT_NONE:
- if (x, y) is outside image bounds
- return 0;
- break;
- }
-
- return GetRawPixel(x, y)
-
- Where GetRawPixel (x, y) is
-
- 8 Compute the pixel in question, depending on image type.
-
-For gradients, repeat has a totally different meaning, so
-UnfilteredPixel() and RawPixel() must be the same function so that
-gradients can do their own repeat algorithm.
-
-So, the GetRawPixel
-
- for bits must deal with repeats
- for gradients must deal with repeats (differently)
- for solids, should ignore repeats.
-
- for polygons, when we add them, either ignore repeats or do
- something similar to bits (in which case, we may want an extra
- layer of indirection to modify the coordinates).
-
-It is then possible to build things like "get scanline" or "get tile" on
-top of this. In the simplest case, just repeatedly calling GetPixel()
-would work, but specialized get_scanline()s or get_tile()s could be
-plugged in for common cases.
-
-By not plugging anything in for images with access functions, we only
-have to compile the pixel functions twice, not the scanline functions.
-
-And we can get rid of fetchers for the bizarre formats that no one
-uses. Such as b2g3r3 etc. r1g2b1? Seriously? It is also worth
-considering a generic format based pixel fetcher for these edge cases.
-
-Since the actual routines depend on the image attributes, the images
-must be notified when those change and update their function pointers
-appropriately. So there should probably be a virtual function called
-(* reinit) or something like that.
-
-There will also be wide fetchers for both pixels and lines. The line
-fetcher will just call the wide pixel fetcher. The wide pixel fetcher
-will just call expand, except for 10 bit formats.
-
-Rendering pipeline:
-
-Drawable:
- 0. if (picture has alpha map)
- 0.1. Position alpha map according to the alpha_x/alpha_y
- 0.2. Where the two drawables intersect, the alpha channel
- Replace the alpha channel of source with the one
- from the alpha map. Replacement only takes place
- in the intersection of the two drawables' geometries.
- 1. Repeat the drawable according to the repeat attribute
- 2. Reconstruct a continuous image according to the filter
- 3. Transform according to the transform attribute
- 4. Position image such that src_x, src_y is over dst_x, dst_y
- 5. Sample once per destination pixel
- 6. Clip. If a pixel is not within the source clip, then no
- compositing takes place at that pixel. (Ie., it's *not*
- treated as 0).
-
- Sampling a drawable:
-
- - If the channel does not have an alpha channel, the pixels in it
- are treated as opaque.
-
- Note on reconstruction:
-
- - The top left pixel has coordinates (0.5, 0.5) and pixels are
- spaced 1 apart.
-
-Gradient:
- 1. Unless gradient type is conical, repeat the underlying (0, 1)
- gradient according to the repeat attribute
- 2. Integrate the gradient across the plane according to type.
- 3. Transform according to transform attribute
- 4. Position gradient
- 5. Sample once per destination pixel.
- 6. Clip
-
-Solid Fill:
- 1. Repeat has no effect
- 2. Image is already continuous and defined for the entire plane
- 3. Transform has no effect
- 4. Positioning has no effect
- 5. Sample once per destination pixel.
- 6. Clip
-
-Polygon:
- 1. Repeat has no effect
- 2. Image is already continuous and defined on the whole plane
- 3. Transform according to transform attribute
- 4. Position image
- 5. Supersample 15x17 per destination pixel.
- 6. Clip
-
-Possibly interesting additions:
- - More general transformations, such as warping, or general
- shading.
-
- - Shader image where a function is called to generate the
- pixel (ie., uploading assembly code).
-
- - Resampling kernels
-
- In principle the polygon image uses a 15x17 box filter for
- resampling. If we allow general resampling filters, then we
- get all the various antialiasing types for free.
-
- Bilinear downsampling looks terrible and could be much
- improved by a resampling filter. NEAREST reconstruction
- combined with a box resampling filter is what GdkPixbuf
- does, I believe.
-
- Useful for high frequency gradients as well.
-
- (Note that the difference between a reconstruction and a
- resampling filter is mainly where in the pipeline they
- occur. High quality resampling should use a correctly
- oriented kernel so it should happen after transformation.
-
- An implementation can transform the resampling kernel and
- convolve it with the reconstruction if it so desires, but it
- will need to deal with the fact that the resampling kernel
- will not necessarily be pixel aligned.
-
- "Output kernels"
-
- One could imagine doing the resampling after compositing,
- ie., for each destination pixel sample each source image 16
- times, then composite those subpixels individually, then
- finally apply a kernel.
-
- However, this is effectively the same as full screen
- antialiasing, which is a simpler way to think about it. So
- resampling kernels may make sense for individual images, but
- not as a post-compositing step.
-
- Fullscreen AA is inefficient without chained compositing
- though. Consider an (image scaled up to oversample size IN
- some polygon) scaled down to screen size. With the current
- implementation, there will be a huge temporary. With chained
- compositing, the whole thing ends up being equivalent to the
- output kernel from above.
-
- - Color space conversion
-
- The complete model here is that each surface has a color
- space associated with it and that the compositing operation
- also has one associated with it. Note also that gradients
- should have associcated colorspaces.
-
- - Dithering
-
- If people dither something that is already dithered, it will
- look terrible, but don't do that, then. (Dithering happens
- after resampling if at all - what is the relationship
- with color spaces? Presumably dithering should happen in linear
- intensity space).
-
- - Floating point surfaces, 16, 32 and possibly 64 bit per
- channel.
-
- Maybe crack:
-
- - Glyph polygons
-
- If glyphs could be given as polygons, they could be
- positioned and rasterized more accurately. The glyph
- structure would need subpixel positioning though.
-
- - Luminance vs. coverage for the alpha channel
-
- Whether the alpha channel should be interpreted as luminance
- modulation or as coverage (intensity modulation). This is a
- bit of a departure from the rendering model though. It could
- also be considered whether it should be possible to have
- both channels in the same drawable.
-
- - Alternative for component alpha
-
- - Set component-alpha on the output image.
-
- - This means each of the components are sampled
- independently and composited in the corresponding
- channel only.
-
- - Have 3 x oversampled mask
-
- - Scale it down by 3 horizontally, with [ 1/3, 1/3, 1/3 ]
- resampling filter.
-
- Is this equivalent to just using a component alpha mask?
-
- Incompatible changes:
-
- - Gradients could be specified with premultiplied colors. (You
- can use a mask to get things like gradients from solid red to
- transparent red.
-
-Refactoring pixman
-
-The pixman code is not particularly nice to put it mildly. Among the
-issues are
-
-- inconsistent naming style (fb vs Fb, camelCase vs
- underscore_naming). Sometimes there is even inconsistency *within*
- one name.
-
- fetchProc32 ACCESS(pixman_fetchProcForPicture32)
-
- may be one of the uglies names ever created.
-
- coding style:
- use the one from cairo except that pixman uses this brace style:
-
- while (blah)
- {
- }
-
- Format do while like this:
-
- do
- {
-
- }
- while (...);
-
-- PIXMAN_COMPOSITE_RECT_GENERAL() is horribly complex
-
-- switch case logic in pixman-access.c
-
- Instead it would be better to just store function pointers in the
- image objects themselves,
-
- get_pixel()
- get_scanline()
-
-- Much of the scanline fetching code is for formats that no one
- ever uses. a2r2g2b2 anyone?
-
- It would probably be worthwhile having a generic fetcher for any
- pixman format whatsoever.
-
-- Code related to particular image types should be split into individual
- files.
-
- pixman-bits-image.c
- pixman-linear-gradient-image.c
- pixman-radial-gradient-image.c
- pixman-solid-image.c
-
-- Fast path code should be split into files based on architecture:
-
- pixman-mmx-fastpath.c
- pixman-sse2-fastpath.c
- pixman-c-fastpath.c
-
- etc.
-
- Each of these files should then export a fastpath table, which would
- be declared in pixman-private.h. This should allow us to get rid
- of the pixman-mmx.h files.
-
- The fast path table should describe each fast path. Ie there should
- be bitfields indicating what things the fast path can handle, rather than
- like now where it is only allowed to take one format per src/mask/dest. Ie.,
-
- {
- FAST_a8r8g8b8 | FAST_x8r8g8b8,
- FAST_null,
- FAST_x8r8g8b8,
- FAST_repeat_normal | FAST_repeat_none,
- the_fast_path
- }
-
-There should then be *one* file that implements pixman_image_composite().
-This should do this:
-
- optimize_operator();
-
- convert 1x1 repeat to solid (actually this should be done at
- image creation time).
-
- is there a useful fastpath?
-
-There should be a file called pixman-cpu.c that contains all the
-architecture specific stuff to detect what CPU features we have.
-
-Issues that must be kept in mind:
-
- - we need accessor code to be preserved
-
- - maybe there should be a "store_scanline" too?
-
- Is this sufficient?
-
- We should preserve the optimization where the
- compositing happens directly in the destination
- whenever possible.
-
- - It should be possible to create GPU samplers from the
- images.
-
-The "horizontal" classification should be a bit in the image, the
-"vertical" classification should just happen inside the gradient
-file. Note though that
-
- (a) these will change if the tranformation/repeat changes.
-
- (b) at the moment the optimization for linear gradients
- takes the source rectangle into account. Presumably
- this is to also optimize the case where the gradient
- is close enough to horizontal?
-
-Who is responsible for repeats? In principle it should be the scanline
-fetch. Right now NORMAL repeats are handled by walk_composite_region()
-while other repeats are handled by the scanline code.
-
-
-(Random note on filtering: do you filter before or after
-transformation? Hardware is going to filter after transformation;
-this is also what pixman does currently). It's not completely clear
-what filtering *after* transformation means. One thing that might look
-good would be to do *supersampling*, ie., compute multiple subpixels
-per destination pixel, then average them together.
+Roadmap
+
+- Move all the fetchers etc. into pixman-image to make pixman-compose.c
+ less intimidating.
+
+ DONE
+
+- Make combiners for unified alpha take a mask argument. That way
+ we won't need two separate paths for unified vs component in the
+ general compositing code.
+
+ DONE, except that the Altivec code needs to be updated. Luca is
+ looking into that.
+
+- Delete separate 'unified alpha' path
+
+ DONE
+
+- Split images into their own files
+
+ DONE
+
+- Split the gradient walker code out into its own file
+
+ DONE
+
+- Add scanline getters per image
+
+ DONE
+
+- Generic 64 bit fetcher
+
+ DONE
+
+- Split fast path tables into their respective architecture dependent
+ files.
+
+See "Render Algorithm" below for rationale
+
+Images will eventually have these virtual functions:
+
+ get_scanline()
+ get_scanline_wide()
+ get_pixel()
+ get_pixel_wide()
+ get_untransformed_pixel()
+ get_untransformed_pixel_wide()
+ get_unfiltered_pixel()
+ get_unfiltered_pixel_wide()
+
+ store_scanline()
+ store_scanline_wide()
+
+1.
+
+Initially we will just have get_scanline() and get_scanline_wide();
+these will be based on the ones in pixman-compose. Hopefully this will
+reduce the complexity in pixman_composite_rect_general().
+
+Note that there is access considerations - the compose function is
+being compiled twice.
+
+
+2.
+
+Split image types into their own source files. Export noop virtual
+reinit() call. Call this whenever a property of the image changes.
+
+
+3.
+
+Split the get_scanline() call into smaller functions that are
+initialized by the reinit() call.
+
+The Render Algorithm:
+ (first repeat, then filter, then transform, then clip)
+
+Starting from a destination pixel (x, y), do
+
+ 1 x = x - xDst + xSrc
+ y = y - yDst + ySrc
+
+ 2 reject pixel that is outside the clip
+
+ This treats clipping as something that happens after
+ transformation, which I think is correct for client clips. For
+ hierarchy clips it is wrong, but who really cares? Without
+ GraphicsExposes hierarchy clips are basically irrelevant. Yes,
+ you could imagine cases where the pixels of a subwindow of a
+ redirected, transformed window should be treated as
+ transparent. I don't really care
+
+ Basically, I think the render spec should say that pixels that
+ are unavailable due to the hierarcy have undefined content,
+ and that GraphicsExposes are not generated. Ie., basically
+ that using non-redirected windows as sources is fail. This is
+ at least consistent with the current implementation and we can
+ update the spec later if someone makes it work.
+
+ The implication for render is that it should stop passing the
+ hierarchy clip to pixman. In pixman, if a souce image has a
+ clip it should be used in computing the composite region and
+ nowhere else, regardless of what "has_client_clip" says. The
+ default should be for there to not be any clip.
+
+ I would really like to get rid of the client clip as well for
+ source images, but unfortunately there is at least one
+ application in the wild that uses them.
+
+ 3 Transform pixel: (x, y) = T(x, y)
+
+ 4 Call p = GetUntransformedPixel (x, y)
+
+ 5 If the image has an alpha map, then
+
+ Call GetUntransformedPixel (x, y) on the alpha map
+
+ add resulting alpha channel to p
+
+ return p
+
+ Where GetUnTransformedPixel is:
+
+ 6 switch (filter)
+ {
+ case NEAREST:
+ return GetUnfilteredPixel (x, y);
+ break;
+
+ case BILINEAR:
+ return GetUnfilteredPixel (...) // 4 times
+ break;
+
+ case CONVOLUTION:
+ return GetUnfilteredPixel (...) // as many times as necessary.
+ break;
+ }
+
+ Where GetUnfilteredPixel (x, y) is
+
+ 7 switch (repeat)
+ {
+ case REPEAT_NORMAL:
+ case REPEAT_PAD:
+ case REPEAT_REFLECT:
+ // adjust x, y as appropriate
+ break;
+
+ case REPEAT_NONE:
+ if (x, y) is outside image bounds
+ return 0;
+ break;
+ }
+
+ return GetRawPixel(x, y)
+
+ Where GetRawPixel (x, y) is
+
+ 8 Compute the pixel in question, depending on image type.
+
+For gradients, repeat has a totally different meaning, so
+UnfilteredPixel() and RawPixel() must be the same function so that
+gradients can do their own repeat algorithm.
+
+So, the GetRawPixel
+
+ for bits must deal with repeats
+ for gradients must deal with repeats (differently)
+ for solids, should ignore repeats.
+
+ for polygons, when we add them, either ignore repeats or do
+ something similar to bits (in which case, we may want an extra
+ layer of indirection to modify the coordinates).
+
+It is then possible to build things like "get scanline" or "get tile" on
+top of this. In the simplest case, just repeatedly calling GetPixel()
+would work, but specialized get_scanline()s or get_tile()s could be
+plugged in for common cases.
+
+By not plugging anything in for images with access functions, we only
+have to compile the pixel functions twice, not the scanline functions.
+
+And we can get rid of fetchers for the bizarre formats that no one
+uses. Such as b2g3r3 etc. r1g2b1? Seriously? It is also worth
+considering a generic format based pixel fetcher for these edge cases.
+
+Since the actual routines depend on the image attributes, the images
+must be notified when those change and update their function pointers
+appropriately. So there should probably be a virtual function called
+(* reinit) or something like that.
+
+There will also be wide fetchers for both pixels and lines. The line
+fetcher will just call the wide pixel fetcher. The wide pixel fetcher
+will just call expand, except for 10 bit formats.
+
+Rendering pipeline:
+
+Drawable:
+ 0. if (picture has alpha map)
+ 0.1. Position alpha map according to the alpha_x/alpha_y
+ 0.2. Where the two drawables intersect, the alpha channel
+ Replace the alpha channel of source with the one
+ from the alpha map. Replacement only takes place
+ in the intersection of the two drawables' geometries.
+ 1. Repeat the drawable according to the repeat attribute
+ 2. Reconstruct a continuous image according to the filter
+ 3. Transform according to the transform attribute
+ 4. Position image such that src_x, src_y is over dst_x, dst_y
+ 5. Sample once per destination pixel
+ 6. Clip. If a pixel is not within the source clip, then no
+ compositing takes place at that pixel. (Ie., it's *not*
+ treated as 0).
+
+ Sampling a drawable:
+
+ - If the channel does not have an alpha channel, the pixels in it
+ are treated as opaque.
+
+ Note on reconstruction:
+
+ - The top left pixel has coordinates (0.5, 0.5) and pixels are
+ spaced 1 apart.
+
+Gradient:
+ 1. Unless gradient type is conical, repeat the underlying (0, 1)
+ gradient according to the repeat attribute
+ 2. Integrate the gradient across the plane according to type.
+ 3. Transform according to transform attribute
+ 4. Position gradient
+ 5. Sample once per destination pixel.
+ 6. Clip
+
+Solid Fill:
+ 1. Repeat has no effect
+ 2. Image is already continuous and defined for the entire plane
+ 3. Transform has no effect
+ 4. Positioning has no effect
+ 5. Sample once per destination pixel.
+ 6. Clip
+
+Polygon:
+ 1. Repeat has no effect
+ 2. Image is already continuous and defined on the whole plane
+ 3. Transform according to transform attribute
+ 4. Position image
+ 5. Supersample 15x17 per destination pixel.
+ 6. Clip
+
+Possibly interesting additions:
+ - More general transformations, such as warping, or general
+ shading.
+
+ - Shader image where a function is called to generate the
+ pixel (ie., uploading assembly code).
+
+ - Resampling kernels
+
+ In principle the polygon image uses a 15x17 box filter for
+ resampling. If we allow general resampling filters, then we
+ get all the various antialiasing types for free.
+
+ Bilinear downsampling looks terrible and could be much
+ improved by a resampling filter. NEAREST reconstruction
+ combined with a box resampling filter is what GdkPixbuf
+ does, I believe.
+
+ Useful for high frequency gradients as well.
+
+ (Note that the difference between a reconstruction and a
+ resampling filter is mainly where in the pipeline they
+ occur. High quality resampling should use a correctly
+ oriented kernel so it should happen after transformation.
+
+ An implementation can transform the resampling kernel and
+ convolve it with the reconstruction if it so desires, but it
+ will need to deal with the fact that the resampling kernel
+ will not necessarily be pixel aligned.
+
+ "Output kernels"
+
+ One could imagine doing the resampling after compositing,
+ ie., for each destination pixel sample each source image 16
+ times, then composite those subpixels individually, then
+ finally apply a kernel.
+
+ However, this is effectively the same as full screen
+ antialiasing, which is a simpler way to think about it. So
+ resampling kernels may make sense for individual images, but
+ not as a post-compositing step.
+
+ Fullscreen AA is inefficient without chained compositing
+ though. Consider an (image scaled up to oversample size IN
+ some polygon) scaled down to screen size. With the current
+ implementation, there will be a huge temporary. With chained
+ compositing, the whole thing ends up being equivalent to the
+ output kernel from above.
+
+ - Color space conversion
+
+ The complete model here is that each surface has a color
+ space associated with it and that the compositing operation
+ also has one associated with it. Note also that gradients
+ should have associcated colorspaces.
+
+ - Dithering
+
+ If people dither something that is already dithered, it will
+ look terrible, but don't do that, then. (Dithering happens
+ after resampling if at all - what is the relationship
+ with color spaces? Presumably dithering should happen in linear
+ intensity space).
+
+ - Floating point surfaces, 16, 32 and possibly 64 bit per
+ channel.
+
+ Maybe crack:
+
+ - Glyph polygons
+
+ If glyphs could be given as polygons, they could be
+ positioned and rasterized more accurately. The glyph
+ structure would need subpixel positioning though.
+
+ - Luminance vs. coverage for the alpha channel
+
+ Whether the alpha channel should be interpreted as luminance
+ modulation or as coverage (intensity modulation). This is a
+ bit of a departure from the rendering model though. It could
+ also be considered whether it should be possible to have
+ both channels in the same drawable.
+
+ - Alternative for component alpha
+
+ - Set component-alpha on the output image.
+
+ - This means each of the components are sampled
+ independently and composited in the corresponding
+ channel only.
+
+ - Have 3 x oversampled mask
+
+ - Scale it down by 3 horizontally, with [ 1/3, 1/3, 1/3 ]
+ resampling filter.
+
+ Is this equivalent to just using a component alpha mask?
+
+ Incompatible changes:
+
+ - Gradients could be specified with premultiplied colors. (You
+ can use a mask to get things like gradients from solid red to
+ transparent red.
+
+Refactoring pixman
+
+The pixman code is not particularly nice to put it mildly. Among the
+issues are
+
+- inconsistent naming style (fb vs Fb, camelCase vs
+ underscore_naming). Sometimes there is even inconsistency *within*
+ one name.
+
+ fetchProc32 ACCESS(pixman_fetchProcForPicture32)
+
+ may be one of the uglies names ever created.
+
+ coding style:
+ use the one from cairo except that pixman uses this brace style:
+
+ while (blah)
+ {
+ }
+
+ Format do while like this:
+
+ do
+ {
+
+ }
+ while (...);
+
+- PIXMAN_COMPOSITE_RECT_GENERAL() is horribly complex
+
+- switch case logic in pixman-access.c
+
+ Instead it would be better to just store function pointers in the
+ image objects themselves,
+
+ get_pixel()
+ get_scanline()
+
+- Much of the scanline fetching code is for formats that no one
+ ever uses. a2r2g2b2 anyone?
+
+ It would probably be worthwhile having a generic fetcher for any
+ pixman format whatsoever.
+
+- Code related to particular image types should be split into individual
+ files.
+
+ pixman-bits-image.c
+ pixman-linear-gradient-image.c
+ pixman-radial-gradient-image.c
+ pixman-solid-image.c
+
+- Fast path code should be split into files based on architecture:
+
+ pixman-mmx-fastpath.c
+ pixman-sse2-fastpath.c
+ pixman-c-fastpath.c
+
+ etc.
+
+ Each of these files should then export a fastpath table, which would
+ be declared in pixman-private.h. This should allow us to get rid
+ of the pixman-mmx.h files.
+
+ The fast path table should describe each fast path. Ie there should
+ be bitfields indicating what things the fast path can handle, rather than
+ like now where it is only allowed to take one format per src/mask/dest. Ie.,
+
+ {
+ FAST_a8r8g8b8 | FAST_x8r8g8b8,
+ FAST_null,
+ FAST_x8r8g8b8,
+ FAST_repeat_normal | FAST_repeat_none,
+ the_fast_path
+ }
+
+There should then be *one* file that implements pixman_image_composite().
+This should do this:
+
+ optimize_operator();
+
+ convert 1x1 repeat to solid (actually this should be done at
+ image creation time).
+
+ is there a useful fastpath?
+
+There should be a file called pixman-cpu.c that contains all the
+architecture specific stuff to detect what CPU features we have.
+
+Issues that must be kept in mind:
+
+ - we need accessor code to be preserved
+
+ - maybe there should be a "store_scanline" too?
+
+ Is this sufficient?
+
+ We should preserve the optimization where the
+ compositing happens directly in the destination
+ whenever possible.
+
+ - It should be possible to create GPU samplers from the
+ images.
+
+The "horizontal" classification should be a bit in the image, the
+"vertical" classification should just happen inside the gradient
+file. Note though that
+
+ (a) these will change if the tranformation/repeat changes.
+
+ (b) at the moment the optimization for linear gradients
+ takes the source rectangle into account. Presumably
+ this is to also optimize the case where the gradient
+ is close enough to horizontal?
+
+Who is responsible for repeats? In principle it should be the scanline
+fetch. Right now NORMAL repeats are handled by walk_composite_region()
+while other repeats are handled by the scanline code.
+
+
+(Random note on filtering: do you filter before or after
+transformation? Hardware is going to filter after transformation;
+this is also what pixman does currently). It's not completely clear
+what filtering *after* transformation means. One thing that might look
+good would be to do *supersampling*, ie., compute multiple subpixels
+per destination pixel, then average them together.
diff --git a/pixman/pixman/solaris-hwcap.mapfile b/pixman/pixman/solaris-hwcap.mapfile
index e49d4f1ec..87efce1e3 100644
--- a/pixman/pixman/solaris-hwcap.mapfile
+++ b/pixman/pixman/solaris-hwcap.mapfile
@@ -1,30 +1,30 @@
-###############################################################################
-#
-# Copyright 2009, Oracle and/or its affiliates. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-###############################################################################
-#
-# Override the linker's detection of CMOV/MMX/SSE instructions so this
-# library isn't flagged as only usable on CPU's with those ISA's, since it
-# checks at runtime for availability before calling them
-
-hwcap_1 = V0x0 FPU OVERRIDE;
+###############################################################################
+#
+# Copyright 2009, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+###############################################################################
+#
+# Override the linker's detection of CMOV/MMX/SSE instructions so this
+# library isn't flagged as only usable on CPU's with those ISA's, since it
+# checks at runtime for availability before calling them
+
+hwcap_1 = V0x0 FPU OVERRIDE;
diff --git a/pixman/test/alpha-loop.c b/pixman/test/alpha-loop.c
index 38fc21f5d..e4d90a988 100644
--- a/pixman/test/alpha-loop.c
+++ b/pixman/test/alpha-loop.c
@@ -1,29 +1,29 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include "utils.h"
-
-#define WIDTH 400
-#define HEIGHT 200
-
-int
-main (int argc, char **argv)
-{
- uint8_t *alpha = make_random_bytes (WIDTH * HEIGHT);
- uint32_t *src = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
- uint32_t *dest = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
-
- pixman_image_t *a = pixman_image_create_bits (PIXMAN_a8, WIDTH, HEIGHT, (uint32_t *)alpha, WIDTH);
- pixman_image_t *d = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
- pixman_image_t *s = pixman_image_create_bits (PIXMAN_a2r10g10b10, WIDTH, HEIGHT, src, WIDTH * 4);
-
- fail_after (5, "Infinite loop detected: 5 seconds without progress\n");
-
- pixman_image_set_alpha_map (s, a, 0, 0);
- pixman_image_set_alpha_map (a, s, 0, 0);
-
- pixman_image_composite (PIXMAN_OP_SRC, s, NULL, d, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
-
- pixman_image_unref (s);
-
- return 0;
-}
+#include <stdio.h>
+#include <stdlib.h>
+#include "utils.h"
+
+#define WIDTH 400
+#define HEIGHT 200
+
+int
+main (int argc, char **argv)
+{
+ uint8_t *alpha = make_random_bytes (WIDTH * HEIGHT);
+ uint32_t *src = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
+ uint32_t *dest = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
+
+ pixman_image_t *a = pixman_image_create_bits (PIXMAN_a8, WIDTH, HEIGHT, (uint32_t *)alpha, WIDTH);
+ pixman_image_t *d = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
+ pixman_image_t *s = pixman_image_create_bits (PIXMAN_a2r10g10b10, WIDTH, HEIGHT, src, WIDTH * 4);
+
+ fail_after (5, "Infinite loop detected: 5 seconds without progress\n");
+
+ pixman_image_set_alpha_map (s, a, 0, 0);
+ pixman_image_set_alpha_map (a, s, 0, 0);
+
+ pixman_image_composite (PIXMAN_OP_SRC, s, NULL, d, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+
+ pixman_image_unref (s);
+
+ return 0;
+}
diff --git a/pixman/test/region-test.c b/pixman/test/region-test.c
index a1fc4a837..9d5a41eb9 100644
--- a/pixman/test/region-test.c
+++ b/pixman/test/region-test.c
@@ -1,123 +1,123 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "utils.h"
-
-int
-main ()
-{
- pixman_region32_t r1;
- pixman_region32_t r2;
- pixman_region32_t r3;
- pixman_box32_t boxes[] = {
- { 10, 10, 20, 20 },
- { 30, 30, 30, 40 },
- { 50, 45, 60, 44 },
- };
- pixman_box32_t boxes2[] = {
- { 2, 6, 7, 6 },
- { 4, 1, 6, 7 },
- };
- pixman_box32_t boxes3[] = {
- { 2, 6, 7, 6 },
- { 4, 1, 6, 1 },
- };
- int i, j;
- pixman_box32_t *b;
- pixman_image_t *image, *fill;
- pixman_color_t white = {
- 0xffff,
- 0xffff,
- 0xffff,
- 0xffff
- };
-
- /* This used to go into an infinite loop before pixman-region.c
- * was fixed to not use explict "short" variables
- */
- pixman_region32_init_rect (&r1, 0, 0, 20, 64000);
- pixman_region32_init_rect (&r2, 0, 0, 20, 64000);
- pixman_region32_init_rect (&r3, 0, 0, 20, 64000);
-
- pixman_region32_subtract (&r1, &r2, &r3);
-
-
- /* This would produce a region containing an empty
- * rectangle in it. Such regions are considered malformed,
- * but using an empty rectangle for initialization should
- * work.
- */
- pixman_region32_init_rects (&r1, boxes, 3);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- assert (i == 1);
-
- while (i--)
- {
- assert (b[i].x1 < b[i].x2);
- assert (b[i].y1 < b[i].y2);
- }
-
- /* This would produce a rectangle containing the bounding box
- * of the two rectangles. The correct result is to eliminate
- * the broken rectangle.
- */
- pixman_region32_init_rects (&r1, boxes2, 2);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- assert (i == 1);
-
- assert (b[0].x1 == 4);
- assert (b[0].y1 == 1);
- assert (b[0].x2 == 6);
- assert (b[0].y2 == 7);
-
- /* This should produce an empty region */
- pixman_region32_init_rects (&r1, boxes3, 2);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- assert (i == 0);
-
- fill = pixman_image_create_solid_fill (&white);
- for (i = 0; i < 100; i++)
- {
- int image_size = 128;
-
- pixman_region32_init (&r1);
-
- /* Add some random rectangles */
- for (j = 0; j < 64; j++)
- pixman_region32_union_rect (&r1, &r1,
- lcg_rand_n (image_size),
- lcg_rand_n (image_size),
- lcg_rand_n (25),
- lcg_rand_n (25));
-
- /* Clip to image size */
- pixman_region32_init_rect (&r2, 0, 0, image_size, image_size);
- pixman_region32_intersect (&r1, &r1, &r2);
- pixman_region32_fini (&r2);
-
- /* render region to a1 mask */
- image = pixman_image_create_bits (PIXMAN_a1, image_size, image_size, NULL, 0);
- pixman_image_set_clip_region32 (image, &r1);
- pixman_image_composite32 (PIXMAN_OP_SRC,
- fill, NULL, image,
- 0, 0, 0, 0, 0, 0,
- image_size, image_size);
- pixman_region32_init_from_image (&r2, image);
-
- pixman_image_unref (image);
-
- assert (pixman_region32_equal (&r1, &r2));
- pixman_region32_fini (&r1);
- pixman_region32_fini (&r2);
-
- }
- pixman_image_unref (fill);
-
- return 0;
-}
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "utils.h"
+
+int
+main ()
+{
+ pixman_region32_t r1;
+ pixman_region32_t r2;
+ pixman_region32_t r3;
+ pixman_box32_t boxes[] = {
+ { 10, 10, 20, 20 },
+ { 30, 30, 30, 40 },
+ { 50, 45, 60, 44 },
+ };
+ pixman_box32_t boxes2[] = {
+ { 2, 6, 7, 6 },
+ { 4, 1, 6, 7 },
+ };
+ pixman_box32_t boxes3[] = {
+ { 2, 6, 7, 6 },
+ { 4, 1, 6, 1 },
+ };
+ int i, j;
+ pixman_box32_t *b;
+ pixman_image_t *image, *fill;
+ pixman_color_t white = {
+ 0xffff,
+ 0xffff,
+ 0xffff,
+ 0xffff
+ };
+
+ /* This used to go into an infinite loop before pixman-region.c
+ * was fixed to not use explict "short" variables
+ */
+ pixman_region32_init_rect (&r1, 0, 0, 20, 64000);
+ pixman_region32_init_rect (&r2, 0, 0, 20, 64000);
+ pixman_region32_init_rect (&r3, 0, 0, 20, 64000);
+
+ pixman_region32_subtract (&r1, &r2, &r3);
+
+
+ /* This would produce a region containing an empty
+ * rectangle in it. Such regions are considered malformed,
+ * but using an empty rectangle for initialization should
+ * work.
+ */
+ pixman_region32_init_rects (&r1, boxes, 3);
+
+ b = pixman_region32_rectangles (&r1, &i);
+
+ assert (i == 1);
+
+ while (i--)
+ {
+ assert (b[i].x1 < b[i].x2);
+ assert (b[i].y1 < b[i].y2);
+ }
+
+ /* This would produce a rectangle containing the bounding box
+ * of the two rectangles. The correct result is to eliminate
+ * the broken rectangle.
+ */
+ pixman_region32_init_rects (&r1, boxes2, 2);
+
+ b = pixman_region32_rectangles (&r1, &i);
+
+ assert (i == 1);
+
+ assert (b[0].x1 == 4);
+ assert (b[0].y1 == 1);
+ assert (b[0].x2 == 6);
+ assert (b[0].y2 == 7);
+
+ /* This should produce an empty region */
+ pixman_region32_init_rects (&r1, boxes3, 2);
+
+ b = pixman_region32_rectangles (&r1, &i);
+
+ assert (i == 0);
+
+ fill = pixman_image_create_solid_fill (&white);
+ for (i = 0; i < 100; i++)
+ {
+ int image_size = 128;
+
+ pixman_region32_init (&r1);
+
+ /* Add some random rectangles */
+ for (j = 0; j < 64; j++)
+ pixman_region32_union_rect (&r1, &r1,
+ lcg_rand_n (image_size),
+ lcg_rand_n (image_size),
+ lcg_rand_n (25),
+ lcg_rand_n (25));
+
+ /* Clip to image size */
+ pixman_region32_init_rect (&r2, 0, 0, image_size, image_size);
+ pixman_region32_intersect (&r1, &r1, &r2);
+ pixman_region32_fini (&r2);
+
+ /* render region to a1 mask */
+ image = pixman_image_create_bits (PIXMAN_a1, image_size, image_size, NULL, 0);
+ pixman_image_set_clip_region32 (image, &r1);
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ fill, NULL, image,
+ 0, 0, 0, 0, 0, 0,
+ image_size, image_size);
+ pixman_region32_init_from_image (&r2, image);
+
+ pixman_image_unref (image);
+
+ assert (pixman_region32_equal (&r1, &r2));
+ pixman_region32_fini (&r1);
+ pixman_region32_fini (&r2);
+
+ }
+ pixman_image_unref (fill);
+
+ return 0;
+}