зеркало из https://github.com/mozilla/pjs.git
b=383960, Cairo 1.5.x: pixman
This commit is contained in:
Родитель
87abaea0da
Коммит
65dc770de8
|
@ -1,19 +0,0 @@
|
|||
David R Bacon <dbacon@cis.ksu.edu> Fixes to compile on x86_64.
|
||||
Billy Biggs <vektor@dumbterm.net> Fix to use stdint datatypes.
|
||||
Dave Beckett <Dave.Beckett@bristol.ac.uk> Combined libpixregion, libic, and slim.
|
||||
Jakub Bogusz <qboosh@pld-linux.org> Fixes for 64-bit machines.
|
||||
Anders Carlsson <andersca@gnome.org> Build fixes. New accessor functions.
|
||||
Richard Henderson <rth@twiddle.net> "slim" macros for better shared libraries
|
||||
Owen Taylor <otaylor@redhat.com> Support for both transform and repeat
|
||||
Keith Packard <keithp@keithp.com> The original implementation of the compositing code.
|
||||
David Reveman <c99drn@cs.umu.se> Byte-order, clipping and format fixes.
|
||||
Vladimir Vukicevic <vladimir@pobox.com> Bug fix.
|
||||
Bryan Worth <bryan@theworths.org> Cleanups to not depend on X header files.
|
||||
Carl Worth <carl@theworths.org> General maintenance. Original port from X server code.
|
||||
Richard Worth <richard@theworths.org> Build fixes for cygwin.
|
||||
|
||||
and the "X Window System authors" (pixregion code)
|
||||
|
||||
(Please let us know if we have missed anyone. I would be interested in
|
||||
having more precise attribution for the pixregion code if anyone knows
|
||||
who wrote that.)
|
|
@ -1,92 +0,0 @@
|
|||
libpixregion
|
||||
|
||||
Copyright 1987, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
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 Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
libic
|
||||
|
||||
Copyright © 2001 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
slim
|
||||
|
||||
slim is Copyright © 2003 Richard Henderson
|
||||
|
||||
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 Richard Henderson not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission. Richard Henderson
|
||||
makes no representations about the suitability of this software for
|
||||
any purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
RICHARD HENDERSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
EVENT SHALL RICHARD HENDERSON 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.
|
||||
|
|
@ -1,9 +1,234 @@
|
|||
This code uses automake, in order to generate the Makefiles use:
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
$ autogen.sh
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||
2006 Free Software Foundation, Inc.
|
||||
|
||||
After that, standard build procedures apply:
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
$ make
|
||||
# make install
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
Snapshot 0.1.6 (2005-07-28 Carl Worth <cworth@cworth.org>)
|
||||
==========================================================
|
||||
Behavioral changes
|
||||
------------------
|
||||
Clips are changed to only affect destination operands, not
|
||||
sources. This gives the desired behavior for cairo. If the X server's
|
||||
Render implementation wants to use pixman it will have to select
|
||||
source clipping, (presumably through a new API call that we can add at
|
||||
that point).
|
||||
|
||||
Bug fixes
|
||||
---------
|
||||
Fix leak of the clip region associated with an image in
|
||||
pixman_image_destroy.
|
||||
|
||||
Fix units for stride return to be FbStip-sized, (this bug was causing
|
||||
non antialiased text in cairo to appear as garbage).
|
||||
|
||||
Other changes
|
||||
-------------
|
||||
The implementation has been merged considerably with xserver/fb. Most
|
||||
of the merge was just name changes, but there were likely some bug
|
||||
fixes or performance improvements in there as well.
|
||||
|
||||
Snapshot 0.1.5 (2005-05-18 Carl Worth <cworth@cworth.org>)
|
||||
==========================================================
|
||||
Bug fixes
|
||||
---------
|
||||
Fix confusion of depth and bpp which was causing cairo to crash on
|
||||
some X servers.
|
||||
|
||||
Properly declare pixman_fixed16_16_t as int32_t which fixes
|
||||
compilation failures on some platforms.
|
||||
|
||||
Fix to find inttypes.h on AIX.
|
||||
|
||||
Fix bug in compositing when the source image has no alpha channel.
|
||||
|
||||
Some fixes to the clipping code.
|
||||
|
||||
Fix memory leak when asked to draw a degenerate trapezoid list.
|
||||
|
||||
Snapshot 0.1.4 (2005-03-07 Carl Worth <cworth@cworth.org>)
|
||||
==========================================================
|
||||
API Addition
|
||||
------------
|
||||
Add new function:
|
||||
|
||||
void
|
||||
pixman_add_trapezoids (pixman_image_t *dst,
|
||||
int x_off,
|
||||
int y_off,
|
||||
const pixman_trapezoid_t *traps,
|
||||
int ntraps);
|
||||
|
||||
Performance improvement
|
||||
-----------------------
|
||||
Restrict size of intermediate surface used while compositing
|
||||
trapezoids based on the bounds of the desination surface.
|
||||
|
||||
Bug fixes
|
||||
---------
|
||||
Fix rendering on 64-bit platforms.
|
||||
|
||||
Snapshot 0.1.3 (2005-01-21 Carl Worth <cworth@cworth.org>)
|
||||
==========================================================
|
||||
Performance improvements
|
||||
------------------------
|
||||
Solid fills are now much faster, (thanks to Alexander Larsson).
|
||||
|
||||
Bug fixes
|
||||
---------
|
||||
Fixed to quiet warnings in newer versions of gcc.
|
||||
|
||||
Don't divide-by-zero if given an image of size 0x0.
|
||||
|
||||
Fixed several corner cases where values outside a trapezoid would be
|
||||
drawn with alpha 1/255 (in the 8-bit case).
|
||||
|
||||
Internal changes
|
||||
----------------
|
||||
Imported the newer point-sampling trapezoid rasterization code that
|
||||
Keith Packard wrote for the X server. This provide pixel-perfect
|
||||
matching with the Render extension as well as code that is simpler,
|
||||
more robust, and easier to maintain.
|
||||
|
||||
Snapshot 0.1.2 (2004-10-27 Carl Worth <cworth@cworth.org>)
|
||||
==========================================================
|
||||
New functionality
|
||||
-----------------
|
||||
Added three new functions:
|
||||
|
||||
pixman_image_set_component_alpha
|
||||
pixman_format_get_masks
|
||||
pixman_image_get_format
|
||||
|
||||
The first enables component-alpha compositing which can be used for
|
||||
optimizing sub-pixel rendering of text and other geometry. This is
|
||||
useful when the geometrical relationship of the sub-pixel components
|
||||
of the display device are known, (eg. with flat-panel monitors rather
|
||||
than CRTs).
|
||||
|
||||
The other two functions are simple query functions that were missing.
|
||||
|
||||
Bug fixes
|
||||
---------
|
||||
Enabling both transform and repeat simultaneously now works.
|
||||
Some byte-order fixes.
|
||||
Clipping fixes: pixman now takes a copy of the client clipping region
|
||||
client clipping is now actually used, it wasn't earlier.
|
||||
|
||||
Snapshot 0.1.1 (2004-04-16 Carl Worth <cworth@east.isi.edu>)
|
||||
============================================================
|
||||
Build fixes for cygwin
|
||||
----------------------
|
||||
This snapshot adds the -no-undefined flag during compilation which is
|
||||
necessart for building a shared library under cygwin.
|
||||
|
||||
Cleanup of the public API
|
||||
-------------------------
|
||||
We recently noticed that there were a coupld of bugs in the script
|
||||
that renamed libic to libpixman. Fixing this requires the following
|
||||
changes in the public API:
|
||||
|
||||
PIXMAN_FORMAT_AR_GB32 -> PIXMAN_FORMAT_ARGB32
|
||||
PIXMAN_FORMAT_RG_B24 -> PIXMAN_FORMAT_RGB24
|
||||
|
||||
While we're changing that, we also normalized the names of structure
|
||||
tags, for example:
|
||||
|
||||
struct _pixman_region16_t -> struct pixman_region16
|
||||
etc.
|
||||
|
||||
but users are expected to use typedefs such as pixman_region16_t
|
||||
anyway.
|
|
@ -1,47 +0,0 @@
|
|||
libpixman - Pixel manipulation library
|
||||
|
||||
libpixman is a merge of libpixregion and libic.
|
||||
It also includes the slim headers.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
libpixregion - Pixel region Library
|
||||
|
||||
libpixregion is a generic library for manipulating pixel regions. A
|
||||
PixRegion is a set of Y-X banded rectangles that cover the desired
|
||||
region.
|
||||
|
||||
The original code for libxregion was part of the reference X server
|
||||
implementation of the X Window System. A modified copy of the code
|
||||
also exists in the Xlib client library. libpixregion was formed so
|
||||
that both the X server and client libraries could share common code
|
||||
for region manipulation.
|
||||
|
||||
libpixregion is also intended to be applicable outside of the X Window
|
||||
System. The public interface of libpixregion does not depend on any
|
||||
part of the X Window System.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
libic - Image compositing library
|
||||
|
||||
libic is a generic image compositing library. libic provides
|
||||
Porter/Duff compositing of images and implicit mask generation for
|
||||
geometric primitives including trapezoids, triangles, and rectangles.
|
||||
|
||||
The semantics of libic are designed to precisely match the
|
||||
specification of the X Render extension. In fact, the initial
|
||||
implementation of libic was lifted from the reference implementation
|
||||
of RENDER from the X server.
|
||||
|
||||
However, libic is intended to be useful independent of the X Window
|
||||
System. The public interface exported by libic does not contain any
|
||||
X-specific data structures.
|
||||
|
||||
Carl Worth
|
||||
cworth@isi.edu
|
||||
|
||||
Keith Packard (keithp@keithp.com) originally wrote all the original
|
||||
RENDER code that was yanked out to become libic. Keith also provided
|
||||
impetus and guidance in the development of libic.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
slim - Shared Library Interface Macros
|
|
@ -1,10 +1,139 @@
|
|||
Need to finish up libpixman to the point where there X server can use
|
||||
it in place of its original copy of all this code (eg. in fb). This
|
||||
means merging features that have happened in either tree since the
|
||||
birth of libpixman. Off-hand I can think of the following things that
|
||||
have happened:
|
||||
- Go through things marked FIXME
|
||||
|
||||
* libpixman has fix for transform + repeat
|
||||
* X server has some (MMX? SSE?) optimized compositing code
|
||||
- Add calls to prepare and finish access where necessary. grep for
|
||||
ACCESS_MEM, and make sure they are correctly wrapped in prepare
|
||||
and finish.
|
||||
|
||||
- restore READ/WRITE in the fbcompose combiners since they sometimes
|
||||
store directly to destination drawables.
|
||||
|
||||
- It probably makes sense to move the more strange X region API
|
||||
into pixman as well, but guarded with PIXMAN_XORG_COMPATIBILITY
|
||||
|
||||
- Reinstate the FbBits typedef? At the moment we don't
|
||||
even have the FbBits type; we just use uint32_t everywhere.
|
||||
|
||||
Keith says in bug 2335:
|
||||
|
||||
The 64-bit code in fb (pixman) is probably broken; it hasn't been
|
||||
used in quite some time as PCI (and AGP) is 32-bits wide, so
|
||||
doing things 64-bits at a time is a net loss. To quickly fix
|
||||
this, I suggest just using 32-bit datatypes by setting
|
||||
IC_SHIFT to 5 for all machines.
|
||||
|
||||
- Consider whether calling regions region16 is really such a great
|
||||
idea Vlad wants 32 bit regions for Cairo. This will break X server
|
||||
ABI, but should otherwise be mostly harmless, though a
|
||||
pixman_region_get_boxes16() may be useful.
|
||||
|
||||
- Make source clipping optional.
|
||||
- done: source clipping happens through an indirection.
|
||||
still needs to make the indirection settable. (And call it
|
||||
from X)
|
||||
|
||||
- Consider optimizing the 8/16 bit solid fills in pixman-util.c by
|
||||
storing more than one value at a time.
|
||||
|
||||
- Add an image cache to prevent excessive malloc/free. Note that pixman
|
||||
needs to be thread safe when used from cairo.
|
||||
|
||||
- Review the pixman_format_code_t enum to make sure it will support
|
||||
future formats. Some formats we will probably need:
|
||||
|
||||
ARGB/ABGR with 16/32/64 bit integer/floating channels
|
||||
YUV2,
|
||||
YV12
|
||||
|
||||
Also we may need the ability to distinguish between PICT_c8 and
|
||||
PICT_x4c4. (This could be done by interpreting the A channel as
|
||||
the depth for TYPE_COLOR and TYPE_GRAY formats).
|
||||
|
||||
A possibility may be to reserve the two top bits and make them
|
||||
encode "number of places to shift the channel widths given" Since
|
||||
these bits are 00 at the moment everything will continue to work,
|
||||
but these additional widths will be allowed:
|
||||
|
||||
All even widths between 18-32
|
||||
All multiples of four widths between 33 and 64
|
||||
All multiples of eight between 64 and 128
|
||||
|
||||
This means things like r21g22b21 won't work - is that worth
|
||||
worrying about? I don't think so. And of course the bpp field
|
||||
can't handle a depth of over 256, so > 64 bit channels arent'
|
||||
really all that useful.
|
||||
|
||||
We could reserve one extra bit to indicate floating point, but
|
||||
we may also just add
|
||||
|
||||
PIXMAN_TYPE_ARGB_FLOAT
|
||||
PIXMAN_TYPE_BGRA_FLOAT
|
||||
PIXMAN_TYPE_A_FLOAT
|
||||
|
||||
image types. With five bits we can support up to 32 different
|
||||
format types, which should be enough for everybody, even if we
|
||||
decide to support all the various video formats here:
|
||||
|
||||
http://www.fourcc.org/yuv.php
|
||||
|
||||
It may make sense to have a PIXMAN_TYPE_YUV, and then use the
|
||||
channel bits to specify the exact subtype.
|
||||
|
||||
What about color spaces such a linear vs. srGB etc.?
|
||||
|
||||
|
||||
done:
|
||||
|
||||
- Run cairo test suite; fix bugs
|
||||
- one bug in source-scale-clip
|
||||
|
||||
- Remove the warning suppression in the ACCESS_MEM macro and fix the
|
||||
warnings that are real
|
||||
- irrelevant now.
|
||||
|
||||
- make the wrapper functions global instead of image specific
|
||||
- this won't work since pixman is linked to both fb and wfb
|
||||
|
||||
- Add non-mmx solid fill
|
||||
|
||||
- Make sure the endian-ness macros are defined correctly.
|
||||
|
||||
- The rectangles in a region probably shouldn't be returned const as
|
||||
the X server will be changing them.
|
||||
|
||||
- Right now we _always_ have a clip region, which is empty by default.
|
||||
Why does this work at all? It probably doesn't. The server
|
||||
distinguishes two cases, one where nothing is clipped (CT_NONE), and
|
||||
one where there is a clip region (CT_REGION).
|
||||
|
||||
- Default clip region should be the full image
|
||||
|
||||
- Test if pseudo color still works. It does, but it also shows that
|
||||
copying a pixman_indexed_t on every composite operation is not
|
||||
going to fly. So, for now set_indexed() does not copy the
|
||||
indexed table.
|
||||
|
||||
Also just the malloc() to allocate a pixman image shows up pretty
|
||||
high.
|
||||
|
||||
Options include
|
||||
|
||||
- Make all the setters not copy their arguments
|
||||
|
||||
- Possibly combined with going back to the stack allocated
|
||||
approach that we already use for regions.
|
||||
|
||||
- Keep a cached pixman_image_t around for every picture. It would
|
||||
have to be kept uptodate every time something changes about the
|
||||
picture.
|
||||
|
||||
- Break the X server ABI and simply have the relevant parameter
|
||||
stored in the pixman image. This would have the additional benefits
|
||||
that:
|
||||
|
||||
- We can get rid of the annoying repeat field which is duplicated
|
||||
elsewhere.
|
||||
|
||||
- We can use pixman_color_t and pixman_gradient_stop_t
|
||||
etc. instead of the types that are defined in
|
||||
renderproto.h
|
||||
|
||||
But see the logs for more details.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
# Contributor(s):
|
||||
# Brian Ryner <bryner@brianryner.com>
|
||||
# Stuart Parmenter <pavlov@pavlov.net>
|
||||
# Vladimir Vukicevic <vladimir@pobox.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -63,33 +64,26 @@ endif
|
|||
endif
|
||||
|
||||
CSRCS = \
|
||||
fbcompose.c \
|
||||
fbedge.c \
|
||||
fbpict.c \
|
||||
fbtrap.c \
|
||||
icblt.c \
|
||||
icbltone.c \
|
||||
iccolor.c \
|
||||
icformat.c \
|
||||
icimage.c \
|
||||
icpixels.c \
|
||||
icrect.c \
|
||||
icstipple.c \
|
||||
ictransform.c \
|
||||
ictrap.c \
|
||||
ictri.c \
|
||||
icutil.c \
|
||||
pixregion.c \
|
||||
renderedge.c \
|
||||
pixman-compose-accessors.c \
|
||||
pixman-compose-noaccessors.c \
|
||||
pixman-compute-region.c \
|
||||
pixman-edge-accessors.c \
|
||||
pixman-edge-noaccessors.c \
|
||||
pixman-image.c \
|
||||
pixman-pict.c \
|
||||
pixman-region.c \
|
||||
pixman-timer.c \
|
||||
pixman-trap.c \
|
||||
pixman-utils.c \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_X11
|
||||
#CSRCS += fbmmx.c
|
||||
#CSRCS += pixman-mmx.c
|
||||
#DEFINES += -DUSE_MMX
|
||||
endif
|
||||
|
||||
ifdef _MSC_VER
|
||||
CSRCS += fbmmx.c
|
||||
CSRCS += pixman-mmx.c
|
||||
DEFINES += -DUSE_MMX
|
||||
endif
|
||||
|
||||
|
@ -103,6 +97,8 @@ FORCE_USE_PIC = 1
|
|||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CFLAGS += -DPACKAGE="mozpixman"
|
||||
|
||||
ifdef MOZ_X11
|
||||
#CFLAGS += -mmmx -msse -Winline --param inline-unit-growth=10000 --param large-function-growth=10000
|
||||
endif
|
||||
|
|
|
@ -1,236 +0,0 @@
|
|||
/*
|
||||
* $Id: fbtrap.c,v 1.19 2007-06-30 10:45:12 vladimir%pobox.com Exp $
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pixman-xserver-compat.h"
|
||||
|
||||
#ifdef RENDER
|
||||
|
||||
/* XXX: Haven't added addTraps to libpixman yet. */
|
||||
#if 0
|
||||
void
|
||||
fbAddTraps (PicturePtr pPicture,
|
||||
INT16 x_off,
|
||||
INT16 y_off,
|
||||
int ntrap,
|
||||
xTrap *traps)
|
||||
{
|
||||
FbBits *buf;
|
||||
int bpp;
|
||||
int width;
|
||||
int stride;
|
||||
int height;
|
||||
int pxoff, pyoff;
|
||||
|
||||
xFixed x_off_fixed;
|
||||
xFixed y_off_fixed;
|
||||
RenderEdge l, r;
|
||||
xFixed t, b;
|
||||
|
||||
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
|
||||
|
||||
width = pPicture->pDrawable->width;
|
||||
height = pPicture->pDrawable->height;
|
||||
x_off += pxoff;
|
||||
y_off += pyoff;
|
||||
|
||||
x_off_fixed = IntToxFixed(y_off);
|
||||
y_off_fixed = IntToxFixed(y_off);
|
||||
|
||||
while (ntrap--)
|
||||
{
|
||||
t = traps->top.y + y_off_fixed;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
t = RenderSampleCeilY (t, bpp);
|
||||
|
||||
b = traps->bot.y + y_off_fixed;
|
||||
if (xFixedToInt (b) >= height)
|
||||
b = IntToxFixed (height) - 1;
|
||||
b = RenderSampleFloorY (b, bpp);
|
||||
|
||||
if (b >= t)
|
||||
{
|
||||
/* initialize edge walkers */
|
||||
RenderEdgeInit (&l, bpp, t,
|
||||
traps->top.l + x_off_fixed,
|
||||
traps->top.y + y_off_fixed,
|
||||
traps->bot.l + x_off_fixed,
|
||||
traps->bot.y + y_off_fixed);
|
||||
|
||||
RenderEdgeInit (&r, bpp, t,
|
||||
traps->top.r + x_off_fixed,
|
||||
traps->top.y + y_off_fixed,
|
||||
traps->bot.r + x_off_fixed,
|
||||
traps->bot.y + y_off_fixed);
|
||||
|
||||
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
|
||||
}
|
||||
traps++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
fbRasterizeTrapezoid (PicturePtr pPicture,
|
||||
const xTrapezoid *trap,
|
||||
int x_off,
|
||||
int y_off)
|
||||
{
|
||||
FbBits *buf;
|
||||
int bpp;
|
||||
int width;
|
||||
int stride;
|
||||
int height;
|
||||
int pxoff, pyoff;
|
||||
|
||||
xFixed x_off_fixed;
|
||||
xFixed y_off_fixed;
|
||||
RenderEdge l, r;
|
||||
xFixed t, b;
|
||||
|
||||
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
|
||||
|
||||
width = pPicture->pDrawable->width;
|
||||
height = pPicture->pDrawable->height;
|
||||
x_off += pxoff;
|
||||
y_off += pyoff;
|
||||
|
||||
x_off_fixed = IntToxFixed(x_off);
|
||||
y_off_fixed = IntToxFixed(y_off);
|
||||
t = trap->top + y_off_fixed;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
t = RenderSampleCeilY (t, bpp);
|
||||
|
||||
b = trap->bottom + y_off_fixed;
|
||||
if (xFixedToInt (b) >= height)
|
||||
b = IntToxFixed (height) - 1;
|
||||
b = RenderSampleFloorY (b, bpp);
|
||||
|
||||
if (b >= t)
|
||||
{
|
||||
/* initialize edge walkers */
|
||||
RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off);
|
||||
RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off);
|
||||
|
||||
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX: Haven't add addTriangles to libpixman yet. */
|
||||
#if 0
|
||||
static int
|
||||
_GreaterY (xPointFixed *a, xPointFixed *b)
|
||||
{
|
||||
if (a->y == b->y)
|
||||
return a->x > b->x;
|
||||
return a->y > b->y;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that the definition of this function is a bit odd because
|
||||
* of the X coordinate space (y increasing downwards).
|
||||
*/
|
||||
static int
|
||||
_Clockwise (xPointFixed *ref, xPointFixed *a, xPointFixed *b)
|
||||
{
|
||||
xPointFixed ad, bd;
|
||||
|
||||
ad.x = a->x - ref->x;
|
||||
ad.y = a->y - ref->y;
|
||||
bd.x = b->x - ref->x;
|
||||
bd.y = b->y - ref->y;
|
||||
|
||||
return ((xFixed_32_32) bd.y * ad.x - (xFixed_32_32) ad.y * bd.x) < 0;
|
||||
}
|
||||
|
||||
/* FIXME -- this could be made more efficient */
|
||||
void
|
||||
fbAddTriangles (PicturePtr pPicture,
|
||||
INT16 x_off,
|
||||
INT16 y_off,
|
||||
int ntri,
|
||||
xTriangle *tris)
|
||||
{
|
||||
xPointFixed *top, *left, *right, *tmp;
|
||||
xTrapezoid trap;
|
||||
|
||||
for (; ntri; ntri--, tris++)
|
||||
{
|
||||
top = &tris->p1;
|
||||
left = &tris->p2;
|
||||
right = &tris->p3;
|
||||
if (_GreaterY (top, left)) {
|
||||
tmp = left; left = top; top = tmp;
|
||||
}
|
||||
if (_GreaterY (top, right)) {
|
||||
tmp = right; right = top; top = tmp;
|
||||
}
|
||||
if (_Clockwise (top, right, left)) {
|
||||
tmp = right; right = left; left = tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Two cases:
|
||||
*
|
||||
* + +
|
||||
* / \ / \
|
||||
* / \ / \
|
||||
* / + + \
|
||||
* / -- -- \
|
||||
* / -- -- \
|
||||
* / --- --- \
|
||||
* +-- --+
|
||||
*/
|
||||
|
||||
trap.top = top->y;
|
||||
trap.left.p1 = *top;
|
||||
trap.left.p2 = *left;
|
||||
trap.right.p1 = *top;
|
||||
trap.right.p2 = *right;
|
||||
if (right->y < left->y)
|
||||
trap.bottom = right->y;
|
||||
else
|
||||
trap.bottom = left->y;
|
||||
fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off);
|
||||
if (right->y < left->y)
|
||||
{
|
||||
trap.top = right->y;
|
||||
trap.bottom = left->y;
|
||||
trap.right.p1 = *right;
|
||||
trap.right.p2 = *left;
|
||||
}
|
||||
else
|
||||
{
|
||||
trap.top = left->y;
|
||||
trap.bottom = right->y;
|
||||
trap.left.p1 = *left;
|
||||
trap.left.p2 = *right;
|
||||
}
|
||||
fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* RENDER */
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
#define PIXMAN_FB_ACCESSORS
|
||||
|
||||
#include "pixman-compose.c"
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,206 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 1999 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "pixman-private.h"
|
||||
|
||||
#define BOUND(v) (int16_t) ((v) < INT16_MIN ? INT16_MIN : (v) > INT16_MAX ? INT16_MAX : (v))
|
||||
|
||||
static inline pixman_bool_t
|
||||
miClipPictureReg (pixman_region16_t * pRegion,
|
||||
pixman_region16_t * pClip,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
if (pixman_region_n_rects(pRegion) == 1 &&
|
||||
pixman_region_n_rects(pClip) == 1)
|
||||
{
|
||||
pixman_box16_t * pRbox = pixman_region_rectangles(pRegion, NULL);
|
||||
pixman_box16_t * pCbox = pixman_region_rectangles(pClip, NULL);
|
||||
int v;
|
||||
|
||||
if (pRbox->x1 < (v = pCbox->x1 + dx))
|
||||
pRbox->x1 = BOUND(v);
|
||||
if (pRbox->x2 > (v = pCbox->x2 + dx))
|
||||
pRbox->x2 = BOUND(v);
|
||||
if (pRbox->y1 < (v = pCbox->y1 + dy))
|
||||
pRbox->y1 = BOUND(v);
|
||||
if (pRbox->y2 > (v = pCbox->y2 + dy))
|
||||
pRbox->y2 = BOUND(v);
|
||||
if (pRbox->x1 >= pRbox->x2 ||
|
||||
pRbox->y1 >= pRbox->y2)
|
||||
{
|
||||
pixman_region_init (pRegion);
|
||||
}
|
||||
}
|
||||
else if (!pixman_region_not_empty (pClip))
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
if (dx || dy)
|
||||
pixman_region_translate (pRegion, -dx, -dy);
|
||||
if (!pixman_region_intersect (pRegion, pRegion, pClip))
|
||||
return FALSE;
|
||||
if (dx || dy)
|
||||
pixman_region_translate(pRegion, dx, dy);
|
||||
}
|
||||
return pixman_region_not_empty(pRegion);
|
||||
}
|
||||
|
||||
|
||||
static inline pixman_bool_t
|
||||
miClipPictureSrc (pixman_region16_t * pRegion,
|
||||
pixman_image_t * pPicture,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
/* XXX what to do with clipping from transformed pictures? */
|
||||
if (pPicture->common.transform || pPicture->type != BITS)
|
||||
return TRUE;
|
||||
|
||||
if (pPicture->common.repeat)
|
||||
{
|
||||
/* If the clip region was set by a client, then it should be intersected
|
||||
* with the composite region since it's interpreted as happening
|
||||
* after the repeat algorithm.
|
||||
*
|
||||
* If the clip region was not set by a client, then it was imposed by
|
||||
* boundaries of the pixmap, or by sibling or child windows, which means
|
||||
* it should in theory be repeated along. FIXME: we ignore that case.
|
||||
* It is only relevant for windows that are (a) clipped by siblings/children
|
||||
* and (b) used as source. However this case is not useful anyway due
|
||||
* to lack of GraphicsExpose events.
|
||||
*/
|
||||
if (pPicture->common.has_client_clip)
|
||||
{
|
||||
pixman_region_translate ( pRegion, dx, dy);
|
||||
|
||||
if (!pixman_region_intersect (pRegion, pRegion,
|
||||
(pixman_region16_t *) pPicture->common.src_clip))
|
||||
return FALSE;
|
||||
|
||||
pixman_region_translate ( pRegion, -dx, -dy);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return miClipPictureReg (pRegion,
|
||||
pPicture->common.src_clip,
|
||||
dx,
|
||||
dy);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* returns FALSE if the final region is empty. Indistinguishable from
|
||||
* an allocation failure, but rendering ignores those anyways.
|
||||
*/
|
||||
|
||||
pixman_bool_t
|
||||
pixman_compute_composite_region (pixman_region16_t * pRegion,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height)
|
||||
{
|
||||
int v;
|
||||
|
||||
pRegion->extents.x1 = xDst;
|
||||
v = xDst + width;
|
||||
pRegion->extents.x2 = BOUND(v);
|
||||
pRegion->extents.y1 = yDst;
|
||||
v = yDst + height;
|
||||
pRegion->extents.y2 = BOUND(v);
|
||||
pRegion->data = 0;
|
||||
/* Check for empty operation */
|
||||
if (pRegion->extents.x1 >= pRegion->extents.x2 ||
|
||||
pRegion->extents.y1 >= pRegion->extents.y2)
|
||||
{
|
||||
pixman_region_init (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
/* clip against dst */
|
||||
if (!miClipPictureReg (pRegion, &pDst->common.clip_region, 0, 0))
|
||||
{
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pDst->common.alpha_map)
|
||||
{
|
||||
if (!miClipPictureReg (pRegion, &pDst->common.alpha_map->common.clip_region,
|
||||
-pDst->common.alpha_origin.x,
|
||||
-pDst->common.alpha_origin.y))
|
||||
{
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
/* clip against src */
|
||||
if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
|
||||
{
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pSrc->common.alpha_map)
|
||||
{
|
||||
if (!miClipPictureSrc (pRegion, (pixman_image_t *)pSrc->common.alpha_map,
|
||||
xDst - (xSrc + pSrc->common.alpha_origin.x),
|
||||
yDst - (ySrc + pSrc->common.alpha_origin.y)))
|
||||
{
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
/* clip against mask */
|
||||
if (pMask)
|
||||
{
|
||||
if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
|
||||
{
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pMask->common.alpha_map)
|
||||
{
|
||||
if (!miClipPictureSrc (pRegion, (pixman_image_t *)pMask->common.alpha_map,
|
||||
xDst - (xMask + pMask->common.alpha_origin.x),
|
||||
yDst - (yMask + pMask->common.alpha_origin.y)))
|
||||
{
|
||||
pixman_region_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
#define PIXMAN_FB_ACCESSORS
|
||||
|
||||
#include "pixman-edge.c"
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* $Id: pixman-edge-imp.h,v 1.1 2007-07-24 17:08:21 vladimir%pobox.com Exp $
|
||||
*
|
||||
* 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 rasterizeSpan
|
||||
#endif
|
||||
|
||||
static void
|
||||
rasterizeEdges (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;
|
||||
uint32_t stride = (image)->bits.rowstride;
|
||||
uint32_t width = (image)->bits.width;
|
||||
|
||||
line = buf + pixman_fixed_to_int (y) * stride;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
pixman_fixed_t lx;
|
||||
pixman_fixed_t rx;
|
||||
int lxi;
|
||||
int rxi;
|
||||
|
||||
/* clip X */
|
||||
lx = l->x;
|
||||
if (lx < 0)
|
||||
lx = 0;
|
||||
rx = r->x;
|
||||
if (pixman_fixed_to_int (rx) >= width)
|
||||
rx = pixman_int_to_fixed (width);
|
||||
|
||||
/* Skip empty (or backwards) sections */
|
||||
if (rx > lx)
|
||||
{
|
||||
|
||||
/* Find pixel bounds for span */
|
||||
lxi = pixman_fixed_to_int (lx);
|
||||
rxi = pixman_fixed_to_int (rx);
|
||||
|
||||
#if N_BITS == 1
|
||||
{
|
||||
uint32_t *a = line;
|
||||
uint32_t startmask;
|
||||
uint32_t endmask;
|
||||
int nmiddle;
|
||||
int width = rxi - lxi;
|
||||
int x = lxi;
|
||||
|
||||
a += x >> FB_SHIFT;
|
||||
x &= FB_MASK;
|
||||
|
||||
FbMaskBits (x, width, startmask, nmiddle, endmask);
|
||||
if (startmask) {
|
||||
WRITE(a, READ(a) | startmask);
|
||||
a++;
|
||||
}
|
||||
while (nmiddle--)
|
||||
WRITE(a++, FB_ALLONES);
|
||||
if (endmask)
|
||||
WRITE(a, READ(a) | endmask);
|
||||
}
|
||||
#else
|
||||
{
|
||||
DefineAlpha(line,lxi);
|
||||
int lxs;
|
||||
int rxs;
|
||||
|
||||
/* Sample coverage for edge pixels */
|
||||
lxs = RenderSamplesX (lx, N_BITS);
|
||||
rxs = RenderSamplesX (rx, N_BITS);
|
||||
|
||||
/* Add coverage across row */
|
||||
if (lxi == rxi)
|
||||
{
|
||||
AddAlpha (rxs - lxs);
|
||||
}
|
||||
else
|
||||
{
|
||||
int xi;
|
||||
|
||||
AddAlpha (N_X_FRAC(N_BITS) - lxs);
|
||||
StepAlpha;
|
||||
for (xi = lxi + 1; xi < rxi; xi++)
|
||||
{
|
||||
AddAlpha (N_X_FRAC(N_BITS));
|
||||
StepAlpha;
|
||||
}
|
||||
/* Do not add in a 0 alpha here. This check is necessary
|
||||
* to avoid a buffer overrun when rx is exactly on a pixel
|
||||
* boundary.
|
||||
*/
|
||||
if (rxs != 0)
|
||||
AddAlpha (rxs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (y == b)
|
||||
break;
|
||||
|
||||
#if N_BITS > 1
|
||||
if (pixman_fixed_frac (y) != Y_FRAC_LAST(N_BITS))
|
||||
{
|
||||
RenderEdgeStepSmall (l);
|
||||
RenderEdgeStepSmall (r);
|
||||
y += STEP_Y_SMALL(N_BITS);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
RenderEdgeStepBig (l);
|
||||
RenderEdgeStepBig (r);
|
||||
y += STEP_Y_BIG(N_BITS);
|
||||
line += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef rasterizeSpan
|
|
@ -0,0 +1,329 @@
|
|||
/*
|
||||
* $Id: pixman-edge.c,v 1.1 2007-07-24 17:08:21 vladimir%pobox.com Exp $
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
#include "pixman.h"
|
||||
#include "pixman-private.h"
|
||||
|
||||
#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 rasterizeEdges fbRasterizeEdges4
|
||||
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
#define Shift4(o) ((o) << 2)
|
||||
#else
|
||||
#define Shift4(o) ((1-(o)) << 2)
|
||||
#endif
|
||||
|
||||
#define Get4(x,o) (((x) >> Shift4(o)) & 0xf)
|
||||
#define Put4(x,o,v) (((x) & ~(0xf << Shift4(o))) | (((v) & 0xf) << Shift4(o)))
|
||||
|
||||
#define DefineAlpha(line,x) \
|
||||
uint8_t *__ap = (uint8_t *) line + ((x) >> 1); \
|
||||
int __ao = (x) & 1
|
||||
|
||||
#define StepAlpha ((__ap += __ao), (__ao ^= 1))
|
||||
|
||||
#define AddAlpha(a) { \
|
||||
uint8_t __o = READ(__ap); \
|
||||
uint8_t __a = (a) + Get4(__o, __ao); \
|
||||
WRITE(__ap, Put4 (__o, __ao, __a | (0 - ((__a) >> 4)))); \
|
||||
}
|
||||
|
||||
#include "pixman-edge-imp.h"
|
||||
|
||||
#undef AddAlpha
|
||||
#undef StepAlpha
|
||||
#undef DefineAlpha
|
||||
#undef rasterizeEdges
|
||||
#undef N_BITS
|
||||
|
||||
|
||||
/*
|
||||
* 1 bit alpha
|
||||
*/
|
||||
|
||||
#define N_BITS 1
|
||||
#define rasterizeEdges fbRasterizeEdges1
|
||||
|
||||
#include "pixman-edge-imp.h"
|
||||
|
||||
#undef rasterizeEdges
|
||||
#undef N_BITS
|
||||
|
||||
/*
|
||||
* 8 bit alpha
|
||||
*/
|
||||
|
||||
static 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((buf__), clip255 (READ((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
|
||||
fbRasterizeEdges8 (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;
|
||||
int32_t stride = (image)->bits.rowstride;
|
||||
uint32_t width = (image)->bits.width;
|
||||
|
||||
line = buf + pixman_fixed_to_int (y) * stride;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
uint8_t *ap = (uint8_t *) line;
|
||||
pixman_fixed_t lx, rx;
|
||||
int lxi, rxi;
|
||||
|
||||
/* clip X */
|
||||
lx = l->x;
|
||||
if (lx < 0)
|
||||
lx = 0;
|
||||
rx = r->x;
|
||||
if (pixman_fixed_to_int (rx) >= width)
|
||||
rx = pixman_int_to_fixed (width);
|
||||
|
||||
/* Skip empty (or backwards) sections */
|
||||
if (rx > lx)
|
||||
{
|
||||
int lxs, rxs;
|
||||
|
||||
/* Find pixel bounds for span. */
|
||||
lxi = pixman_fixed_to_int (lx);
|
||||
rxi = pixman_fixed_to_int (rx);
|
||||
|
||||
/* Sample coverage for edge pixels */
|
||||
lxs = RenderSamplesX (lx, 8);
|
||||
rxs = RenderSamplesX (rx, 8);
|
||||
|
||||
/* Add coverage across row */
|
||||
if (lxi == rxi)
|
||||
{
|
||||
WRITE(ap +lxi, clip255 (READ(ap + lxi) + rxs - lxs));
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(ap + lxi, clip255 (READ(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);
|
||||
}
|
||||
|
||||
/* Do not add in a 0 alpha here. This check is
|
||||
* necessary to avoid a buffer overrun, (when rx
|
||||
* is exactly on a pixel boundary). */
|
||||
if (rxs)
|
||||
WRITE(ap + rxi, clip255 (READ(ap + rxi) + rxs));
|
||||
}
|
||||
}
|
||||
|
||||
if (y == b) {
|
||||
/* We're done, make sure we clean up any remaining fill. */
|
||||
if (fill_start != fill_end) {
|
||||
if (fill_size == N_Y_FRAC(8))
|
||||
{
|
||||
MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start);
|
||||
}
|
||||
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))
|
||||
{
|
||||
RenderEdgeStepSmall (l);
|
||||
RenderEdgeStepSmall (r);
|
||||
y += STEP_Y_SMALL(8);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderEdgeStepBig (l);
|
||||
RenderEdgeStepBig (r);
|
||||
y += STEP_Y_BIG(8);
|
||||
if (fill_start != fill_end)
|
||||
{
|
||||
if (fill_size == N_Y_FRAC(8))
|
||||
{
|
||||
MEMSET_WRAPPED (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:
|
||||
fbRasterizeEdges1 (image, l, r, t, b);
|
||||
break;
|
||||
case 4:
|
||||
fbRasterizeEdges4 (image, l, r, t, b);
|
||||
break;
|
||||
case 8:
|
||||
fbRasterizeEdges8 (image, l, r, t, b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PIXMAN_FB_ACCESSORS
|
||||
|
||||
void
|
||||
pixman_rasterize_edges (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b)
|
||||
{
|
||||
if (image->common.read_func || image->common.write_func)
|
||||
pixman_rasterize_edges_accessors (image, l, r, t, b);
|
||||
else
|
||||
pixman_rasterize_edges_no_accessors (image, l, r, t, b);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,683 @@
|
|||
/*
|
||||
* Copyright © 2000 SuSE, Inc.
|
||||
* 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 SuSE not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. SuSE makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "pixman.h"
|
||||
#include "pixman-private.h"
|
||||
|
||||
static void
|
||||
init_source_image (source_image_t *image)
|
||||
{
|
||||
image->class = SOURCE_IMAGE_CLASS_UNKNOWN;
|
||||
}
|
||||
|
||||
static pixman_bool_t
|
||||
init_gradient (gradient_t *gradient,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops)
|
||||
{
|
||||
return_val_if_fail (n_stops > 0, FALSE);
|
||||
|
||||
init_source_image (&gradient->common);
|
||||
|
||||
gradient->stops = pixman_malloc_ab (n_stops, sizeof (pixman_gradient_stop_t));
|
||||
if (!gradient->stops)
|
||||
return FALSE;
|
||||
|
||||
memcpy (gradient->stops, stops, n_stops * sizeof (pixman_gradient_stop_t));
|
||||
|
||||
gradient->n_stops = n_stops;
|
||||
|
||||
gradient->stop_range = 0xffff;
|
||||
gradient->color_table = NULL;
|
||||
gradient->color_table_size = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
color_to_uint32 (const pixman_color_t *color)
|
||||
{
|
||||
return
|
||||
(color->alpha >> 8 << 24) |
|
||||
(color->red >> 8 << 16) |
|
||||
(color->green & 0xff00) |
|
||||
(color->blue >> 8);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
allocate_image (void)
|
||||
{
|
||||
pixman_image_t *image = malloc (sizeof (pixman_image_t));
|
||||
|
||||
if (image)
|
||||
{
|
||||
image_common_t *common = &image->common;
|
||||
|
||||
pixman_region_init (&common->full_region);
|
||||
pixman_region_init (&common->clip_region);
|
||||
common->src_clip = &common->full_region;
|
||||
common->has_client_clip = FALSE;
|
||||
common->transform = NULL;
|
||||
common->repeat = PIXMAN_REPEAT_NONE;
|
||||
common->filter = PIXMAN_FILTER_NEAREST;
|
||||
common->filter_params = NULL;
|
||||
common->n_filter_params = 0;
|
||||
common->alpha_map = NULL;
|
||||
common->component_alpha = FALSE;
|
||||
common->ref_count = 1;
|
||||
common->read_func = NULL;
|
||||
common->write_func = NULL;
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/* Ref Counting */
|
||||
pixman_image_t *
|
||||
pixman_image_ref (pixman_image_t *image)
|
||||
{
|
||||
image->common.ref_count++;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
void
|
||||
pixman_image_unref (pixman_image_t *image)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
common->ref_count--;
|
||||
|
||||
if (common->ref_count == 0)
|
||||
{
|
||||
pixman_region_fini (&common->clip_region);
|
||||
pixman_region_fini (&common->full_region);
|
||||
|
||||
if (common->transform)
|
||||
free (common->transform);
|
||||
|
||||
if (common->filter_params)
|
||||
free (common->filter_params);
|
||||
|
||||
if (common->alpha_map)
|
||||
pixman_image_unref ((pixman_image_t *)common->alpha_map);
|
||||
|
||||
#if 0
|
||||
if (image->type == BITS && image->bits.indexed)
|
||||
free (image->bits.indexed);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
memset (image, 0xaa, sizeof (pixman_image_t));
|
||||
#endif
|
||||
if (image->type == LINEAR || image->type == RADIAL || image->type == CONICAL)
|
||||
{
|
||||
if (image->gradient.stops)
|
||||
free (image->gradient.stops);
|
||||
}
|
||||
|
||||
|
||||
if (image->type == BITS && image->bits.free_me)
|
||||
free (image->bits.free_me);
|
||||
|
||||
free (image);
|
||||
}
|
||||
}
|
||||
|
||||
/* Constructors */
|
||||
pixman_image_t *
|
||||
pixman_image_create_solid_fill (pixman_color_t *color)
|
||||
{
|
||||
pixman_image_t *img = allocate_image();
|
||||
if (!img)
|
||||
return NULL;
|
||||
|
||||
init_source_image (&img->solid.common);
|
||||
|
||||
img->type = SOLID;
|
||||
img->solid.color = color_to_uint32 (color);
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
pixman_image_t *
|
||||
pixman_image_create_linear_gradient (pixman_point_fixed_t *p1,
|
||||
pixman_point_fixed_t *p2,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops)
|
||||
{
|
||||
pixman_image_t *image;
|
||||
linear_gradient_t *linear;
|
||||
|
||||
return_val_if_fail (n_stops >= 2, NULL);
|
||||
|
||||
image = allocate_image();
|
||||
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
linear = &image->linear;
|
||||
|
||||
if (!init_gradient (&linear->common, stops, n_stops))
|
||||
{
|
||||
free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
linear->p1 = *p1;
|
||||
linear->p2 = *p2;
|
||||
|
||||
image->type = LINEAR;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
pixman_image_t *
|
||||
pixman_image_create_radial_gradient (pixman_point_fixed_t *inner,
|
||||
pixman_point_fixed_t *outer,
|
||||
pixman_fixed_t inner_radius,
|
||||
pixman_fixed_t outer_radius,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops)
|
||||
{
|
||||
pixman_image_t *image;
|
||||
radial_gradient_t *radial;
|
||||
|
||||
return_val_if_fail (n_stops >= 2, NULL);
|
||||
|
||||
image = allocate_image();
|
||||
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
radial = &image->radial;
|
||||
|
||||
if (!init_gradient (&radial->common, stops, n_stops))
|
||||
{
|
||||
free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image->type = RADIAL;
|
||||
|
||||
radial->c1.x = inner->x;
|
||||
radial->c1.y = inner->y;
|
||||
radial->c1.radius = inner_radius;
|
||||
radial->c2.x = outer->x;
|
||||
radial->c2.y = outer->y;
|
||||
radial->c2.radius = outer_radius;
|
||||
radial->cdx = pixman_fixed_to_double (radial->c2.x - radial->c1.x);
|
||||
radial->cdy = pixman_fixed_to_double (radial->c2.y - radial->c1.y);
|
||||
radial->dr = pixman_fixed_to_double (radial->c2.radius - radial->c1.radius);
|
||||
radial->A = (radial->cdx * radial->cdx
|
||||
+ radial->cdy * radial->cdy
|
||||
- radial->dr * radial->dr);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
pixman_image_t *
|
||||
pixman_image_create_conical_gradient (pixman_point_fixed_t *center,
|
||||
pixman_fixed_t angle,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops)
|
||||
{
|
||||
pixman_image_t *image = allocate_image();
|
||||
conical_gradient_t *conical;
|
||||
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
conical = &image->conical;
|
||||
|
||||
if (!init_gradient (&conical->common, stops, n_stops))
|
||||
{
|
||||
free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image->type = CONICAL;
|
||||
conical->center = *center;
|
||||
conical->angle = angle;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static uint32_t *
|
||||
create_bits (pixman_format_code_t format,
|
||||
int width,
|
||||
int height,
|
||||
int *rowstride_bytes)
|
||||
{
|
||||
int stride;
|
||||
int buf_size;
|
||||
int bpp;
|
||||
|
||||
bpp = PIXMAN_FORMAT_BPP (format);
|
||||
stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (uint32_t);
|
||||
buf_size = height * stride;
|
||||
|
||||
if (rowstride_bytes)
|
||||
*rowstride_bytes = stride;
|
||||
|
||||
return calloc (buf_size, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
reset_clip_region (pixman_image_t *image)
|
||||
{
|
||||
pixman_region_fini (&image->common.clip_region);
|
||||
|
||||
if (image->type == BITS)
|
||||
{
|
||||
pixman_region_init_rect (&image->common.clip_region, 0, 0,
|
||||
image->bits.width, image->bits.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
pixman_region_init (&image->common.clip_region);
|
||||
}
|
||||
}
|
||||
|
||||
pixman_image_t *
|
||||
pixman_image_create_bits (pixman_format_code_t format,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t *bits,
|
||||
int rowstride_bytes)
|
||||
{
|
||||
pixman_image_t *image;
|
||||
uint32_t *free_me = NULL;
|
||||
|
||||
/* must be a whole number of uint32_t's
|
||||
*/
|
||||
return_val_if_fail (bits == NULL ||
|
||||
(rowstride_bytes % sizeof (uint32_t)) == 0, NULL);
|
||||
|
||||
if (!bits)
|
||||
{
|
||||
free_me = bits = create_bits (format, width, height, &rowstride_bytes);
|
||||
if (!bits)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image = allocate_image();
|
||||
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
image->type = BITS;
|
||||
image->bits.format = format;
|
||||
image->bits.width = width;
|
||||
image->bits.height = height;
|
||||
image->bits.bits = bits;
|
||||
image->bits.free_me = free_me;
|
||||
|
||||
image->bits.rowstride = rowstride_bytes / sizeof (uint32_t); /* we store it in number
|
||||
* of uint32_t's
|
||||
*/
|
||||
image->bits.indexed = NULL;
|
||||
|
||||
pixman_region_fini (&image->common.full_region);
|
||||
pixman_region_init_rect (&image->common.full_region, 0, 0,
|
||||
image->bits.width, image->bits.height);
|
||||
|
||||
reset_clip_region (image);
|
||||
return image;
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_image_set_clip_region (pixman_image_t *image,
|
||||
pixman_region16_t *region)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
if (region)
|
||||
{
|
||||
return pixman_region_copy (&common->clip_region, region);
|
||||
}
|
||||
else
|
||||
{
|
||||
reset_clip_region (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sets whether the clip region includes a clip region set by the client
|
||||
*/
|
||||
void
|
||||
pixman_image_set_has_client_clip (pixman_image_t *image,
|
||||
pixman_bool_t client_clip)
|
||||
{
|
||||
image->common.has_client_clip = client_clip;
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_image_set_transform (pixman_image_t *image,
|
||||
const pixman_transform_t *transform)
|
||||
{
|
||||
static const pixman_transform_t id =
|
||||
{
|
||||
{ { pixman_fixed_1, 0, 0 },
|
||||
{ 0, pixman_fixed_1, 0 },
|
||||
{ 0, 0, pixman_fixed_1 }
|
||||
}
|
||||
};
|
||||
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
if (common->transform == transform)
|
||||
return TRUE;
|
||||
|
||||
if (memcmp (&id, transform, sizeof (pixman_transform_t)) == 0)
|
||||
{
|
||||
transform = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (common->transform)
|
||||
free (common->transform);
|
||||
|
||||
if (transform)
|
||||
{
|
||||
common->transform = malloc (sizeof (pixman_transform_t));
|
||||
if (!common->transform)
|
||||
return FALSE;
|
||||
|
||||
*common->transform = *transform;
|
||||
}
|
||||
else
|
||||
{
|
||||
common->transform = NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
pixman_image_set_repeat (pixman_image_t *image,
|
||||
pixman_repeat_t repeat)
|
||||
{
|
||||
image->common.repeat = repeat;
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_image_set_filter (pixman_image_t *image,
|
||||
pixman_filter_t filter,
|
||||
const pixman_fixed_t *params,
|
||||
int n_params)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
pixman_fixed_t *new_params;
|
||||
|
||||
if (params == common->filter_params && filter == common->filter)
|
||||
return TRUE;
|
||||
|
||||
new_params = NULL;
|
||||
if (params)
|
||||
{
|
||||
new_params = pixman_malloc_ab (n_params, sizeof (pixman_fixed_t));
|
||||
if (!new_params)
|
||||
return FALSE;
|
||||
|
||||
memcpy (new_params,
|
||||
params, n_params * sizeof (pixman_fixed_t));
|
||||
}
|
||||
|
||||
common->filter = filter;
|
||||
|
||||
if (common->filter_params)
|
||||
free (common->filter_params);
|
||||
|
||||
common->filter_params = new_params;
|
||||
common->n_filter_params = n_params;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Unlike all the other property setters, this function does not
|
||||
* copy the content of indexed. Doing this copying is simply
|
||||
* way, way too expensive.
|
||||
*/
|
||||
void
|
||||
pixman_image_set_indexed (pixman_image_t *image,
|
||||
const pixman_indexed_t *indexed)
|
||||
{
|
||||
bits_image_t *bits = (bits_image_t *)image;
|
||||
|
||||
bits->indexed = indexed;
|
||||
}
|
||||
|
||||
void
|
||||
pixman_image_set_alpha_map (pixman_image_t *image,
|
||||
pixman_image_t *alpha_map,
|
||||
int16_t x,
|
||||
int16_t y)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
return_if_fail (!alpha_map || alpha_map->type == BITS);
|
||||
|
||||
if (common->alpha_map != (bits_image_t *)alpha_map)
|
||||
{
|
||||
if (common->alpha_map)
|
||||
pixman_image_unref ((pixman_image_t *)common->alpha_map);
|
||||
|
||||
if (alpha_map)
|
||||
common->alpha_map = (bits_image_t *)pixman_image_ref (alpha_map);
|
||||
else
|
||||
common->alpha_map = NULL;
|
||||
}
|
||||
|
||||
common->alpha_origin.x = x;
|
||||
common->alpha_origin.y = y;
|
||||
}
|
||||
|
||||
void
|
||||
pixman_image_set_component_alpha (pixman_image_t *image,
|
||||
pixman_bool_t component_alpha)
|
||||
{
|
||||
image->common.component_alpha = component_alpha;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pixman_image_set_accessors (pixman_image_t *image,
|
||||
pixman_read_memory_func_t read_func,
|
||||
pixman_write_memory_func_t write_func)
|
||||
{
|
||||
return_if_fail (image != NULL);
|
||||
|
||||
image->common.read_func = read_func;
|
||||
image->common.write_func = write_func;
|
||||
}
|
||||
|
||||
uint32_t *
|
||||
pixman_image_get_data (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return image->bits.bits;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
pixman_image_get_width (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return image->bits.width;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pixman_image_get_height (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return image->bits.height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pixman_image_get_stride (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return image->bits.rowstride * sizeof (uint32_t);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pixman_image_get_depth (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return PIXMAN_FORMAT_DEPTH (image->bits.format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
color_to_pixel (pixman_color_t *color,
|
||||
uint32_t *pixel,
|
||||
pixman_format_code_t format)
|
||||
{
|
||||
uint32_t c = color_to_uint32 (color);
|
||||
|
||||
if (!(format == PIXMAN_a8r8g8b8 ||
|
||||
format == PIXMAN_x8r8g8b8 ||
|
||||
format == PIXMAN_a8b8g8r8 ||
|
||||
format == PIXMAN_x8b8g8r8 ||
|
||||
format == PIXMAN_r5g6b5 ||
|
||||
format == PIXMAN_b5g6r5 ||
|
||||
format == PIXMAN_a8))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_ABGR)
|
||||
{
|
||||
c = ((c & 0xff000000) >> 0) |
|
||||
((c & 0x00ff0000) >> 16) |
|
||||
((c & 0x0000ff00) >> 0) |
|
||||
((c & 0x000000ff) << 16);
|
||||
}
|
||||
|
||||
if (format == PIXMAN_a8)
|
||||
c = c >> 24;
|
||||
else if (format == PIXMAN_r5g6b5 ||
|
||||
format == PIXMAN_b5g6r5)
|
||||
c = cvt8888to0565 (c);
|
||||
|
||||
#if 0
|
||||
printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);
|
||||
printf ("pixel: %x\n", c);
|
||||
#endif
|
||||
|
||||
*pixel = c;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_image_fill_rectangles (pixman_op_t op,
|
||||
pixman_image_t *dest,
|
||||
pixman_color_t *color,
|
||||
int n_rects,
|
||||
const pixman_rectangle16_t *rects)
|
||||
{
|
||||
pixman_image_t *solid;
|
||||
pixman_color_t c;
|
||||
int i;
|
||||
|
||||
if (color->alpha == 0xffff)
|
||||
{
|
||||
if (op == PIXMAN_OP_OVER)
|
||||
op = PIXMAN_OP_SRC;
|
||||
}
|
||||
|
||||
if (op == PIXMAN_OP_CLEAR)
|
||||
{
|
||||
c.red = 0;
|
||||
c.green = 0;
|
||||
c.blue = 0;
|
||||
c.alpha = 0;
|
||||
|
||||
color = &c;
|
||||
|
||||
op = PIXMAN_OP_SRC;
|
||||
}
|
||||
|
||||
if (op == PIXMAN_OP_SRC)
|
||||
{
|
||||
uint32_t pixel;
|
||||
|
||||
if (color_to_pixel (color, &pixel, dest->bits.format))
|
||||
{
|
||||
for (i = 0; i < n_rects; ++i)
|
||||
{
|
||||
pixman_region16_t fill_region;
|
||||
int n_boxes, j;
|
||||
pixman_box16_t *boxes;
|
||||
|
||||
pixman_region_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
|
||||
pixman_region_intersect (&fill_region, &fill_region, &dest->common.clip_region);
|
||||
|
||||
boxes = pixman_region_rectangles (&fill_region, &n_boxes);
|
||||
for (j = 0; j < n_boxes; ++j)
|
||||
{
|
||||
const pixman_box16_t *box = &(boxes[j]);
|
||||
pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
|
||||
box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1,
|
||||
pixel);
|
||||
}
|
||||
|
||||
pixman_region_fini (&fill_region);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
solid = pixman_image_create_solid_fill (color);
|
||||
if (!solid)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < n_rects; ++i)
|
||||
{
|
||||
const pixman_rectangle16_t *rect = &(rects[i]);
|
||||
|
||||
pixman_image_composite (op, solid, NULL, dest,
|
||||
0, 0, 0, 0,
|
||||
rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
}
|
||||
|
||||
pixman_image_unref (solid);
|
||||
|
||||
return TRUE;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,315 @@
|
|||
/*
|
||||
* Copyright © 2004 Red Hat, Inc.
|
||||
* Copyright © 2005 Trolltech AS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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: Søren Sandmann (sandmann@redhat.com)
|
||||
* Lars Knoll (lars@trolltech.com)
|
||||
*
|
||||
* Based on work by Owen Taylor
|
||||
*/
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#ifdef USE_MMX
|
||||
|
||||
#if !defined(__amd64__) && !defined(__x86_64__)
|
||||
pixman_bool_t pixman_have_mmx(void);
|
||||
#else
|
||||
#define pixman_have_mmx() TRUE
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define pixman_have_mmx() FALSE
|
||||
#endif
|
||||
|
||||
#ifdef USE_MMX
|
||||
|
||||
pixman_bool_t
|
||||
pixman_blt_mmx (uint32_t *src_bits,
|
||||
uint32_t *dst_bits,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
int src_bpp,
|
||||
int dst_bpp,
|
||||
int src_x, int src_y,
|
||||
int dst_x, int dst_y,
|
||||
int width, int height);
|
||||
pixman_bool_t
|
||||
pixman_fill_mmx (uint32_t *bits,
|
||||
int stride,
|
||||
int bpp,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t xor);
|
||||
|
||||
void fbComposeSetupMMX(void);
|
||||
|
||||
void fbCompositeSolidMask_nx8888x0565Cmmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrcAdd_8888x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void
|
||||
fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void
|
||||
fbCompositeSrc_x888xnx8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolidMask_nx8888x8888Cmmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolidMask_nx8x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeIn_nx8x8mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeIn_8x8mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrcAdd_8888x8x8mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888RevNPx8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888x0565mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolid_nx8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolid_nx0565mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolidMask_nx8x0565mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888x8x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeCopyAreammx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void
|
||||
fbCompositeOver_x888x8x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
#endif /* USE_MMX */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,821 @@
|
|||
#ifndef PACKAGE
|
||||
# error config.h must be included before pixman-private.h
|
||||
#endif
|
||||
|
||||
#ifndef PIXMAN_PRIVATE_H
|
||||
#define PIXMAN_PRIVATE_H
|
||||
|
||||
#include "pixman.h"
|
||||
#include <time.h>
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#define MSBFirst 0
|
||||
#define LSBFirst 1
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define IMAGE_BYTE_ORDER MSBFirst
|
||||
# define BITMAP_BIT_ORDER MSBFirst
|
||||
#else
|
||||
# define IMAGE_BYTE_ORDER LSBFirst
|
||||
# define BITMAP_BIT_ORDER LSBFirst
|
||||
#endif
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
#if defined (__GNUC__)
|
||||
# define FUNC ((const char*) (__PRETTY_FUNCTION__))
|
||||
#elif defined (__sun) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
||||
# define FUNC ((const char*) (__func__))
|
||||
#else
|
||||
# define FUNC ((const char*) ("???"))
|
||||
#endif
|
||||
|
||||
|
||||
#define FB_SHIFT 5
|
||||
#define FB_UNIT (1 << FB_SHIFT)
|
||||
#define FB_HALFUNIT (1 << (FB_SHIFT-1))
|
||||
#define FB_MASK (FB_UNIT - 1)
|
||||
#define FB_ALLONES ((uint32_t) -1)
|
||||
|
||||
/* Memory allocation helpers */
|
||||
void *pixman_malloc_ab (unsigned int n, unsigned int b);
|
||||
void *pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
|
||||
|
||||
#if DEBUG
|
||||
|
||||
#define return_if_fail(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \
|
||||
return; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define return_val_if_fail(expr, retval) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \
|
||||
return (retval); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define return_if_fail(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
return; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define return_val_if_fail(expr, retval) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
return (retval); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct image_common image_common_t;
|
||||
typedef struct source_image source_image_t;
|
||||
typedef struct solid_fill solid_fill_t;
|
||||
typedef struct gradient gradient_t;
|
||||
typedef struct linear_gradient linear_gradient_t;
|
||||
typedef struct horizontal_gradient horizontal_gradient_t;
|
||||
typedef struct vertical_gradient vertical_gradient_t;
|
||||
typedef struct conical_gradient conical_gradient_t;
|
||||
typedef struct radial_gradient radial_gradient_t;
|
||||
typedef struct bits_image bits_image_t;
|
||||
typedef struct circle circle_t;
|
||||
typedef struct point point_t;
|
||||
|
||||
/* FIXME - the types and structures below should be give proper names
|
||||
*/
|
||||
|
||||
#define FASTCALL
|
||||
typedef FASTCALL void (*CombineMaskU) (uint32_t *src, const uint32_t *mask, int width);
|
||||
typedef FASTCALL void (*CombineFuncU) (uint32_t *dest, const uint32_t *src, int width);
|
||||
typedef FASTCALL void (*CombineFuncC) (uint32_t *dest, uint32_t *src, uint32_t *mask, int width);
|
||||
|
||||
typedef struct _FbComposeData {
|
||||
uint8_t op;
|
||||
pixman_image_t *src;
|
||||
pixman_image_t *mask;
|
||||
pixman_image_t *dest;
|
||||
int16_t xSrc;
|
||||
int16_t ySrc;
|
||||
int16_t xMask;
|
||||
int16_t yMask;
|
||||
int16_t xDest;
|
||||
int16_t yDest;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
} FbComposeData;
|
||||
|
||||
typedef struct _FbComposeFunctions {
|
||||
CombineFuncU *combineU;
|
||||
CombineFuncC *combineC;
|
||||
CombineMaskU combineMaskU;
|
||||
} FbComposeFunctions;
|
||||
|
||||
extern FbComposeFunctions pixman_composeFunctions;
|
||||
|
||||
void pixman_composite_rect_general_accessors (const FbComposeData *data,
|
||||
uint32_t *scanline_buffer);
|
||||
void pixman_composite_rect_general (const FbComposeData *data,
|
||||
uint32_t *scanline_buffer);
|
||||
|
||||
/* end */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BITS,
|
||||
LINEAR,
|
||||
CONICAL,
|
||||
RADIAL,
|
||||
SOLID
|
||||
} image_type_t;
|
||||
|
||||
#define IS_SOURCE_IMAGE(img) (((image_common_t *)img)->type > BITS)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SOURCE_IMAGE_CLASS_UNKNOWN,
|
||||
SOURCE_IMAGE_CLASS_HORIZONTAL,
|
||||
SOURCE_IMAGE_CLASS_VERTICAL
|
||||
} source_pict_class_t;
|
||||
|
||||
struct point
|
||||
{
|
||||
int16_t x, y;
|
||||
};
|
||||
|
||||
struct image_common
|
||||
{
|
||||
image_type_t type;
|
||||
int32_t ref_count;
|
||||
pixman_region16_t full_region;
|
||||
pixman_region16_t clip_region;
|
||||
pixman_region16_t *src_clip;
|
||||
pixman_bool_t has_client_clip;
|
||||
pixman_transform_t *transform;
|
||||
pixman_repeat_t repeat;
|
||||
pixman_filter_t filter;
|
||||
pixman_fixed_t *filter_params;
|
||||
int n_filter_params;
|
||||
bits_image_t *alpha_map;
|
||||
point_t alpha_origin;
|
||||
pixman_bool_t component_alpha;
|
||||
pixman_read_memory_func_t read_func;
|
||||
pixman_write_memory_func_t write_func;
|
||||
};
|
||||
|
||||
struct source_image
|
||||
{
|
||||
image_common_t common;
|
||||
source_pict_class_t class;
|
||||
};
|
||||
|
||||
struct solid_fill
|
||||
{
|
||||
source_image_t common;
|
||||
uint32_t color; /* FIXME: shouldn't this be a pixman_color_t? */
|
||||
};
|
||||
|
||||
struct gradient
|
||||
{
|
||||
source_image_t common;
|
||||
int n_stops;
|
||||
pixman_gradient_stop_t * stops;
|
||||
int stop_range;
|
||||
uint32_t * color_table;
|
||||
int color_table_size;
|
||||
};
|
||||
|
||||
struct linear_gradient
|
||||
{
|
||||
gradient_t common;
|
||||
pixman_point_fixed_t p1;
|
||||
pixman_point_fixed_t p2;
|
||||
};
|
||||
|
||||
struct circle
|
||||
{
|
||||
pixman_fixed_t x;
|
||||
pixman_fixed_t y;
|
||||
pixman_fixed_t radius;
|
||||
};
|
||||
|
||||
struct radial_gradient
|
||||
{
|
||||
gradient_t common;
|
||||
|
||||
circle_t c1;
|
||||
circle_t c2;
|
||||
double cdx;
|
||||
double cdy;
|
||||
double dr;
|
||||
double A;
|
||||
};
|
||||
|
||||
struct conical_gradient
|
||||
{
|
||||
gradient_t common;
|
||||
pixman_point_fixed_t center;
|
||||
pixman_fixed_t angle;
|
||||
};
|
||||
|
||||
struct bits_image
|
||||
{
|
||||
image_common_t common;
|
||||
pixman_format_code_t format;
|
||||
const pixman_indexed_t *indexed;
|
||||
int width;
|
||||
int height;
|
||||
uint32_t * bits;
|
||||
uint32_t * free_me;
|
||||
int rowstride; /* in number of uint32_t's */
|
||||
};
|
||||
|
||||
union pixman_image
|
||||
{
|
||||
image_type_t type;
|
||||
image_common_t common;
|
||||
bits_image_t bits;
|
||||
gradient_t gradient;
|
||||
linear_gradient_t linear;
|
||||
conical_gradient_t conical;
|
||||
radial_gradient_t radial;
|
||||
solid_fill_t solid;
|
||||
};
|
||||
|
||||
#define LOG2_BITMAP_PAD 5
|
||||
#define FB_STIP_SHIFT LOG2_BITMAP_PAD
|
||||
#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
|
||||
#define FB_STIP_MASK (FB_STIP_UNIT - 1)
|
||||
#define FB_STIP_ALLONES ((uint32_t) -1)
|
||||
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
#define FbScrLeft(x,n) ((x) >> (n))
|
||||
#define FbScrRight(x,n) ((x) << (n))
|
||||
#define FbLeftStipBits(x,n) ((x) & ((((uint32_t) 1) << (n)) - 1))
|
||||
#else
|
||||
#define FbScrLeft(x,n) ((x) << (n))
|
||||
#define FbScrRight(x,n) ((x) >> (n))
|
||||
#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
|
||||
#endif
|
||||
|
||||
#define FbStipLeft(x,n) FbScrLeft(x,n)
|
||||
#define FbStipRight(x,n) FbScrRight(x,n)
|
||||
#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
|
||||
FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
|
||||
|
||||
#define FbLeftMask(x) ( ((x) & FB_MASK) ? \
|
||||
FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
|
||||
#define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
|
||||
FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
|
||||
|
||||
#define FbMaskBits(x,w,l,n,r) { \
|
||||
n = (w); \
|
||||
r = FbRightMask((x)+n); \
|
||||
l = FbLeftMask(x); \
|
||||
if (l) { \
|
||||
n -= FB_UNIT - ((x) & FB_MASK); \
|
||||
if (n < 0) { \
|
||||
n = 0; \
|
||||
l &= r; \
|
||||
r = 0; \
|
||||
} \
|
||||
} \
|
||||
n >>= FB_SHIFT; \
|
||||
}
|
||||
|
||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
||||
#define Fetch24(a) ((unsigned long) (a) & 1 ? \
|
||||
((READ(a) << 16) | READ((uint16_t *) ((a)+1))) : \
|
||||
((READ((uint16_t *) (a)) << 8) | READ((a)+2)))
|
||||
#define Store24(a,v) ((unsigned long) (a) & 1 ? \
|
||||
(WRITE(a, (uint8_t) ((v) >> 16)), \
|
||||
WRITE((uint16_t *) ((a)+1), (uint16_t) (v))) : \
|
||||
(WRITE((uint16_t *) (a), (uint16_t) ((v) >> 8)), \
|
||||
WRITE((a)+2, (uint8_t) (v))))
|
||||
#else
|
||||
#define Fetch24(a) ((unsigned long) (a) & 1 ? \
|
||||
(READ(a) | (READ((uint16_t *) ((a)+1)) << 8)) : \
|
||||
(READ((uint16_t *) (a)) | (READ((a)+2) << 16)))
|
||||
#define Store24(a,v) ((unsigned long) (a) & 1 ? \
|
||||
(WRITE(a, (uint8_t) (v)), \
|
||||
WRITE((uint16_t *) ((a)+1), (uint16_t) ((v) >> 8))) : \
|
||||
(WRITE((uint16_t *) (a), (uint16_t) (v)), \
|
||||
WRITE((a)+2, (uint8_t) ((v) >> 16))))
|
||||
#endif
|
||||
|
||||
#define Alpha(x) ((x) >> 24)
|
||||
#define Red(x) (((x) >> 16) & 0xff)
|
||||
#define Green(x) (((x) >> 8) & 0xff)
|
||||
#define Blue(x) ((x) & 0xff)
|
||||
|
||||
#define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \
|
||||
(((s) >> 8) & 0xff) * 301 + \
|
||||
(((s) ) & 0xff) * 58) >> 2)
|
||||
#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
|
||||
(((s) >> 6) & 0x03e0) | \
|
||||
(((s) >> 9) & 0x7c00))
|
||||
#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
|
||||
#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
|
||||
|
||||
#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
|
||||
|
||||
|
||||
#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
|
||||
#define FbIntDiv(a,b) (((uint16_t) (a) * 255) / (b))
|
||||
|
||||
#define FbGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i))
|
||||
|
||||
|
||||
#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
|
||||
(((s) >> 5) & 0x07e0) | \
|
||||
(((s) >> 8) & 0xf800))
|
||||
#define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
|
||||
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
|
||||
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
|
||||
|
||||
/*
|
||||
* There are two ways of handling alpha -- either as a single unified value or
|
||||
* a separate value for each component, hence each macro must have two
|
||||
* versions. The unified alpha version has a 'U' at the end of the name,
|
||||
* the component version has a 'C'. Similarly, functions which deal with
|
||||
* this difference will have two versions using the same convention.
|
||||
*/
|
||||
|
||||
#define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i), \
|
||||
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
|
||||
|
||||
#define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i), \
|
||||
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
|
||||
|
||||
#define FbInU(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),(a),(t)) << (i))
|
||||
|
||||
#define FbInC(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i))
|
||||
|
||||
#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (FbIntMult(FbGet8(y,i),ay,(u)) + \
|
||||
FbIntMult(FbGet8(x,i),ax,(v))), \
|
||||
(uint32_t) ((uint8_t) ((t) | \
|
||||
(0 - ((t) >> 8)))) << (i))
|
||||
|
||||
#define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \
|
||||
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
|
||||
|
||||
|
||||
/*
|
||||
The methods below use some tricks to be able to do two color
|
||||
components at the same time.
|
||||
*/
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255
|
||||
*/
|
||||
#define FbByteMul(x, a) do { \
|
||||
uint32_t t = ((x & 0xff00ff) * a) + 0x800080; \
|
||||
t = (t + ((t >> 8) & 0xff00ff)) >> 8; \
|
||||
t &= 0xff00ff; \
|
||||
\
|
||||
x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \
|
||||
x = (x + ((x >> 8) & 0xff00ff)); \
|
||||
x &= 0xff00ff00; \
|
||||
x += t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255 + y
|
||||
*/
|
||||
#define FbByteMulAdd(x, a, y) do { \
|
||||
uint32_t t = ((x & 0xff00ff) * a) + 0x800080; \
|
||||
t = (t + ((t >> 8) & 0xff00ff)) >> 8; \
|
||||
t &= 0xff00ff; \
|
||||
t += y & 0xff00ff; \
|
||||
t |= 0x1000100 - ((t >> 8) & 0xff00ff); \
|
||||
t &= 0xff00ff; \
|
||||
\
|
||||
x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \
|
||||
x = (x + ((x >> 8) & 0xff00ff)) >> 8; \
|
||||
x &= 0xff00ff; \
|
||||
x += (y >> 8) & 0xff00ff; \
|
||||
x |= 0x1000100 - ((x >> 8) & 0xff00ff); \
|
||||
x &= 0xff00ff; \
|
||||
x <<= 8; \
|
||||
x += t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a + y_c * b) / 255
|
||||
*/
|
||||
#define FbByteAddMul(x, a, y, b) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x >> 24) * a + (y >> 24) * b + 0x80; \
|
||||
r += (r >> 8); \
|
||||
r >>= 8; \
|
||||
\
|
||||
t = (x & 0xff00) * a + (y & 0xff00) * b; \
|
||||
t += (t >> 8) + 0x8000; \
|
||||
t >>= 16; \
|
||||
\
|
||||
t |= r << 16; \
|
||||
t |= 0x1000100 - ((t >> 8) & 0xff00ff); \
|
||||
t &= 0xff00ff; \
|
||||
t <<= 8; \
|
||||
\
|
||||
r = ((x >> 16) & 0xff) * a + ((y >> 16) & 0xff) * b + 0x80; \
|
||||
r += (r >> 8); \
|
||||
r >>= 8; \
|
||||
\
|
||||
x = (x & 0xff) * a + (y & 0xff) * b + 0x80; \
|
||||
x += (x >> 8); \
|
||||
x >>= 8; \
|
||||
x |= r << 16; \
|
||||
x |= 0x1000100 - ((x >> 8) & 0xff00ff); \
|
||||
x &= 0xff00ff; \
|
||||
x |= t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a + y_c *b) / 256
|
||||
*/
|
||||
#define FbByteAddMul_256(x, a, y, b) do { \
|
||||
uint32_t t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; \
|
||||
t >>= 8; \
|
||||
t &= 0xff00ff; \
|
||||
\
|
||||
x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; \
|
||||
x &= 0xff00ff00; \
|
||||
x += t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a_c) / 255
|
||||
*/
|
||||
#define FbByteMulC(x, a) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x & 0xff) * (a & 0xff); \
|
||||
r |= (x & 0xff0000) * ((a >> 16) & 0xff); \
|
||||
r += 0x800080; \
|
||||
r = (r + ((r >> 8) & 0xff00ff)) >> 8; \
|
||||
r &= 0xff00ff; \
|
||||
\
|
||||
x >>= 8; \
|
||||
t = (x & 0xff) * ((a >> 8) & 0xff); \
|
||||
t |= (x & 0xff0000) * (a >> 24); \
|
||||
t += 0x800080; \
|
||||
t = t + ((t >> 8) & 0xff00ff); \
|
||||
x = r | (t & 0xff00ff00); \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255 + y
|
||||
*/
|
||||
#define FbByteMulAddC(x, a, y) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x & 0xff) * (a & 0xff); \
|
||||
r |= (x & 0xff0000) * ((a >> 16) & 0xff); \
|
||||
r += 0x800080; \
|
||||
r = (r + ((r >> 8) & 0xff00ff)) >> 8; \
|
||||
r &= 0xff00ff; \
|
||||
r += y & 0xff00ff; \
|
||||
r |= 0x1000100 - ((r >> 8) & 0xff00ff); \
|
||||
r &= 0xff00ff; \
|
||||
\
|
||||
x >>= 8; \
|
||||
t = (x & 0xff) * ((a >> 8) & 0xff); \
|
||||
t |= (x & 0xff0000) * (a >> 24); \
|
||||
t += 0x800080; \
|
||||
t = (t + ((t >> 8) & 0xff00ff)) >> 8; \
|
||||
t &= 0xff00ff; \
|
||||
t += (y >> 8) & 0xff00ff; \
|
||||
t |= 0x1000100 - ((t >> 8) & 0xff00ff); \
|
||||
t &= 0xff00ff; \
|
||||
x = r | (t << 8); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a_c + y_c * b) / 255
|
||||
*/
|
||||
#define FbByteAddMulC(x, a, y, b) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x >> 24) * (a >> 24) + (y >> 24) * b; \
|
||||
r += (r >> 8) + 0x80; \
|
||||
r >>= 8; \
|
||||
\
|
||||
t = (x & 0xff00) * ((a >> 8) & 0xff) + (y & 0xff00) * b; \
|
||||
t += (t >> 8) + 0x8000; \
|
||||
t >>= 16; \
|
||||
\
|
||||
t |= r << 16; \
|
||||
t |= 0x1000100 - ((t >> 8) & 0xff00ff); \
|
||||
t &= 0xff00ff; \
|
||||
t <<= 8; \
|
||||
\
|
||||
r = ((x >> 16) & 0xff) * ((a >> 16) & 0xff) + ((y >> 16) & 0xff) * b + 0x80; \
|
||||
r += (r >> 8); \
|
||||
r >>= 8; \
|
||||
\
|
||||
x = (x & 0xff) * (a & 0xff) + (y & 0xff) * b + 0x80; \
|
||||
x += (x >> 8); \
|
||||
x >>= 8; \
|
||||
x |= r << 16; \
|
||||
x |= 0x1000100 - ((x >> 8) & 0xff00ff); \
|
||||
x &= 0xff00ff; \
|
||||
x |= t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = min(x_c + y_c, 255)
|
||||
*/
|
||||
#define FbByteAdd(x, y) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x & 0xff00ff) + (y & 0xff00ff); \
|
||||
r |= 0x1000100 - ((r >> 8) & 0xff00ff); \
|
||||
r &= 0xff00ff; \
|
||||
\
|
||||
t = ((x >> 8) & 0xff00ff) + ((y >> 8) & 0xff00ff); \
|
||||
t |= 0x1000100 - ((t >> 8) & 0xff00ff); \
|
||||
r |= (t & 0xff00ff) << 8; \
|
||||
x = r; \
|
||||
} while (0)
|
||||
|
||||
#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
|
||||
|
||||
#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
|
||||
|
||||
#define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) : \
|
||||
((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
|
||||
|
||||
#if 0
|
||||
/* FIXME: the MOD macro above is equivalent, but faster I think */
|
||||
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
|
||||
#endif
|
||||
|
||||
/* FIXME: the (void)__read_func hides lots of warnings (which is what they
|
||||
* are supposed to do), but some of them are real. For example the one
|
||||
* where Fetch4 doesn't have a READ
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/* Framebuffer access support macros */
|
||||
#define ACCESS_MEM(code) \
|
||||
do { \
|
||||
const image_common_t *const com__ = \
|
||||
(image_common_t *)image; \
|
||||
\
|
||||
if (!com__->read_func && !com__->write_func) \
|
||||
{ \
|
||||
const int do_access__ = 0; \
|
||||
const pixman_read_memory_func_t read_func__ = NULL; \
|
||||
const pixman_write_memory_func_t write_func__ = NULL; \
|
||||
(void)read_func__; \
|
||||
(void)write_func__; \
|
||||
(void)do_access__; \
|
||||
\
|
||||
{code} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
const int do_access__ = 1; \
|
||||
const pixman_read_memory_func_t read_func__ = \
|
||||
com__->read_func; \
|
||||
const pixman_write_memory_func_t write_func__ = \
|
||||
com__->write_func; \
|
||||
(void)read_func__; \
|
||||
(void)write_func__; \
|
||||
(void)do_access__; \
|
||||
\
|
||||
{code} \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef PIXMAN_FB_ACCESSORS
|
||||
|
||||
#define READ(ptr) \
|
||||
(image->common.read_func ((ptr), sizeof(*(ptr))))
|
||||
#define WRITE(ptr,val) \
|
||||
(image->common.write_func ((ptr), (val), sizeof (*(ptr))))
|
||||
|
||||
#define MEMCPY_WRAPPED(dst, src, size) \
|
||||
do { \
|
||||
size_t _i; \
|
||||
uint8_t *_dst = (uint8_t*)(dst), *_src = (uint8_t*)(src); \
|
||||
for(_i = 0; _i < size; _i++) { \
|
||||
WRITE(_dst +_i, READ(_src + _i)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MEMSET_WRAPPED(dst, val, size) \
|
||||
do { \
|
||||
size_t _i; \
|
||||
uint8_t *_dst = (uint8_t*)(dst); \
|
||||
for(_i = 0; _i < size; _i++) { \
|
||||
WRITE(_dst +_i, (val)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* FIXME */
|
||||
#define fbPrepareAccess(x)
|
||||
#define fbFinishAccess(x)
|
||||
|
||||
#else
|
||||
|
||||
#define READ(ptr) (*(ptr))
|
||||
#define WRITE(ptr, val) (*(ptr) = (val))
|
||||
#define MEMCPY_WRAPPED(dst, src, size) \
|
||||
memcpy(dst, src, size)
|
||||
#define MEMSET_WRAPPED(dst, val, size) \
|
||||
memset(dst, val, size)
|
||||
#define fbPrepareAccess(x)
|
||||
#define fbFinishAccess(x)
|
||||
#endif
|
||||
|
||||
#define fbComposeGetSolid(img, res, fmt) \
|
||||
do \
|
||||
{ \
|
||||
pixman_format_code_t format__; \
|
||||
if (img->type == SOLID) \
|
||||
{ \
|
||||
format__ = PIXMAN_a8r8g8b8; \
|
||||
(res) = img->solid.color; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
uint32_t *bits__ = (img)->bits.bits; \
|
||||
format__ = (img)->bits.format; \
|
||||
\
|
||||
switch (PIXMAN_FORMAT_BPP((img)->bits.format)) \
|
||||
{ \
|
||||
case 32: \
|
||||
(res) = READ((uint32_t *)bits__); \
|
||||
break; \
|
||||
case 24: \
|
||||
(res) = Fetch24 ((uint8_t *) bits__); \
|
||||
break; \
|
||||
case 16: \
|
||||
(res) = READ((uint16_t *) bits__); \
|
||||
(res) = cvt0565to0888(res); \
|
||||
break; \
|
||||
case 8: \
|
||||
(res) = READ((uint8_t *) bits__); \
|
||||
(res) = (res) << 24; \
|
||||
break; \
|
||||
case 1: \
|
||||
(res) = READ((uint32_t *) bits__); \
|
||||
(res) = FbLeftStipBits((res),1) ? 0xff000000 : 0x00000000; \
|
||||
break; \
|
||||
default: \
|
||||
return; \
|
||||
} \
|
||||
/* manage missing src alpha */ \
|
||||
if (!PIXMAN_FORMAT_A((img)->bits.format)) \
|
||||
(res) |= 0xff000000; \
|
||||
} \
|
||||
\
|
||||
/* If necessary, convert RGB <--> BGR. */ \
|
||||
if (PIXMAN_FORMAT_TYPE (format__) != PIXMAN_FORMAT_TYPE(fmt)) \
|
||||
{ \
|
||||
(res) = ((((res) & 0xff000000) >> 0) | \
|
||||
(((res) & 0x00ff0000) >> 16) | \
|
||||
(((res) & 0x0000ff00) >> 0) | \
|
||||
(((res) & 0x000000ff) << 16)); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do { \
|
||||
uint32_t *__bits__; \
|
||||
int __stride__; \
|
||||
int __bpp__; \
|
||||
\
|
||||
__bits__ = pict->bits.bits; \
|
||||
__stride__ = pict->bits.rowstride; \
|
||||
__bpp__ = PIXMAN_FORMAT_BPP(pict->bits.format); \
|
||||
(out_stride) = __stride__ * sizeof (uint32_t) / sizeof (type); \
|
||||
(line) = ((type *) __bits__) + \
|
||||
(out_stride) * (y) + (mul) * (x); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* Edges
|
||||
*/
|
||||
|
||||
#define MAX_ALPHA(n) ((1 << (n)) - 1)
|
||||
#define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1)
|
||||
#define N_X_FRAC(n) ((1 << ((n)/2)) + 1)
|
||||
|
||||
#define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC(n))
|
||||
#define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
|
||||
|
||||
#define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2)
|
||||
#define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
|
||||
|
||||
#define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC(n))
|
||||
#define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
|
||||
|
||||
#define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2)
|
||||
#define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
|
||||
|
||||
#define RenderSamplesX(x,n) ((n) == 1 ? 0 : (pixman_fixed_frac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n))
|
||||
|
||||
/*
|
||||
* Step across a small sample grid gap
|
||||
*/
|
||||
#define RenderEdgeStepSmall(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 RenderEdgeStepBig(edge) { \
|
||||
edge->x += edge->stepx_big; \
|
||||
edge->e += edge->dx_big; \
|
||||
if (edge->e > 0) \
|
||||
{ \
|
||||
edge->e -= edge->dy; \
|
||||
edge->x += edge->signdx; \
|
||||
} \
|
||||
}
|
||||
|
||||
void
|
||||
pixman_rasterize_edges_accessors (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b);
|
||||
|
||||
|
||||
/* Timing */
|
||||
static inline uint64_t
|
||||
oil_profile_stamp_rdtsc (void)
|
||||
{
|
||||
uint64_t ts;
|
||||
__asm__ __volatile__("rdtsc\n" : "=A" (ts));
|
||||
return ts;
|
||||
}
|
||||
#define OIL_STAMP oil_profile_stamp_rdtsc
|
||||
|
||||
typedef struct PixmanTimer PixmanTimer;
|
||||
|
||||
struct PixmanTimer
|
||||
{
|
||||
int initialized;
|
||||
const char *name;
|
||||
uint64_t n_times;
|
||||
uint64_t total;
|
||||
PixmanTimer *next;
|
||||
};
|
||||
|
||||
extern int timer_defined;
|
||||
void pixman_timer_register (PixmanTimer *timer);
|
||||
|
||||
#define TIMER_BEGIN(tname) \
|
||||
{ \
|
||||
static PixmanTimer timer##tname; \
|
||||
uint64_t begin##tname; \
|
||||
\
|
||||
if (!timer##tname.initialized) \
|
||||
{ \
|
||||
timer##tname.initialized = 1; \
|
||||
timer##tname.name = #tname; \
|
||||
pixman_timer_register (&timer##tname); \
|
||||
} \
|
||||
\
|
||||
timer##tname.n_times++; \
|
||||
begin##tname = OIL_STAMP();
|
||||
|
||||
#define TIMER_END(tname) \
|
||||
timer##tname.total += OIL_STAMP() - begin##tname; \
|
||||
}
|
||||
|
||||
|
||||
#endif /* PIXMAN_PRIVATE_H */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,80 +1,59 @@
|
|||
#define pixman_add_trapezoids _cairo_pixman_add_trapezoids
|
||||
#define pixman_color_to_pixel _cairo_pixman_color_to_pixel
|
||||
#define composeFunctions _cairo_pixman_compose_functions
|
||||
#define fbComposeSetupMMX _cairo_pixman_compose_setup_mmx
|
||||
#define pixman_composite _cairo_pixman_composite
|
||||
#define fbCompositeCopyAreammx _cairo_pixman_composite_copy_area_mmx
|
||||
#define fbCompositeSolidMask_nx8888x0565Cmmx _cairo_pixman_composite_solid_mask_nx8888x0565Cmmx
|
||||
#define fbCompositeSolidMask_nx8888x8888Cmmx _cairo_pixman_composite_solid_mask_nx8888x8888Cmmx
|
||||
#define fbCompositeSolidMask_nx8x0565mmx _cairo_pixman_composite_solid_mask_nx8x0565mmx
|
||||
#define fbCompositeSolidMask_nx8x8888mmx _cairo_pixman_composite_solid_mask_nx8x8888mmx
|
||||
#define fbCompositeSolidMaskSrc_nx8x8888mmx _cairo_pixman_composite_solid_mask_src_nx8x8888mmx
|
||||
#define fbCompositeSolid_nx0565mmx _cairo_pixman_composite_solid_nx0565mmx
|
||||
#define fbCompositeSolid_nx8888mmx _cairo_pixman_composite_solid_nx8888mmx
|
||||
#define fbCompositeSrc_8888RevNPx0565mmx _cairo_pixman_composite_src_8888RevNPx0565mmx
|
||||
#define fbCompositeSrc_8888RevNPx8888mmx _cairo_pixman_composite_src_8888RevNPx8888_mmx
|
||||
#define fbCompositeSrc_8888x0565mmx _cairo_pixman_composite_src_8888x0565mmx
|
||||
#define fbCompositeSrc_8888x8888mmx _cairo_pixman_composite_src_8888x8888mmx
|
||||
#define fbCompositeSrc_8888x8x8888mmx _cairo_pixman_composite_src_8888x8x8888mmx
|
||||
#define fbCompositeSrcAdd_8000x8000mmx _cairo_pixman_composite_src_add_8000x8000mmx
|
||||
#define fbCompositeSrcAdd_8888x8888mmx _cairo_pixman_composite_src_add_8888x8888mmx
|
||||
#define fbCompositeSrc_x888x8x8888mmx _cairo_pixman_composite_src_x888x8x8888mmx
|
||||
#define pixman_composite_trapezoids _cairo_pixman_composite_trapezoids
|
||||
#define pixman_composite_tri_fan _cairo_pixman_composite_tri_fan
|
||||
#define pixman_composite_tri_strip _cairo_pixman_composite_tri_strip
|
||||
#define pixman_composite_triangles _cairo_pixman_composite_triangles
|
||||
#define fbCopyAreammx _cairo_pixman_copy_area_mmx
|
||||
#define pixman_fill_rectangle _cairo_pixman_fill_rectangle
|
||||
#define pixman_fill_rectangles _cairo_pixman_fill_rectangles
|
||||
#define pixman_format_create _cairo_pixman_format_create
|
||||
#define pixman_format_create_masks _cairo_pixman_format_create_masks
|
||||
#define pixman_format_destroy _cairo_pixman_format_destroy
|
||||
#define pixman_format_get_masks _cairo_pixman_format_get_masks
|
||||
#define pixman_format_init _cairo_pixman_format_init
|
||||
#if defined(USE_MMX) && !defined(__amd64__) && !defined(__x86_64__)
|
||||
#define fbHaveMMX _cairo_pixman_have_mmx
|
||||
#endif
|
||||
#define pixman_image_create _cairo_pixman_image_create
|
||||
#define pixman_image_create_for_data _cairo_pixman_image_create_for_data
|
||||
#define pixman_image_destroy _cairo_pixman_image_destroy
|
||||
#define pixman_image_get_data _cairo_pixman_image_get_data
|
||||
#define pixman_image_get_depth _cairo_pixman_image_get_depth
|
||||
#define pixman_image_get_format _cairo_pixman_image_get_format
|
||||
#define pixman_image_get_height _cairo_pixman_image_get_height
|
||||
#define pixman_image_get_stride _cairo_pixman_image_get_stride
|
||||
#define pixman_image_get_width _cairo_pixman_image_get_width
|
||||
#define pixman_image_set_clip_region _cairo_pixman_image_set_clip_region
|
||||
#define pixman_image_set_component_alpha _cairo_pixman_image_set_component_alpha
|
||||
#define pixman_image_set_filter _cairo_pixman_image_set_filter
|
||||
#define pixman_image_set_repeat _cairo_pixman_image_set_repeat
|
||||
#define pixman_image_set_transform _cairo_pixman_image_set_transform
|
||||
#define pixman_image_create_linear_gradient _cairo_pixman_image_create_linear_gradient
|
||||
#define pixman_image_create_radial_gradient _cairo_pixman_image_create_radial_gradient
|
||||
#define miIsSolidAlpha _cairo_pixman_is_solid_alpha
|
||||
#define pixman_pixel_to_color _cairo_pixman_pixel_to_color
|
||||
#define pixman_region_append _cairo_pixman_region_append
|
||||
#define pixman_region_contains_point _cairo_pixman_region_contains_point
|
||||
#define pixman_region_contains_rectangle _cairo_pixman_region_contains_rectangle
|
||||
#define pixman_region_copy _cairo_pixman_region_copy
|
||||
#define pixman_region_create _cairo_pixman_region_create
|
||||
#define pixman_region_create_simple _cairo_pixman_region_create_simple
|
||||
#define pixman_region_destroy _cairo_pixman_region_destroy
|
||||
#define pixman_region_empty _cairo_pixman_region_empty
|
||||
#define pixman_region_extents _cairo_pixman_region_extents
|
||||
#define pixman_region_intersect _cairo_pixman_region_intersect
|
||||
#define pixman_region_inverse _cairo_pixman_region_inverse
|
||||
#define pixman_region_not_empty _cairo_pixman_region_not_empty
|
||||
#define pixman_region_num_rects _cairo_pixman_region_num_rects
|
||||
#define pixman_region_rects _cairo_pixman_region_rects
|
||||
#define pixman_region_reset _cairo_pixman_region_reset
|
||||
#define pixman_region_subtract _cairo_pixman_region_subtract
|
||||
#define pixman_region_translate _cairo_pixman_region_translate
|
||||
#define pixman_region_union _cairo_pixman_region_union
|
||||
#define pixman_region_union_rect _cairo_pixman_region_union_rect
|
||||
#define pixman_region_validate _cairo_pixman_region_validate
|
||||
#define RenderEdgeInit _cairo_pixman_render_edge_init
|
||||
#define RenderEdgeStep _cairo_pixman_render_edge_step
|
||||
#define RenderLineFixedEdgeInit _cairo_pixman_render_line_fixed_edge_init
|
||||
#define RenderSampleCeilY _cairo_pixman_render_sample_ceil_y
|
||||
#define RenderSampleFloorY _cairo_pixman_render_sample_floor_y
|
||||
#define fbSolidFillmmx _cairo_pixman_solid_fill_mmx
|
||||
#define pixman_transform_point_3d _moz_pixman_transform_point_3d
|
||||
#define pixman_region_set_static_pointers _moz_pixman_region_set_static_pointers
|
||||
#define pixman_region_init _moz_pixman_region_init
|
||||
#define pixman_region_init_rect _moz_pixman_region_init_rect
|
||||
#define pixman_region_init_with_extents _moz_pixman_region_init_with_extents
|
||||
#define pixman_region_fini _moz_pixman_region_fini
|
||||
#define pixman_region_translate _moz_pixman_region_translate
|
||||
#define pixman_region_copy _moz_pixman_region_copy
|
||||
#define pixman_region_intersect _moz_pixman_region_intersect
|
||||
#define pixman_region_union _moz_pixman_region_union
|
||||
#define pixman_region_union_rect _moz_pixman_region_union_rect
|
||||
#define pixman_region_subtract _moz_pixman_region_subtract
|
||||
#define pixman_region_inverse _moz_pixman_region_inverse
|
||||
#define pixman_region_contains_point _moz_pixman_region_contains_point
|
||||
#define pixman_region_contains_rectangle _moz_pixman_region_contains_rectangle
|
||||
#define pixman_region_not_empty _moz_pixman_region_not_empty
|
||||
#define pixman_region_extents _moz_pixman_region_extents
|
||||
#define pixman_region_n_rects _moz_pixman_region_n_rects
|
||||
#define pixman_region_rectangles _moz_pixman_region_rectangles
|
||||
#define pixman_region_equal _moz_pixman_region_equal
|
||||
#define pixman_region_selfcheck _moz_pixman_region_selfcheck
|
||||
#define pixman_region_reset _moz_pixman_region_reset
|
||||
#define pixman_region_init_rects _moz_pixman_region_init_rects
|
||||
#define pixman_blt _moz_pixman_blt
|
||||
#define pixman_fill _moz_pixman_fill
|
||||
#define pixman_image_create_solid_fill _moz_pixman_image_create_solid_fill
|
||||
#define pixman_image_create_linear_gradient _moz_pixman_image_create_linear_gradient
|
||||
#define pixman_image_create_radial_gradient _moz_pixman_image_create_radial_gradient
|
||||
#define pixman_image_create_conical_gradient _moz_pixman_image_create_conical_gradient
|
||||
#define pixman_image_create_bits _moz_pixman_image_create_bits
|
||||
#define pixman_image_ref _moz_pixman_image_ref
|
||||
#define pixman_image_unref _moz_pixman_image_unref
|
||||
#define pixman_image_set_clip_region _moz_pixman_image_set_clip_region
|
||||
#define pixman_image_set_has_client_clip _moz_pixman_image_set_has_client_clip
|
||||
#define pixman_image_set_transform _moz_pixman_image_set_transform
|
||||
#define pixman_image_set_repeat _moz_pixman_image_set_repeat
|
||||
#define pixman_image_set_filter _moz_pixman_image_set_filter
|
||||
#define pixman_image_set_filter_params _moz_pixman_image_set_filter_params
|
||||
#define pixman_image_set_alpha_map _moz_pixman_image_set_alpha_map
|
||||
#define pixman_image_set_component_alpha _moz_pixman_image_set_component_alpha
|
||||
#define pixman_image_set_accessors _moz_pixman_image_set_accessors
|
||||
#define pixman_image_set_indexed _moz_pixman_image_set_indexed
|
||||
#define pixman_image_get_data _moz_pixman_image_get_data
|
||||
#define pixman_image_get_width _moz_pixman_image_get_width
|
||||
#define pixman_image_get_height _moz_pixman_image_get_height
|
||||
#define pixman_image_get_stride _moz_pixman_image_get_stride
|
||||
#define pixman_image_get_depth _moz_pixman_image_get_depth
|
||||
#define pixman_image_fill_rectangles _moz_pixman_image_fill_rectangles
|
||||
#define pixman_compute_composite_region _moz_pixman_compute_composite_region
|
||||
#define pixman_image_composite _moz_pixman_image_composite
|
||||
#define pixman_sample_ceil_y _moz_pixman_sample_ceil_y
|
||||
#define pixman_sample_floor_y _moz_pixman_sample_floor_y
|
||||
#define pixman_edge_step _moz_pixman_edge_step
|
||||
#define pixman_edge_init _moz_pixman_edge_init
|
||||
#define pixman_line_fixed_edge_init _moz_pixman_line_fixed_edge_init
|
||||
#define pixman_rasterize_edges _moz_pixman_rasterize_edges
|
||||
#define pixman_add_traps _moz_pixman_add_traps
|
||||
#define pixman_add_trapezoids _moz_pixman_add_trapezoids
|
||||
#define pixman_rasterize_trapezoid _moz_pixman_rasterize_trapezoid
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "pixman-private.h"
|
||||
|
||||
static PixmanTimer *timers;
|
||||
|
||||
static void
|
||||
dump_timers (void)
|
||||
{
|
||||
PixmanTimer *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 (PixmanTimer *timer)
|
||||
{
|
||||
static int initialized;
|
||||
|
||||
int atexit(void (*function)(void));
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
atexit (dump_timers);
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
timer->next = timers;
|
||||
timers = timer;
|
||||
}
|
|
@ -0,0 +1,285 @@
|
|||
/*
|
||||
* $Id: pixman-trap.c,v 1.1 2007-07-24 17:08:21 vladimir%pobox.com Exp $
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include "pixman-private.h"
|
||||
|
||||
typedef uint32_t FbBits;
|
||||
|
||||
void
|
||||
pixman_add_traps (pixman_image_t * image,
|
||||
int16_t x_off,
|
||||
int16_t y_off,
|
||||
int ntrap,
|
||||
pixman_trap_t *traps)
|
||||
{
|
||||
int bpp;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
pixman_fixed_t x_off_fixed;
|
||||
pixman_fixed_t y_off_fixed;
|
||||
pixman_edge_t l, r;
|
||||
pixman_fixed_t t, b;
|
||||
|
||||
width = image->bits.width;
|
||||
height = image->bits.height;
|
||||
bpp = PIXMAN_FORMAT_BPP (image->bits.format);
|
||||
|
||||
x_off_fixed = pixman_int_to_fixed(y_off);
|
||||
y_off_fixed = pixman_int_to_fixed(y_off);
|
||||
|
||||
while (ntrap--)
|
||||
{
|
||||
t = traps->top.y + y_off_fixed;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
t = pixman_sample_ceil_y (t, bpp);
|
||||
|
||||
b = traps->bot.y + y_off_fixed;
|
||||
if (pixman_fixed_to_int (b) >= height)
|
||||
b = pixman_int_to_fixed (height) - 1;
|
||||
b = pixman_sample_floor_y (b, bpp);
|
||||
|
||||
if (b >= t)
|
||||
{
|
||||
/* initialize edge walkers */
|
||||
pixman_edge_init (&l, bpp, t,
|
||||
traps->top.l + x_off_fixed,
|
||||
traps->top.y + y_off_fixed,
|
||||
traps->bot.l + x_off_fixed,
|
||||
traps->bot.y + y_off_fixed);
|
||||
|
||||
pixman_edge_init (&r, bpp, t,
|
||||
traps->top.r + x_off_fixed,
|
||||
traps->top.y + y_off_fixed,
|
||||
traps->bot.r + x_off_fixed,
|
||||
traps->bot.y + y_off_fixed);
|
||||
|
||||
pixman_rasterize_edges (image, &l, &r, t, b);
|
||||
}
|
||||
traps++;
|
||||
}
|
||||
|
||||
fbFinishAccess (pPicture->pDrawable);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_image (pixman_image_t *image,
|
||||
const char *title)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (!image->type == BITS)
|
||||
{
|
||||
printf ("%s is not a regular image\n", title);
|
||||
}
|
||||
|
||||
if (!image->bits.format == PIXMAN_a8)
|
||||
{
|
||||
printf ("%s is not an alpha mask\n", title);
|
||||
}
|
||||
|
||||
printf ("\n\n\n%s: \n", title);
|
||||
|
||||
for (i = 0; i < image->bits.height; ++i)
|
||||
{
|
||||
uint8_t *line =
|
||||
(uint8_t *)&(image->bits.bits[i * image->bits.rowstride]);
|
||||
|
||||
for (j = 0; j < image->bits.width; ++j)
|
||||
printf ("%c", line[j]? '#' : ' ');
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pixman_add_trapezoids (pixman_image_t *image,
|
||||
int16_t x_off,
|
||||
int y_off,
|
||||
int ntraps,
|
||||
const pixman_trapezoid_t *traps)
|
||||
{
|
||||
int i;
|
||||
|
||||
#if 0
|
||||
dump_image (image, "before");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < ntraps; ++i)
|
||||
{
|
||||
const pixman_trapezoid_t *trap = &(traps[i]);
|
||||
|
||||
if (!pixman_trapezoid_valid (trap))
|
||||
continue;
|
||||
|
||||
pixman_rasterize_trapezoid (image, trap, x_off, y_off);
|
||||
}
|
||||
|
||||
#if 0
|
||||
dump_image (image, "after");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
pixman_rasterize_trapezoid (pixman_image_t * image,
|
||||
const pixman_trapezoid_t *trap,
|
||||
int x_off,
|
||||
int y_off)
|
||||
{
|
||||
int bpp;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
pixman_fixed_t x_off_fixed;
|
||||
pixman_fixed_t y_off_fixed;
|
||||
pixman_edge_t l, r;
|
||||
pixman_fixed_t t, b;
|
||||
|
||||
return_if_fail (image->type == BITS);
|
||||
|
||||
if (!pixman_trapezoid_valid (trap))
|
||||
return;
|
||||
|
||||
width = image->bits.width;
|
||||
height = image->bits.height;
|
||||
bpp = PIXMAN_FORMAT_BPP (image->bits.format);
|
||||
|
||||
x_off_fixed = pixman_int_to_fixed(x_off);
|
||||
y_off_fixed = pixman_int_to_fixed(y_off);
|
||||
t = trap->top + y_off_fixed;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
t = pixman_sample_ceil_y (t, bpp);
|
||||
|
||||
b = trap->bottom + y_off_fixed;
|
||||
if (pixman_fixed_to_int (b) >= height)
|
||||
b = pixman_int_to_fixed (height) - 1;
|
||||
b = pixman_sample_floor_y (b, bpp);
|
||||
|
||||
if (b >= t)
|
||||
{
|
||||
/* initialize edge walkers */
|
||||
pixman_line_fixed_edge_init (&l, bpp, t, &trap->left, x_off, y_off);
|
||||
pixman_line_fixed_edge_init (&r, bpp, t, &trap->right, x_off, y_off);
|
||||
|
||||
pixman_rasterize_edges (image, &l, &r, t, b);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
_GreaterY (pixman_point_fixed_t *a, pixman_point_fixed_t *b)
|
||||
{
|
||||
if (a->y == b->y)
|
||||
return a->x > b->x;
|
||||
return a->y > b->y;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that the definition of this function is a bit odd because
|
||||
* of the X coordinate space (y increasing downwards).
|
||||
*/
|
||||
static int
|
||||
_Clockwise (pixman_point_fixed_t *ref, pixman_point_fixed_t *a, pixman_point_fixed_t *b)
|
||||
{
|
||||
pixman_point_fixed_t ad, bd;
|
||||
|
||||
ad.x = a->x - ref->x;
|
||||
ad.y = a->y - ref->y;
|
||||
bd.x = b->x - ref->x;
|
||||
bd.y = b->y - ref->y;
|
||||
|
||||
return ((pixman_fixed_32_32_t) bd.y * ad.x - (pixman_fixed_32_32_t) ad.y * bd.x) < 0;
|
||||
}
|
||||
|
||||
/* FIXME -- this could be made more efficient */
|
||||
void
|
||||
fbAddTriangles (pixman_image_t * pPicture,
|
||||
int16_t x_off,
|
||||
int16_t y_off,
|
||||
int ntri,
|
||||
xTriangle *tris)
|
||||
{
|
||||
pixman_point_fixed_t *top, *left, *right, *tmp;
|
||||
xTrapezoid trap;
|
||||
|
||||
for (; ntri; ntri--, tris++)
|
||||
{
|
||||
top = &tris->p1;
|
||||
left = &tris->p2;
|
||||
right = &tris->p3;
|
||||
if (_GreaterY (top, left)) {
|
||||
tmp = left; left = top; top = tmp;
|
||||
}
|
||||
if (_GreaterY (top, right)) {
|
||||
tmp = right; right = top; top = tmp;
|
||||
}
|
||||
if (_Clockwise (top, right, left)) {
|
||||
tmp = right; right = left; left = tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Two cases:
|
||||
*
|
||||
* + +
|
||||
* / \ / \
|
||||
* / \ / \
|
||||
* / + + \
|
||||
* / -- -- \
|
||||
* / -- -- \
|
||||
* / --- --- \
|
||||
* +-- --+
|
||||
*/
|
||||
|
||||
trap.top = top->y;
|
||||
trap.left.p1 = *top;
|
||||
trap.left.p2 = *left;
|
||||
trap.right.p1 = *top;
|
||||
trap.right.p2 = *right;
|
||||
if (right->y < left->y)
|
||||
trap.bottom = right->y;
|
||||
else
|
||||
trap.bottom = left->y;
|
||||
fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off);
|
||||
if (right->y < left->y)
|
||||
{
|
||||
trap.top = right->y;
|
||||
trap.bottom = left->y;
|
||||
trap.right.p1 = *right;
|
||||
trap.right.p2 = *left;
|
||||
}
|
||||
else
|
||||
{
|
||||
trap.top = left->y;
|
||||
trap.bottom = right->y;
|
||||
trap.left.p1 = *left;
|
||||
trap.left.p2 = *right;
|
||||
}
|
||||
fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off);
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,392 @@
|
|||
/*
|
||||
* Copyright © 2000 SuSE, 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 SuSE not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. SuSE makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Keith Packard, SuSE, Inc.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include "pixman.h"
|
||||
#include "pixman-private.h"
|
||||
#include "pixman-mmx.h"
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_point_3d (pixman_transform_t *transform,
|
||||
pixman_vector_t *vector)
|
||||
{
|
||||
pixman_vector_t result;
|
||||
int i, j;
|
||||
pixman_fixed_32_32_t partial;
|
||||
pixman_fixed_48_16_t v;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
v = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
partial = ((pixman_fixed_48_16_t) transform->matrix[j][i] *
|
||||
(pixman_fixed_48_16_t) vector->vector[i]);
|
||||
v += partial >> 16;
|
||||
}
|
||||
|
||||
if (v > pixman_max_fixed_48_16 || v < pixman_min_fixed_48_16)
|
||||
return FALSE;
|
||||
|
||||
result.vector[j] = (pixman_fixed_48_16_t) v;
|
||||
}
|
||||
|
||||
if (!result.vector[2])
|
||||
return FALSE;
|
||||
|
||||
*vector = result;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_blt (uint32_t *src_bits,
|
||||
uint32_t *dst_bits,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
int src_bpp,
|
||||
int dst_bpp,
|
||||
int src_x, int src_y,
|
||||
int dst_x, int dst_y,
|
||||
int width, int height)
|
||||
{
|
||||
#ifdef USE_MMX
|
||||
if (pixman_have_mmx())
|
||||
{
|
||||
return pixman_blt_mmx (src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
|
||||
src_x, src_y, dst_x, dst_y, width, height);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
pixman_fill8 (uint32_t *bits,
|
||||
int stride,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t xor)
|
||||
{
|
||||
int byte_stride = stride * sizeof (uint32_t);
|
||||
uint8_t *dst = (uint8_t *) bits;
|
||||
uint8_t v = xor & 0xff;
|
||||
int i;
|
||||
|
||||
dst = dst + y * byte_stride + x;
|
||||
|
||||
while (height--)
|
||||
{
|
||||
for (i = 0; i < width; ++i)
|
||||
dst[i] = v;
|
||||
|
||||
dst += byte_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pixman_fill16 (uint32_t *bits,
|
||||
int stride,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t xor)
|
||||
{
|
||||
int short_stride = (stride * sizeof (uint32_t)) / sizeof (uint16_t);
|
||||
uint16_t *dst = (uint16_t *)bits;
|
||||
uint16_t v = xor & 0xffff;
|
||||
int i;
|
||||
|
||||
dst = dst + y * short_stride + x;
|
||||
|
||||
while (height--)
|
||||
{
|
||||
for (i = 0; i < width; ++i)
|
||||
dst[i] = v;
|
||||
|
||||
dst += short_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pixman_fill32 (uint32_t *bits,
|
||||
int stride,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t xor)
|
||||
{
|
||||
int i;
|
||||
|
||||
bits = bits + y * stride + x;
|
||||
|
||||
while (height--)
|
||||
{
|
||||
for (i = 0; i < width; ++i)
|
||||
bits[i] = xor;
|
||||
|
||||
bits += stride;
|
||||
}
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_fill (uint32_t *bits,
|
||||
int stride,
|
||||
int bpp,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t xor)
|
||||
{
|
||||
#if 0
|
||||
printf ("filling: %d %d %d %d (stride: %d, bpp: %d) pixel: %x\n",
|
||||
x, y, width, height, stride, bpp, xor);
|
||||
#endif
|
||||
|
||||
#ifdef USE_MMX
|
||||
if (!pixman_have_mmx() || !pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor))
|
||||
#endif
|
||||
{
|
||||
switch (bpp)
|
||||
{
|
||||
case 8:
|
||||
pixman_fill8 (bits, stride, x, y, width, height, xor);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
pixman_fill16 (bits, stride, x, y, width, height, xor);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
pixman_fill32 (bits, stride, x, y, width, height, xor);
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute the smallest value no less than y which is on a
|
||||
* grid row
|
||||
*/
|
||||
|
||||
pixman_fixed_t
|
||||
pixman_sample_ceil_y (pixman_fixed_t y, int n)
|
||||
{
|
||||
pixman_fixed_t f = pixman_fixed_frac(y);
|
||||
pixman_fixed_t i = pixman_fixed_floor(y);
|
||||
|
||||
f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
|
||||
if (f > Y_FRAC_LAST(n))
|
||||
{
|
||||
f = Y_FRAC_FIRST(n);
|
||||
i += pixman_fixed_1;
|
||||
}
|
||||
return (i | f);
|
||||
}
|
||||
|
||||
#define _div(a,b) ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))
|
||||
|
||||
/*
|
||||
* Compute the largest value no greater than y which is on a
|
||||
* grid row
|
||||
*/
|
||||
pixman_fixed_t
|
||||
pixman_sample_floor_y (pixman_fixed_t y, int n)
|
||||
{
|
||||
pixman_fixed_t f = pixman_fixed_frac(y);
|
||||
pixman_fixed_t i = pixman_fixed_floor (y);
|
||||
|
||||
f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
|
||||
if (f < Y_FRAC_FIRST(n))
|
||||
{
|
||||
f = Y_FRAC_LAST(n);
|
||||
i -= pixman_fixed_1;
|
||||
}
|
||||
return (i | f);
|
||||
}
|
||||
|
||||
/*
|
||||
* Step an edge by any amount (including negative values)
|
||||
*/
|
||||
void
|
||||
pixman_edge_step (pixman_edge_t *e, int n)
|
||||
{
|
||||
pixman_fixed_48_16_t ne;
|
||||
|
||||
e->x += n * e->stepx;
|
||||
|
||||
ne = e->e + n * (pixman_fixed_48_16_t) e->dx;
|
||||
|
||||
if (n >= 0)
|
||||
{
|
||||
if (ne > 0)
|
||||
{
|
||||
int nx = (ne + e->dy - 1) / e->dy;
|
||||
e->e = ne - nx * (pixman_fixed_48_16_t) e->dy;
|
||||
e->x += nx * e->signdx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ne <= -e->dy)
|
||||
{
|
||||
int nx = (-ne) / e->dy;
|
||||
e->e = ne + nx * (pixman_fixed_48_16_t) e->dy;
|
||||
e->x -= nx * e->signdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A private routine to initialize the multi-step
|
||||
* elements of an edge structure
|
||||
*/
|
||||
static void
|
||||
_pixman_edge_tMultiInit (pixman_edge_t *e, int n, pixman_fixed_t *stepx_p, pixman_fixed_t *dx_p)
|
||||
{
|
||||
pixman_fixed_t stepx;
|
||||
pixman_fixed_48_16_t ne;
|
||||
|
||||
ne = n * (pixman_fixed_48_16_t) e->dx;
|
||||
stepx = n * e->stepx;
|
||||
if (ne > 0)
|
||||
{
|
||||
int nx = ne / e->dy;
|
||||
ne -= nx * e->dy;
|
||||
stepx += nx * e->signdx;
|
||||
}
|
||||
*dx_p = ne;
|
||||
*stepx_p = stepx;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize one edge structure given the line endpoints and a
|
||||
* starting y value
|
||||
*/
|
||||
void
|
||||
pixman_edge_init (pixman_edge_t *e,
|
||||
int n,
|
||||
pixman_fixed_t y_start,
|
||||
pixman_fixed_t x_top,
|
||||
pixman_fixed_t y_top,
|
||||
pixman_fixed_t x_bot,
|
||||
pixman_fixed_t y_bot)
|
||||
{
|
||||
pixman_fixed_t dx, dy;
|
||||
|
||||
e->x = x_top;
|
||||
e->e = 0;
|
||||
dx = x_bot - x_top;
|
||||
dy = y_bot - y_top;
|
||||
e->dy = dy;
|
||||
e->dx = 0;
|
||||
if (dy)
|
||||
{
|
||||
if (dx >= 0)
|
||||
{
|
||||
e->signdx = 1;
|
||||
e->stepx = dx / dy;
|
||||
e->dx = dx % dy;
|
||||
e->e = -dy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->signdx = -1;
|
||||
e->stepx = -(-dx / dy);
|
||||
e->dx = -dx % dy;
|
||||
e->e = 0;
|
||||
}
|
||||
|
||||
_pixman_edge_tMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small);
|
||||
_pixman_edge_tMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big);
|
||||
}
|
||||
pixman_edge_step (e, y_start - y_top);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize one edge structure given a line, starting y value
|
||||
* and a pixel offset for the line
|
||||
*/
|
||||
void
|
||||
pixman_line_fixed_edge_init (pixman_edge_t *e,
|
||||
int n,
|
||||
pixman_fixed_t y,
|
||||
const pixman_line_fixed_t *line,
|
||||
int x_off,
|
||||
int y_off)
|
||||
{
|
||||
pixman_fixed_t x_off_fixed = pixman_int_to_fixed(x_off);
|
||||
pixman_fixed_t y_off_fixed = pixman_int_to_fixed(y_off);
|
||||
const pixman_point_fixed_t *top, *bot;
|
||||
|
||||
if (line->p1.y <= line->p2.y)
|
||||
{
|
||||
top = &line->p1;
|
||||
bot = &line->p2;
|
||||
}
|
||||
else
|
||||
{
|
||||
top = &line->p2;
|
||||
bot = &line->p1;
|
||||
}
|
||||
pixman_edge_init (e, n, y,
|
||||
top->x + x_off_fixed,
|
||||
top->y + y_off_fixed,
|
||||
bot->x + x_off_fixed,
|
||||
bot->y + y_off_fixed);
|
||||
}
|
||||
|
||||
void *
|
||||
pixman_malloc_ab(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
if (a >= INT32_MAX / b)
|
||||
return NULL;
|
||||
|
||||
return malloc (a * b);
|
||||
}
|
||||
|
||||
void *
|
||||
pixman_malloc_abc (unsigned int a,
|
||||
unsigned int b,
|
||||
unsigned int c)
|
||||
{
|
||||
if (a >= INT32_MAX / b)
|
||||
return NULL;
|
||||
else if (a * b >= INT32_MAX / c)
|
||||
return NULL;
|
||||
else
|
||||
return malloc (a * b * c);
|
||||
}
|
|
@ -1,10 +1,3 @@
|
|||
#ifndef _PIXMAN_H_
|
||||
#define _PIXMAN_H_
|
||||
|
||||
/* pixman.h - a merge of pixregion.h and ic.h */
|
||||
|
||||
/* from pixregion.h */
|
||||
|
||||
/***********************************************************
|
||||
|
||||
Copyright 1987, 1998 The Open Group
|
||||
|
@ -50,10 +43,9 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
/* libic.h */
|
||||
|
||||
/*
|
||||
* Copyright © 1998 Keith Packard
|
||||
* Copyright © 1998, 2004 Keith Packard
|
||||
* 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
|
||||
|
@ -74,455 +66,548 @@ SOFTWARE.
|
|||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#elif HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#elif HAVE_SYS_INT_TYPES_H
|
||||
# include <sys/int_types.h>
|
||||
#elif defined(_MSC_VER)
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
|
||||
#endif
|
||||
#ifndef PIXMAN_H__
|
||||
#define PIXMAN_H__
|
||||
|
||||
#include "pixman-remap.h"
|
||||
|
||||
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun__)
|
||||
#define pixman_private __attribute__((__visibility__("hidden")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define pixman_private __hidden
|
||||
#else /* not gcc >= 3.3 and not Sun Studio >= 8 */
|
||||
#define pixman_private
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* pixregion.h */
|
||||
|
||||
typedef struct pixman_region16 pixman_region16_t;
|
||||
|
||||
typedef struct pixman_box16 {
|
||||
short x1, y1, x2, y2;
|
||||
} pixman_box16_t;
|
||||
|
||||
typedef enum {
|
||||
PIXMAN_REGION_STATUS_FAILURE,
|
||||
PIXMAN_REGION_STATUS_SUCCESS
|
||||
} pixman_region_status_t;
|
||||
|
||||
/* creation/destruction */
|
||||
|
||||
pixman_private pixman_region16_t *
|
||||
pixman_region_create (void);
|
||||
|
||||
pixman_private pixman_region16_t *
|
||||
pixman_region_create_simple (pixman_box16_t *extents);
|
||||
|
||||
pixman_private void
|
||||
pixman_region_destroy (pixman_region16_t *region);
|
||||
|
||||
/* manipulation */
|
||||
|
||||
pixman_private void
|
||||
pixman_region_translate (pixman_region16_t *region, int x, int y);
|
||||
|
||||
pixman_private pixman_region_status_t
|
||||
pixman_region_copy (pixman_region16_t *dest, pixman_region16_t *source);
|
||||
|
||||
pixman_private pixman_region_status_t
|
||||
pixman_region_intersect (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2);
|
||||
|
||||
pixman_private pixman_region_status_t
|
||||
pixman_region_union (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2);
|
||||
|
||||
pixman_private pixman_region_status_t
|
||||
pixman_region_union_rect(pixman_region16_t *dest, pixman_region16_t *source,
|
||||
int x, int y, unsigned int width, unsigned int height);
|
||||
|
||||
pixman_private pixman_region_status_t
|
||||
pixman_region_subtract (pixman_region16_t *regD, pixman_region16_t *regM, pixman_region16_t *regS);
|
||||
|
||||
pixman_private pixman_region_status_t
|
||||
pixman_region_inverse (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_box16_t *invRect);
|
||||
|
||||
/* XXX: Need to fix this so it doesn't depend on an X data structure
|
||||
pixman_region16_t *
|
||||
RectsTopixman_region16_t (int nrects, xRectanglePtr prect, int ctype);
|
||||
*/
|
||||
|
||||
/* querying */
|
||||
|
||||
/* XXX: These should proably be combined: pixman_region_get_rects? */
|
||||
pixman_private int
|
||||
pixman_region_num_rects (pixman_region16_t *region);
|
||||
|
||||
pixman_private pixman_box16_t *
|
||||
pixman_region_rects (pixman_region16_t *region);
|
||||
|
||||
/* XXX: Change to an enum */
|
||||
#define rgnOUT 0
|
||||
#define rgnIN 1
|
||||
#define rgnPART 2
|
||||
|
||||
pixman_private int
|
||||
pixman_region_contains_point (pixman_region16_t *region, int x, int y, pixman_box16_t *box);
|
||||
|
||||
pixman_private int
|
||||
pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t, pixman_box16_t *prect);
|
||||
|
||||
pixman_private int
|
||||
pixman_region_not_empty (pixman_region16_t *region);
|
||||
|
||||
pixman_private pixman_box16_t *
|
||||
pixman_region_extents (pixman_region16_t *region);
|
||||
|
||||
/* mucking around */
|
||||
|
||||
/* WARNING: calling pixman_region_append may leave dest as an invalid
|
||||
region. Follow-up with pixman_region_validate to fix it up. */
|
||||
pixman_private pixman_region_status_t
|
||||
pixman_region_append (pixman_region16_t *dest, pixman_region16_t *region);
|
||||
|
||||
pixman_private pixman_region_status_t
|
||||
pixman_region_validate (pixman_region16_t *badreg, int *pOverlap);
|
||||
|
||||
/* Unclassified functionality
|
||||
* XXX: Do all of these need to be exported?
|
||||
/*
|
||||
* Standard integers
|
||||
*/
|
||||
|
||||
pixman_private void
|
||||
pixman_region_reset (pixman_region16_t *region, pixman_box16_t *pBox);
|
||||
|
||||
pixman_private void
|
||||
pixman_region_empty (pixman_region16_t *region);
|
||||
|
||||
/* ic.h */
|
||||
|
||||
/* icformat.c */
|
||||
typedef enum pixman_operator {
|
||||
PIXMAN_OPERATOR_CLEAR,
|
||||
PIXMAN_OPERATOR_SRC,
|
||||
PIXMAN_OPERATOR_DST,
|
||||
PIXMAN_OPERATOR_OVER,
|
||||
PIXMAN_OPERATOR_OVER_REVERSE,
|
||||
PIXMAN_OPERATOR_IN,
|
||||
PIXMAN_OPERATOR_IN_REVERSE,
|
||||
PIXMAN_OPERATOR_OUT,
|
||||
PIXMAN_OPERATOR_OUT_REVERSE,
|
||||
PIXMAN_OPERATOR_ATOP,
|
||||
PIXMAN_OPERATOR_ATOP_REVERSE,
|
||||
PIXMAN_OPERATOR_XOR,
|
||||
PIXMAN_OPERATOR_ADD,
|
||||
PIXMAN_OPERATOR_SATURATE
|
||||
} pixman_operator_t;
|
||||
|
||||
typedef enum pixman_format_name {
|
||||
PIXMAN_FORMAT_NAME_ARGB32,
|
||||
PIXMAN_FORMAT_NAME_RGB24,
|
||||
PIXMAN_FORMAT_NAME_A8,
|
||||
PIXMAN_FORMAT_NAME_A1,
|
||||
PIXMAN_FORMAT_NAME_RGB16_565,
|
||||
PIXMAN_FORMAT_NAME_ABGR32,
|
||||
PIXMAN_FORMAT_NAME_BGR24
|
||||
} pixman_format_name_t;
|
||||
|
||||
typedef struct pixman_format pixman_format_t;
|
||||
|
||||
pixman_private pixman_format_t *
|
||||
pixman_format_create (pixman_format_name_t name);
|
||||
|
||||
pixman_private pixman_format_t *
|
||||
pixman_format_create_masks (int bpp,
|
||||
int alpha_mask,
|
||||
int red_mask,
|
||||
int green_mask,
|
||||
int blue_mask);
|
||||
|
||||
pixman_private void
|
||||
pixman_format_destroy (pixman_format_t *format);
|
||||
|
||||
pixman_private void
|
||||
pixman_format_get_masks (pixman_format_t *format,
|
||||
unsigned int *bpp,
|
||||
unsigned int *alpha_mask,
|
||||
unsigned int *red_mask,
|
||||
unsigned int *green_mask,
|
||||
unsigned int *blue_mask);
|
||||
|
||||
/* icimage.c */
|
||||
|
||||
typedef struct pixman_image pixman_image_t;
|
||||
|
||||
pixman_private pixman_image_t *
|
||||
pixman_image_create (pixman_format_t *format,
|
||||
int width,
|
||||
int height);
|
||||
#if defined (__SVR4) && defined (__sun)
|
||||
# include <sys/int_types.h>
|
||||
#elif defined (__OpenBSD__)
|
||||
# include <inttypes.h>
|
||||
#elif defined (_MSC_VER)
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This single define controls the basic size of data manipulated
|
||||
* by this software; it must be log2(sizeof (pixman_bits_t) * 8)
|
||||
* Boolean
|
||||
*/
|
||||
typedef int pixman_bool_t;
|
||||
|
||||
/* We use a 32-bit size on all platforms, (even those with native 64
|
||||
* bit types). This is consistent with the code currently in the X
|
||||
* server, so it goes through much more well-tested code paths, (we
|
||||
* saw rendering bugs when we tried IC_SHIFT==6 and uint64_t for
|
||||
* pixman_bits_t on 64-bit platofrms). In addition, Keith says that
|
||||
* his testing indicates that using 32-bits everywhere is a
|
||||
* performance win in any case, (presumably due to 32-bit datapaths
|
||||
* between the processor and the video card).
|
||||
*/
|
||||
#ifndef IC_SHIFT
|
||||
#define IC_SHIFT 5
|
||||
#define FB_SHIFT IC_SHIFT
|
||||
typedef uint32_t pixman_bits_t;
|
||||
#endif
|
||||
/*
|
||||
* Fixpoint numbers
|
||||
*/
|
||||
typedef int64_t pixman_fixed_32_32_t;
|
||||
typedef pixman_fixed_32_32_t pixman_fixed_48_16_t;
|
||||
typedef uint32_t pixman_fixed_1_31_t;
|
||||
typedef uint32_t pixman_fixed_1_16_t;
|
||||
typedef int32_t pixman_fixed_16_16_t;
|
||||
typedef pixman_fixed_16_16_t pixman_fixed_t;
|
||||
|
||||
pixman_private pixman_image_t *
|
||||
pixman_image_create_for_data (pixman_bits_t *data,
|
||||
pixman_format_t *format,
|
||||
int width, int height,
|
||||
int bpp, int stride);
|
||||
#define pixman_fixed_e ((pixman_fixed_t) 1)
|
||||
#define pixman_fixed_1 (pixman_int_to_fixed(1))
|
||||
#define pixman_fixed_1_minus_e (pixman_fixed_1 - pixman_fixed_e)
|
||||
#define pixman_fixed_to_int(f) ((int) ((f) >> 16))
|
||||
#define pixman_int_to_fixed(i) ((pixman_fixed_t) ((i) << 16))
|
||||
#define pixman_fixed_to_double(f) (double) ((f) / (double) pixman_fixed_1)
|
||||
#define pixman_double_to_fixed(d) ((pixman_fixed_t) ((d) * 65536.0))
|
||||
#define pixman_fixed_frac(f) ((f) & pixman_fixed_1_minus_e)
|
||||
#define pixman_fixed_floor(f) ((f) & ~pixman_fixed_1_minus_e)
|
||||
#define pixman_fixed_ceil(f) pixman_fixed_floor ((f) + pixman_fixed_1_minus_e)
|
||||
#define pixman_fixed_fraction(f) ((f) & pixman_fixed_1_minus_e)
|
||||
#define pixman_fixed_mod_2(f) ((f) & (pixman_fixed1 | pixman_fixed_1_minus_e))
|
||||
#define pixman_max_fixed_48_16 ((pixman_fixed_48_16_t) 0x7fffffff)
|
||||
#define pixman_min_fixed_48_16 (-((pixman_fixed_48_16_t) 1 << 31))
|
||||
|
||||
pixman_private void
|
||||
pixman_image_destroy (pixman_image_t *image);
|
||||
/*
|
||||
* Misc structs
|
||||
*/
|
||||
typedef struct pixman_color pixman_color_t;
|
||||
typedef struct pixman_point_fixed pixman_point_fixed_t;
|
||||
typedef struct pixman_line_fixed pixman_line_fixed_t;
|
||||
typedef struct pixman_vector pixman_vector_t;
|
||||
typedef struct pixman_transform pixman_transform_t;
|
||||
|
||||
pixman_private int
|
||||
pixman_image_set_clip_region (pixman_image_t *image,
|
||||
pixman_region16_t *region);
|
||||
struct pixman_color
|
||||
{
|
||||
uint16_t red;
|
||||
uint16_t green;
|
||||
uint16_t blue;
|
||||
uint16_t alpha;
|
||||
};
|
||||
|
||||
typedef int32_t pixman_fixed16_16_t;
|
||||
struct pixman_point_fixed
|
||||
{
|
||||
pixman_fixed_t x;
|
||||
pixman_fixed_t y;
|
||||
};
|
||||
|
||||
typedef struct pixman_point_fixed {
|
||||
pixman_fixed16_16_t x, y;
|
||||
} pixman_point_fixed_t;
|
||||
|
||||
typedef struct pixman_line_fixed {
|
||||
struct pixman_line_fixed
|
||||
{
|
||||
pixman_point_fixed_t p1, p2;
|
||||
} pixman_line_fixed_t;
|
||||
};
|
||||
|
||||
/* XXX: It's goofy that pixman_rectangle_t has integers while all the other
|
||||
datatypes have fixed-point values. (Though by design,
|
||||
pixman_fill_rectangles is designed to fill only whole pixels) */
|
||||
typedef struct pixman_rectangle {
|
||||
short x, y;
|
||||
unsigned short width, height;
|
||||
} pixman_rectangle_t;
|
||||
struct pixman_vector
|
||||
{
|
||||
pixman_fixed_t vector[3];
|
||||
};
|
||||
|
||||
typedef struct pixman_triangle {
|
||||
pixman_point_fixed_t p1, p2, p3;
|
||||
} pixman_triangle_t;
|
||||
struct pixman_transform
|
||||
{
|
||||
pixman_fixed_t matrix[3][3];
|
||||
};
|
||||
|
||||
typedef struct pixman_trapezoid {
|
||||
pixman_fixed16_16_t top, bottom;
|
||||
pixman_line_fixed_t left, right;
|
||||
} pixman_trapezoid_t;
|
||||
|
||||
typedef struct pixman_vector {
|
||||
pixman_fixed16_16_t vector[3];
|
||||
} pixman_vector_t;
|
||||
|
||||
typedef struct pixman_transform {
|
||||
pixman_fixed16_16_t matrix[3][3];
|
||||
} pixman_transform_t;
|
||||
|
||||
typedef struct pixman_color {
|
||||
unsigned short red;
|
||||
unsigned short green;
|
||||
unsigned short blue;
|
||||
unsigned short alpha;
|
||||
} pixman_color_t;
|
||||
|
||||
typedef struct _pixman_gradient_stop {
|
||||
pixman_fixed16_16_t x;
|
||||
pixman_color_t color;
|
||||
} pixman_gradient_stop_t;
|
||||
|
||||
typedef struct _pixman_circle {
|
||||
pixman_fixed16_16_t x;
|
||||
pixman_fixed16_16_t y;
|
||||
pixman_fixed16_16_t radius;
|
||||
} pixman_circle_t;
|
||||
|
||||
typedef struct pixman_linear_gradient {
|
||||
pixman_point_fixed_t p1;
|
||||
pixman_point_fixed_t p2;
|
||||
} pixman_linear_gradient_t;
|
||||
|
||||
typedef struct pixman_radial_gradient {
|
||||
pixman_circle_t c1;
|
||||
pixman_circle_t c2;
|
||||
} pixman_radial_gradient_t;
|
||||
|
||||
typedef enum {
|
||||
PIXMAN_FILTER_FAST,
|
||||
PIXMAN_FILTER_GOOD,
|
||||
PIXMAN_FILTER_BEST,
|
||||
PIXMAN_FILTER_NEAREST,
|
||||
PIXMAN_FILTER_BILINEAR
|
||||
} pixman_filter_t;
|
||||
|
||||
pixman_private void
|
||||
pixman_image_set_component_alpha (pixman_image_t *image,
|
||||
int component_alpha);
|
||||
|
||||
pixman_private int
|
||||
pixman_image_set_transform (pixman_image_t *image,
|
||||
pixman_transform_t *transform);
|
||||
pixman_bool_t pixman_transform_point_3d (pixman_transform_t *transform,
|
||||
pixman_vector_t *vector);
|
||||
|
||||
/* Don't blame me, blame XRender */
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
PIXMAN_REPEAT_NONE,
|
||||
PIXMAN_REPEAT_NORMAL,
|
||||
PIXMAN_REPEAT_PAD,
|
||||
PIXMAN_REPEAT_REFLECT
|
||||
} pixman_repeat_t;
|
||||
|
||||
pixman_private void
|
||||
pixman_image_set_repeat (pixman_image_t *image,
|
||||
pixman_repeat_t repeat);
|
||||
typedef enum
|
||||
{
|
||||
PIXMAN_FILTER_FAST,
|
||||
PIXMAN_FILTER_GOOD,
|
||||
PIXMAN_FILTER_BEST,
|
||||
PIXMAN_FILTER_NEAREST,
|
||||
PIXMAN_FILTER_BILINEAR,
|
||||
PIXMAN_FILTER_CONVOLUTION
|
||||
} pixman_filter_t;
|
||||
|
||||
pixman_private void
|
||||
pixman_image_set_filter (pixman_image_t *image,
|
||||
pixman_filter_t filter);
|
||||
typedef enum
|
||||
{
|
||||
PIXMAN_OP_CLEAR,
|
||||
PIXMAN_OP_SRC,
|
||||
PIXMAN_OP_DST,
|
||||
PIXMAN_OP_OVER,
|
||||
PIXMAN_OP_OVER_REVERSE,
|
||||
PIXMAN_OP_IN,
|
||||
PIXMAN_OP_IN_REVERSE,
|
||||
PIXMAN_OP_OUT,
|
||||
PIXMAN_OP_OUT_REVERSE,
|
||||
PIXMAN_OP_ATOP,
|
||||
PIXMAN_OP_ATOP_REVERSE,
|
||||
PIXMAN_OP_XOR,
|
||||
PIXMAN_OP_ADD,
|
||||
PIXMAN_OP_SATURATE
|
||||
} pixman_op_t;
|
||||
|
||||
pixman_private int
|
||||
pixman_image_get_width (pixman_image_t *image);
|
||||
/*
|
||||
* Regions
|
||||
*/
|
||||
typedef struct pixman_region16_data pixman_region16_data_t;
|
||||
typedef struct pixman_box16 pixman_box16_t;
|
||||
typedef struct pixman_rectangle16 pixman_rectangle16_t;
|
||||
typedef struct pixman_region16 pixman_region16_t;
|
||||
|
||||
pixman_private int
|
||||
pixman_image_get_height (pixman_image_t *image);
|
||||
struct pixman_region16_data {
|
||||
long size;
|
||||
long numRects;
|
||||
/* pixman_box16_t rects[size]; in memory but not explicitly declared */
|
||||
};
|
||||
|
||||
pixman_private int
|
||||
pixman_image_get_stride (pixman_image_t *image);
|
||||
struct pixman_rectangle16
|
||||
{
|
||||
int16_t x, y;
|
||||
uint16_t width, height;
|
||||
};
|
||||
|
||||
pixman_private int
|
||||
pixman_image_get_depth (pixman_image_t *image);
|
||||
struct pixman_box16
|
||||
{
|
||||
int16_t x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
pixman_private pixman_format_t *
|
||||
pixman_image_get_format (pixman_image_t *image);
|
||||
struct pixman_region16
|
||||
{
|
||||
pixman_box16_t extents;
|
||||
pixman_region16_data_t *data;
|
||||
};
|
||||
|
||||
pixman_private pixman_bits_t *
|
||||
pixman_image_get_data (pixman_image_t *image);
|
||||
typedef enum
|
||||
{
|
||||
PIXMAN_REGION_OUT,
|
||||
PIXMAN_REGION_IN,
|
||||
PIXMAN_REGION_PART
|
||||
} pixman_region_overlap_t;
|
||||
|
||||
pixman_private pixman_image_t *
|
||||
pixman_image_create_linear_gradient (const pixman_linear_gradient_t *gradient,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops);
|
||||
/* This function exists only to make it possible to preserve the X ABI - it should
|
||||
* go away at first opportunity.
|
||||
*/
|
||||
void pixman_region_set_static_pointers (pixman_box16_t *empty_box,
|
||||
pixman_region16_data_t *empty_data,
|
||||
pixman_region16_data_t *broken_data);
|
||||
|
||||
pixman_private pixman_image_t *
|
||||
pixman_image_create_radial_gradient (const pixman_radial_gradient_t *gradient,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops);
|
||||
/* creation/destruction */
|
||||
void pixman_region_init (pixman_region16_t *region);
|
||||
void pixman_region_init_rect (pixman_region16_t *region,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
void pixman_region_init_with_extents (pixman_region16_t *region,
|
||||
pixman_box16_t *extents);
|
||||
void pixman_region_fini (pixman_region16_t *region);
|
||||
|
||||
/* iccolor.c */
|
||||
/* manipulation */
|
||||
void pixman_region_translate (pixman_region16_t *region,
|
||||
int x,
|
||||
int y);
|
||||
pixman_bool_t pixman_region_copy (pixman_region16_t *dest,
|
||||
pixman_region16_t *source);
|
||||
pixman_bool_t pixman_region_intersect (pixman_region16_t *newReg,
|
||||
pixman_region16_t *reg1,
|
||||
pixman_region16_t *reg2);
|
||||
pixman_bool_t pixman_region_union (pixman_region16_t *newReg,
|
||||
pixman_region16_t *reg1,
|
||||
pixman_region16_t *reg2);
|
||||
pixman_bool_t pixman_region_union_rect (pixman_region16_t *dest,
|
||||
pixman_region16_t *source,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
pixman_bool_t pixman_region_subtract (pixman_region16_t *regD,
|
||||
pixman_region16_t *regM,
|
||||
pixman_region16_t *regS);
|
||||
pixman_bool_t pixman_region_inverse (pixman_region16_t *newReg,
|
||||
pixman_region16_t *reg1,
|
||||
pixman_box16_t *invRect);
|
||||
pixman_bool_t pixman_region_contains_point (pixman_region16_t *region, int x, int y, pixman_box16_t *box);
|
||||
pixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t, pixman_box16_t *prect);
|
||||
pixman_bool_t pixman_region_not_empty (pixman_region16_t *region);
|
||||
pixman_box16_t * pixman_region_extents (pixman_region16_t *region);
|
||||
int pixman_region_n_rects (pixman_region16_t *region);
|
||||
pixman_box16_t * pixman_region_rectangles (pixman_region16_t *region,
|
||||
int *n_rects);
|
||||
pixman_bool_t pixman_region_equal (pixman_region16_t *region1,
|
||||
pixman_region16_t *region2);
|
||||
pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region);
|
||||
void pixman_region_reset(pixman_region16_t *region, pixman_box16_t *box);
|
||||
pixman_bool_t pixman_region_init_rects (pixman_region16_t *region,
|
||||
pixman_box16_t *boxes, int count);
|
||||
|
||||
pixman_private void
|
||||
pixman_color_to_pixel (const pixman_format_t *format,
|
||||
const pixman_color_t *color,
|
||||
pixman_bits_t *pixel);
|
||||
/* Copy / Fill */
|
||||
pixman_bool_t pixman_blt (uint32_t *src_bits,
|
||||
uint32_t *dst_bits,
|
||||
int src_stride,
|
||||
int dst_stride,
|
||||
int src_bpp,
|
||||
int dst_bpp,
|
||||
int src_x, int src_y,
|
||||
int dst_x, int dst_y,
|
||||
int width, int height);
|
||||
pixman_bool_t pixman_fill (uint32_t *bits,
|
||||
int stride,
|
||||
int bpp,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t xor);
|
||||
/*
|
||||
* Images
|
||||
*/
|
||||
typedef union pixman_image pixman_image_t;
|
||||
typedef struct pixman_indexed pixman_indexed_t;
|
||||
typedef struct pixman_gradient_stop pixman_gradient_stop_t;
|
||||
|
||||
pixman_private void
|
||||
pixman_pixel_to_color (const pixman_format_t *format,
|
||||
pixman_bits_t pixel,
|
||||
pixman_color_t *color);
|
||||
typedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size);
|
||||
typedef void (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size);
|
||||
|
||||
/* icrect.c */
|
||||
struct pixman_gradient_stop {
|
||||
pixman_fixed_t x;
|
||||
pixman_color_t color;
|
||||
};
|
||||
|
||||
pixman_private void
|
||||
pixman_fill_rectangle (pixman_operator_t op,
|
||||
pixman_image_t *dst,
|
||||
const pixman_color_t *color,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
#define PIXMAN_MAX_INDEXED 256 /* XXX depth must be <= 8 */
|
||||
|
||||
pixman_private void
|
||||
pixman_fill_rectangles (pixman_operator_t op,
|
||||
pixman_image_t *dst,
|
||||
const pixman_color_t *color,
|
||||
const pixman_rectangle_t *rects,
|
||||
int nRects);
|
||||
|
||||
/* ictrap.c */
|
||||
|
||||
pixman_private void
|
||||
pixman_composite_trapezoids (pixman_operator_t op,
|
||||
pixman_image_t *src,
|
||||
pixman_image_t *dst,
|
||||
int xSrc,
|
||||
int ySrc,
|
||||
const pixman_trapezoid_t *traps,
|
||||
int ntrap);
|
||||
|
||||
pixman_private void
|
||||
pixman_add_trapezoids (pixman_image_t *dst,
|
||||
int x_off,
|
||||
int y_off,
|
||||
const pixman_trapezoid_t *traps,
|
||||
int ntraps);
|
||||
|
||||
/* ictri.c */
|
||||
|
||||
pixman_private void
|
||||
pixman_composite_triangles (pixman_operator_t op,
|
||||
pixman_image_t *src,
|
||||
pixman_image_t *dst,
|
||||
int xSrc,
|
||||
int ySrc,
|
||||
const pixman_triangle_t *tris,
|
||||
int ntris);
|
||||
|
||||
pixman_private void
|
||||
pixman_composite_tri_strip (pixman_operator_t op,
|
||||
pixman_image_t *src,
|
||||
pixman_image_t *dst,
|
||||
int xSrc,
|
||||
int ySrc,
|
||||
const pixman_point_fixed_t *points,
|
||||
int npoints);
|
||||
|
||||
pixman_private void
|
||||
pixman_composite_tri_fan (pixman_operator_t op,
|
||||
pixman_image_t *src,
|
||||
pixman_image_t *dst,
|
||||
int xSrc,
|
||||
int ySrc,
|
||||
const pixman_point_fixed_t *points,
|
||||
int npoints);
|
||||
|
||||
/* ic.c */
|
||||
|
||||
pixman_private void
|
||||
pixman_composite (pixman_operator_t op,
|
||||
pixman_image_t *iSrc,
|
||||
pixman_image_t *iMask,
|
||||
pixman_image_t *iDst,
|
||||
int xSrc,
|
||||
int ySrc,
|
||||
int xMask,
|
||||
int yMask,
|
||||
int xDst,
|
||||
int yDst,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#if PIXMAN_MAX_INDEXED <= 256
|
||||
typedef uint8_t pixman_index_type;
|
||||
#endif
|
||||
|
||||
#endif /* _PIXMAN_H_ */
|
||||
struct pixman_indexed
|
||||
{
|
||||
pixman_bool_t color;
|
||||
uint32_t rgba[PIXMAN_MAX_INDEXED];
|
||||
pixman_index_type ent[32768];
|
||||
};
|
||||
|
||||
/*
|
||||
* While the protocol is generous in format support, the
|
||||
* sample implementation allows only packed RGB and GBR
|
||||
* representations for data to simplify software rendering,
|
||||
*/
|
||||
#define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \
|
||||
((type) << 16) | \
|
||||
((a) << 12) | \
|
||||
((r) << 8) | \
|
||||
((g) << 4) | \
|
||||
((b)))
|
||||
|
||||
#define PIXMAN_FORMAT_BPP(f) (((f) >> 24) )
|
||||
#define PIXMAN_FORMAT_TYPE(f) (((f) >> 16) & 0xff)
|
||||
#define PIXMAN_FORMAT_A(f) (((f) >> 12) & 0x0f)
|
||||
#define PIXMAN_FORMAT_R(f) (((f) >> 8) & 0x0f)
|
||||
#define PIXMAN_FORMAT_G(f) (((f) >> 4) & 0x0f)
|
||||
#define PIXMAN_FORMAT_B(f) (((f) ) & 0x0f)
|
||||
#define PIXMAN_FORMAT_RGB(f) (((f) ) & 0xfff)
|
||||
#define PIXMAN_FORMAT_VIS(f) (((f) ) & 0xffff)
|
||||
#define PIXMAN_FORMAT_DEPTH(f) (PIXMAN_FORMAT_A(f) + \
|
||||
PIXMAN_FORMAT_R(f) + \
|
||||
PIXMAN_FORMAT_G(f) + \
|
||||
PIXMAN_FORMAT_B(f))
|
||||
|
||||
#define PIXMAN_TYPE_OTHER 0
|
||||
#define PIXMAN_TYPE_A 1
|
||||
#define PIXMAN_TYPE_ARGB 2
|
||||
#define PIXMAN_TYPE_ABGR 3
|
||||
#define PIXMAN_TYPE_COLOR 4
|
||||
#define PIXMAN_TYPE_GRAY 5
|
||||
|
||||
#define PIXMAN_FORMAT_COLOR(f) (PIXMAN_FORMAT_TYPE(f) & 2)
|
||||
|
||||
/* 32bpp formats */
|
||||
typedef enum {
|
||||
PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
|
||||
PIXMAN_x8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
|
||||
PIXMAN_a8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
|
||||
PIXMAN_x8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
|
||||
|
||||
/* 24bpp formats */
|
||||
PIXMAN_r8g8b8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
|
||||
PIXMAN_b8g8r8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
|
||||
|
||||
/* 16bpp formats */
|
||||
PIXMAN_r5g6b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
|
||||
PIXMAN_b5g6r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
|
||||
|
||||
PIXMAN_a1r5g5b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
|
||||
PIXMAN_x1r5g5b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
|
||||
PIXMAN_a1b5g5r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
|
||||
PIXMAN_x1b5g5r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,5,5),
|
||||
PIXMAN_a4r4g4b4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,4,4,4,4),
|
||||
PIXMAN_x4r4g4b4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,4,4,4),
|
||||
PIXMAN_a4b4g4r4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,4,4,4,4),
|
||||
PIXMAN_x4b4g4r4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,4,4,4),
|
||||
|
||||
/* 8bpp formats */
|
||||
PIXMAN_a8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0),
|
||||
PIXMAN_r3g3b2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,0,3,3,2),
|
||||
PIXMAN_b2g3r3 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,0,3,3,2),
|
||||
PIXMAN_a2r2g2b2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,2,2,2,2),
|
||||
PIXMAN_a2b2g2r2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,2,2,2,2),
|
||||
|
||||
PIXMAN_c8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
|
||||
PIXMAN_g8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
|
||||
|
||||
PIXMAN_x4a4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,4,0,0,0),
|
||||
|
||||
PIXMAN_x4c4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
|
||||
PIXMAN_x4g4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
|
||||
|
||||
/* 4bpp formats */
|
||||
PIXMAN_a4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_A,4,0,0,0),
|
||||
PIXMAN_r1g2b1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,0,1,2,1),
|
||||
PIXMAN_b1g2r1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,0,1,2,1),
|
||||
PIXMAN_a1r1g1b1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,1,1,1,1),
|
||||
PIXMAN_a1b1g1r1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,1,1,1,1),
|
||||
|
||||
PIXMAN_c4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_COLOR,0,0,0,0),
|
||||
PIXMAN_g4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_GRAY,0,0,0,0),
|
||||
|
||||
/* 1bpp formats */
|
||||
PIXMAN_a1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
|
||||
|
||||
PIXMAN_g1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
|
||||
} pixman_format_code_t;
|
||||
|
||||
/* Constructors */
|
||||
pixman_image_t *pixman_image_create_solid_fill (pixman_color_t *color);
|
||||
pixman_image_t *pixman_image_create_linear_gradient (pixman_point_fixed_t *p1,
|
||||
pixman_point_fixed_t *p2,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops);
|
||||
pixman_image_t *pixman_image_create_radial_gradient (pixman_point_fixed_t *inner,
|
||||
pixman_point_fixed_t *outer,
|
||||
pixman_fixed_t inner_radius,
|
||||
pixman_fixed_t outer_radius,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops);
|
||||
pixman_image_t *pixman_image_create_conical_gradient (pixman_point_fixed_t *center,
|
||||
pixman_fixed_t angle,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops);
|
||||
pixman_image_t *pixman_image_create_bits (pixman_format_code_t format,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t *bits,
|
||||
int rowstride_bytes);
|
||||
|
||||
/* Destructor */
|
||||
pixman_image_t *pixman_image_ref (pixman_image_t *image);
|
||||
void pixman_image_unref (pixman_image_t *image);
|
||||
|
||||
|
||||
/* Set properties */
|
||||
pixman_bool_t pixman_image_set_clip_region (pixman_image_t *image,
|
||||
pixman_region16_t *region);
|
||||
void pixman_image_set_has_client_clip (pixman_image_t *image,
|
||||
pixman_bool_t clien_clip);
|
||||
pixman_bool_t pixman_image_set_transform (pixman_image_t *image,
|
||||
const pixman_transform_t *transform);
|
||||
void pixman_image_set_repeat (pixman_image_t *image,
|
||||
pixman_repeat_t repeat);
|
||||
pixman_bool_t pixman_image_set_filter (pixman_image_t *image,
|
||||
pixman_filter_t filter,
|
||||
const pixman_fixed_t *filter_params,
|
||||
int n_filter_params);
|
||||
void pixman_image_set_filter_params (pixman_image_t *image,
|
||||
pixman_fixed_t *params,
|
||||
int n_params);
|
||||
void pixman_image_set_alpha_map (pixman_image_t *image,
|
||||
pixman_image_t *alpha_map,
|
||||
int16_t x,
|
||||
int16_t y);
|
||||
void pixman_image_set_component_alpha (pixman_image_t *image,
|
||||
pixman_bool_t component_alpha);
|
||||
void pixman_image_set_accessors (pixman_image_t *image,
|
||||
pixman_read_memory_func_t read_func,
|
||||
pixman_write_memory_func_t write_func);
|
||||
void pixman_image_set_indexed (pixman_image_t *image,
|
||||
const pixman_indexed_t *indexed);
|
||||
uint32_t *pixman_image_get_data (pixman_image_t *image);
|
||||
int pixman_image_get_width (pixman_image_t *image);
|
||||
int pixman_image_get_height (pixman_image_t *image);
|
||||
int pixman_image_get_stride (pixman_image_t *image);
|
||||
int pixman_image_get_depth (pixman_image_t *image);
|
||||
pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op,
|
||||
pixman_image_t *image,
|
||||
pixman_color_t *color,
|
||||
int n_rects,
|
||||
const pixman_rectangle16_t *rects);
|
||||
|
||||
/* Composite */
|
||||
pixman_bool_t pixman_compute_composite_region (pixman_region16_t * pRegion,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void pixman_image_composite (pixman_op_t op,
|
||||
pixman_image_t *src,
|
||||
pixman_image_t *mask,
|
||||
pixman_image_t *dest,
|
||||
int16_t src_x,
|
||||
int16_t src_y,
|
||||
int16_t mask_x,
|
||||
int16_t mask_y,
|
||||
int16_t dest_x,
|
||||
int16_t dest_y,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
/*
|
||||
* Trapezoids
|
||||
*/
|
||||
typedef struct pixman_edge pixman_edge_t;
|
||||
typedef struct pixman_trapezoid pixman_trapezoid_t;
|
||||
typedef struct pixman_trap pixman_trap_t;
|
||||
typedef struct pixman_span_fix pixman_span_fix_t;
|
||||
|
||||
/*
|
||||
* An edge structure. This represents a single polygon edge
|
||||
* and can be quickly stepped across small or large gaps in the
|
||||
* sample grid
|
||||
*/
|
||||
struct pixman_edge
|
||||
{
|
||||
pixman_fixed_t x;
|
||||
pixman_fixed_t e;
|
||||
pixman_fixed_t stepx;
|
||||
pixman_fixed_t signdx;
|
||||
pixman_fixed_t dy;
|
||||
pixman_fixed_t dx;
|
||||
|
||||
pixman_fixed_t stepx_small;
|
||||
pixman_fixed_t stepx_big;
|
||||
pixman_fixed_t dx_small;
|
||||
pixman_fixed_t dx_big;
|
||||
};
|
||||
|
||||
struct pixman_trapezoid
|
||||
{
|
||||
pixman_fixed_t top, bottom;
|
||||
pixman_line_fixed_t left, right;
|
||||
};
|
||||
|
||||
|
||||
/* whether 't' is a well defined not obviously empty trapezoid */
|
||||
#define pixman_trapezoid_valid(t) \
|
||||
((t)->left.p1.y != (t)->left.p2.y && \
|
||||
(t)->right.p1.y != (t)->right.p2.y && \
|
||||
(int) ((t)->bottom - (t)->top) > 0)
|
||||
|
||||
struct pixman_span_fix
|
||||
{
|
||||
pixman_fixed_t l, r, y;
|
||||
};
|
||||
|
||||
struct pixman_trap
|
||||
{
|
||||
pixman_span_fix_t top, bot;
|
||||
};
|
||||
|
||||
pixman_fixed_t pixman_sample_ceil_y (pixman_fixed_t y,
|
||||
int bpp);
|
||||
pixman_fixed_t pixman_sample_floor_y (pixman_fixed_t y,
|
||||
int bpp);
|
||||
void pixman_edge_step (pixman_edge_t *e,
|
||||
int n);
|
||||
void pixman_edge_init (pixman_edge_t *e,
|
||||
int bpp,
|
||||
pixman_fixed_t y_start,
|
||||
pixman_fixed_t x_top,
|
||||
pixman_fixed_t y_top,
|
||||
pixman_fixed_t x_bot,
|
||||
pixman_fixed_t y_bot);
|
||||
void pixman_line_fixed_edge_init (pixman_edge_t *e,
|
||||
int bpp,
|
||||
pixman_fixed_t y,
|
||||
const pixman_line_fixed_t *line,
|
||||
int x_off,
|
||||
int y_off);
|
||||
void pixman_rasterize_edges (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b);
|
||||
void pixman_add_traps (pixman_image_t *image,
|
||||
int16_t x_off,
|
||||
int16_t y_off,
|
||||
int ntrap,
|
||||
pixman_trap_t *traps);
|
||||
void pixman_add_trapezoids (pixman_image_t *image,
|
||||
int16_t x_off,
|
||||
int y_off,
|
||||
int ntraps,
|
||||
const pixman_trapezoid_t *traps);
|
||||
void pixman_rasterize_trapezoid (pixman_image_t *image,
|
||||
const pixman_trapezoid_t *trap,
|
||||
int x_off,
|
||||
int y_off);
|
||||
|
||||
|
||||
#endif /* PIXMAN_H__ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче