Bug 281950 - landing of cairo/libpixman. r=bsmedberg

This commit is contained in:
tor%cs.brown.edu 2005-02-24 20:08:55 +00:00
Родитель 3e9f840f5e
Коммит 5b6ec1e1f9
144 изменённых файлов: 102933 добавлений и 0 удалений

23
gfx/cairo/cairo/AUTHORS Normal file
Просмотреть файл

@ -0,0 +1,23 @@
Olivier Andrieu <oliv__a@users.sourceforge.net> PNG backend
Peter Dennis Bartok <peter@novonyx.com> Bug fix for clipping
Dave Beckett <dave.beckett@bristol.ac.uk> Track rename of libpixman, build fixes
Andrew Chant <andrew.chant@utoronto.ca> Adding const where needed
John Ellson <ellson@research.att.com> First font/glyph extents functions
Richard Henderson <rth@twiddle.net> "slim" macros for better shared libraries
James Henstridge <james@daa.com.au> Build fixes related to freetype
Graydon Hoare <graydon@redhat.com> Support for non-render X server, first real text support
Thomas Hunger <info@teh-web.de> Initial version of cairo_in_stroke/fill
Kristian Høgsberg <krh@redhat.com> PDF backend
Alexander Larsson <alexl@redhat.com> Profiling and performance fixes.
Jordi Mas <jordi@ximian.com> Bug fix for cairo_show_text
Keith Packard <keithp@keithp.com> Original concept, polygon tessellation, dashing
Christof Petig <christof@petig-baender.de> Build fixes related to freetype
David Reveman <davidr@freedesktop.org> New pattern API, OpenGL backend
Jamey Sharp <jamey@minilop.net> Surface/font backend virtualization, XCB backend
Bill Spitzak <spitzak@d2.com> Build fix to find Xrender.h without xrender.pc
Sasha Vasko <sasha@aftercode.net> Build fix to compile without xlib backend
Vladimir Vukicevic <vladimir@pobox.com> Bug fix for clipping
Carl Worth <cworth@isi.edu> Original library, support for paths, images
Richard D. Worth <richard@theworths.org> Build fixes for cygwin
(please let us know if we have missed anyone)

17
gfx/cairo/cairo/COPYING Normal file
Просмотреть файл

@ -0,0 +1,17 @@
Cairo is free software.
Every source file in the implementation of cairo is available to be
redistributed and/or modified under the terms of either the GNU Lesser
General Public License (LGPL) version 2.1 or the Mozilla Public
License (MPL) version 1.1. Some files are available under more
liberal terms, but we believe that in all cases, each file may be used
under either the LGPL or the MPL.
See the following files in this directory for the precise terms and
conditions of either license:
COPYING-LGPL-2.1
COPYING-MPL-1.1
Please see each file in the implementation for Copyright and licensing
information.

Просмотреть файл

@ -0,0 +1,510 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations
below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it
becomes a de-facto standard. To achieve this, non-free programs must
be allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control
compilation and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least
three years, to give the same user the materials specified in
Subsection 6a, above, for a charge no more than the cost of
performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply, and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License
may add an explicit geographical distribution limitation excluding those
countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms
of the ordinary General Public License).
To apply these terms, attach the following notices to the library.
It is safest to attach them to the start of each source file to most
effectively convey the exclusion of warranty; and each file should
have at least the "copyright" line and a pointer to where the full
notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or
your school, if any, to sign a "copyright disclaimer" for the library,
if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James
Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

Просмотреть файл

@ -0,0 +1,470 @@
MOZILLA PUBLIC LICENSE
Version 1.1
---------------
1. Definitions.
1.0.1. "Commercial Use" means distribution or otherwise making the
Covered Code available to a third party.
1.1. "Contributor" means each entity that creates or contributes to
the creation of Modifications.
1.2. "Contributor Version" means the combination of the Original
Code, prior Modifications used by a Contributor, and the Modifications
made by that particular Contributor.
1.3. "Covered Code" means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case
including portions thereof.
1.4. "Electronic Distribution Mechanism" means a mechanism generally
accepted in the software development community for the electronic
transfer of data.
1.5. "Executable" means Covered Code in any form other than Source
Code.
1.6. "Initial Developer" means the individual or entity identified
as the Initial Developer in the Source Code notice required by Exhibit
A.
1.7. "Larger Work" means a work which combines Covered Code or
portions thereof with code not governed by the terms of this License.
1.8. "License" means this document.
1.8.1. "Licensable" means having the right to grant, to the maximum
extent possible, whether at the time of the initial grant or
subsequently acquired, any and all of the rights conveyed herein.
1.9. "Modifications" means any addition to or deletion from the
substance or structure of either the Original Code or any previous
Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or
previous Modifications.
1.10. "Original Code" means Source Code of computer software code
which is described in the Source Code notice required by Exhibit A as
Original Code, and which, at the time of its release under this
License is not already Covered Code governed by this License.
1.10.1. "Patent Claims" means any patent claim(s), now owned or
hereafter acquired, including without limitation, method, process,
and apparatus claims, in any patent Licensable by grantor.
1.11. "Source Code" means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus
any associated interface definition files, scripts used to control
compilation and installation of an Executable, or source code
differential comparisons against either the Original Code or another
well known, available Covered Code of the Contributor's choice. The
Source Code can be in a compressed or archival form, provided the
appropriate decompression or de-archiving software is widely available
for no charge.
1.12. "You" (or "Your") means an individual or a legal entity
exercising rights under, and complying with all of the terms of, this
License or a future version of this License issued under Section 6.1.
For legal entities, "You" includes any entity which controls, is
controlled by, or is under common control with You. For purposes of
this definition, "control" means (a) the power, direct or indirect,
to cause the direction or management of such entity, whether by
contract or otherwise, or (b) ownership of more than fifty percent
(50%) of the outstanding shares or beneficial ownership of such
entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) under intellectual property rights (other than patent or
trademark) Licensable by Initial Developer to use, reproduce,
modify, display, perform, sublicense and distribute the Original
Code (or portions thereof) with or without Modifications, and/or
as part of a Larger Work; and
(b) under Patents Claims infringed by the making, using or
selling of Original Code, to make, have made, use, practice,
sell, and offer for sale, and/or otherwise dispose of the
Original Code (or portions thereof).
(c) the licenses granted in this Section 2.1(a) and (b) are
effective on the date Initial Developer first distributes
Original Code under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is
granted: 1) for code that You delete from the Original Code; 2)
separate from the Original Code; or 3) for infringements caused
by: i) the modification of the Original Code or ii) the
combination of the Original Code with other software or devices.
2.2. Contributor Grant.
Subject to third party intellectual property claims, each Contributor
hereby grants You a world-wide, royalty-free, non-exclusive license
(a) under intellectual property rights (other than patent or
trademark) Licensable by Contributor, to use, reproduce, modify,
display, perform, sublicense and distribute the Modifications
created by such Contributor (or portions thereof) either on an
unmodified basis, with other Modifications, as Covered Code
and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or
selling of Modifications made by that Contributor either alone
and/or in combination with its Contributor Version (or portions
of such combination), to make, use, sell, offer for sale, have
made, and/or otherwise dispose of: 1) Modifications made by that
Contributor (or portions thereof); and 2) the combination of
Modifications made by that Contributor with its Contributor
Version (or portions of such combination).
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
effective on the date Contributor first makes Commercial Use of
the Covered Code.
(d) Notwithstanding Section 2.2(b) above, no patent license is
granted: 1) for any code that Contributor has deleted from the
Contributor Version; 2) separate from the Contributor Version;
3) for infringements caused by: i) third party modifications of
Contributor Version or ii) the combination of Modifications made
by that Contributor with other software (except as part of the
Contributor Version) or other devices; or 4) under Patent Claims
infringed by Covered Code in the absence of Modifications made by
that Contributor.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are
governed by the terms of this License, including without limitation
Section 2.2. The Source Code version of Covered Code may be
distributed only under the terms of this License or a future version
of this License released under Section 6.1, and You must include a
copy of this License with every copy of the Source Code You
distribute. You may not offer or impose any terms on any Source Code
version that alters or restricts the applicable version of this
License or the recipients' rights hereunder. However, You may include
an additional document offering the additional rights described in
Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be
made available in Source Code form under the terms of this License
either on the same media as an Executable version or via an accepted
Electronic Distribution Mechanism to anyone to whom you made an
Executable version available; and if made available via Electronic
Distribution Mechanism, must remain available for at least twelve (12)
months after the date it initially became available, or at least six
(6) months after a subsequent version of that particular Modification
has been made available to such recipients. You are responsible for
ensuring that the Source Code version remains available even if the
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which You contribute to contain a
file documenting the changes You made to create that Covered Code and
the date of any change. You must include a prominent statement that
the Modification is derived, directly or indirectly, from Original
Code provided by the Initial Developer and including the name of the
Initial Developer in (a) the Source Code, and (b) in any notice in an
Executable version or related documentation in which You describe the
origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If Contributor has knowledge that a license under a third party's
intellectual property rights is required to exercise the rights
granted by such Contributor under Sections 2.1 or 2.2,
Contributor must include a text file with the Source Code
distribution titled "LEGAL" which describes the claim and the
party making the claim in sufficient detail that a recipient will
know whom to contact. If Contributor obtains such knowledge after
the Modification is made available as described in Section 3.2,
Contributor shall promptly modify the LEGAL file in all copies
Contributor makes available thereafter and shall take other steps
(such as notifying appropriate mailing lists or newsgroups)
reasonably calculated to inform those who received the Covered
Code that new knowledge has been obtained.
(b) Contributor APIs.
If Contributor's Modifications include an application programming
interface and Contributor has knowledge of patent licenses which
are reasonably necessary to implement that API, Contributor must
also include this information in the LEGAL file.
(c) Representations.
Contributor represents that, except as disclosed pursuant to
Section 3.4(a) above, Contributor believes that Contributor's
Modifications are Contributor's original creation(s) and/or
Contributor has sufficient rights to grant the rights conveyed by
this License.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code. If it is not possible to put such notice in a particular Source
Code file due to its structure, then You must include such notice in a
location (such as a relevant directory) where a user would be likely
to look for such a notice. If You created one or more Modification(s)
You may add your name as a Contributor to the notice described in
Exhibit A. You must also duplicate this License in any documentation
for the Source Code where You describe recipients' rights or ownership
rights relating to Covered Code. You may choose to offer, and to
charge a fee for, warranty, support, indemnity or liability
obligations to one or more recipients of Covered Code. However, You
may do so only on Your own behalf, and not on behalf of the Initial
Developer or any Contributor. You must make it absolutely clear than
any such warranty, support, indemnity or liability obligation is
offered by You alone, and You hereby agree to indemnify the Initial
Developer and every Contributor for any liability incurred by the
Initial Developer or such Contributor as a result of warranty,
support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the
requirements of Section 3.1-3.5 have been met for that Covered Code,
and if You include a notice stating that the Source Code version of
the Covered Code is available under the terms of this License,
including a description of how and where You have fulfilled the
obligations of Section 3.2. The notice must be conspicuously included
in any notice in an Executable version, related documentation or
collateral in which You describe recipients' rights relating to the
Covered Code. You may distribute the Executable version of Covered
Code or ownership rights under a license of Your choice, which may
contain terms different from this License, provided that You are in
compliance with the terms of this License and that the license for the
Executable version does not attempt to limit or alter the recipient's
rights in the Source Code version from the rights set forth in this
License. If You distribute the Executable version under a different
license You must make it absolutely clear that any terms which differ
from this License are offered by You alone, not by the Initial
Developer or any Contributor. You hereby agree to indemnify the
Initial Developer and every Contributor for any liability incurred by
the Initial Developer or such Contributor as a result of any such
terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code
not governed by the terms of this License and distribute the Larger
Work as a single product. In such a case, You must make sure the
requirements of this License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Code due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description
must be included in the LEGAL file described in Section 3.4 and must
be included with all distributions of the Source Code. Except to the
extent prohibited by statute or regulation, such description must be
sufficiently detailed for a recipient of ordinary skill to be able to
understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has
attached the notice in Exhibit A and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation ("Netscape") may publish revised
and/or new versions of the License from time to time. Each version
will be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
License, You may always continue to use it under the terms of that
version. You may also choose to use such Covered Code under the terms
of any subsequent version of the License published by Netscape. No one
other than Netscape has the right to modify the terms applicable to
Covered Code created under this License.
6.3. Derivative Works.
If You create or use a modified version of this License (which you may
only do in order to apply it to code which is not already Covered Code
governed by this License), You must (a) rename Your license so that
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
"MPL", "NPL" or any confusingly similar phrase do not appear in your
license (except to note that your license differs from this License)
and (b) otherwise make it clear that Your version of the license
contains terms which differ from the Mozilla Public License and
Netscape Public License. (Filling in the name of the Initial
Developer, Original Code or Contributor in the notice described in
Exhibit A shall not of themselves be deemed to be modifications of
this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
8.1. This License and the rights granted hereunder will terminate
automatically if You fail to comply with terms herein and fail to cure
such breach within 30 days of becoming aware of the breach. All
sublicenses to the Covered Code which are properly granted shall
survive any termination of this License. Provisions which, by their
nature, must remain in effect beyond the termination of this License
shall survive.
8.2. If You initiate litigation by asserting a patent infringement
claim (excluding declatory judgment actions) against Initial Developer
or a Contributor (the Initial Developer or Contributor against whom
You file such action is referred to as "Participant") alleging that:
(a) such Participant's Contributor Version directly or indirectly
infringes any patent, then any and all rights granted by such
Participant to You under Sections 2.1 and/or 2.2 of this License
shall, upon 60 days notice from Participant terminate prospectively,
unless if within 60 days after receipt of notice You either: (i)
agree in writing to pay Participant a mutually agreeable reasonable
royalty for Your past and future use of Modifications made by such
Participant, or (ii) withdraw Your litigation claim with respect to
the Contributor Version against such Participant. If within 60 days
of notice, a reasonable royalty and payment arrangement are not
mutually agreed upon in writing by the parties or the litigation claim
is not withdrawn, the rights granted by Participant to You under
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
the 60 day notice period specified above.
(b) any software, hardware, or device, other than such Participant's
Contributor Version, directly or indirectly infringes any patent, then
any rights granted to You by such Participant under Sections 2.1(b)
and 2.2(b) are revoked effective as of the date You first made, used,
sold, distributed, or had made, Modifications made by that
Participant.
8.3. If You assert a patent infringement claim against Participant
alleging that such Participant's Contributor Version directly or
indirectly infringes any patent where such claim is resolved (such as
by license or settlement) prior to the initiation of patent
infringement litigation, then the reasonable value of the licenses
granted by such Participant under Sections 2.1 or 2.2 shall be taken
into account in determining the amount or value of any payment or
license.
8.4. In the event of termination under Sections 8.1 or 8.2 above,
all end user license agreements (excluding distributors and resellers)
which have been validly granted by You or any distributor hereunder
prior to termination shall survive termination.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a "commercial item," as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
software" and "commercial computer software documentation," as such
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
all U.S. Government End Users acquire Covered Code with only those
rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. This License shall be governed by
California law provisions (except to the extent applicable law, if
any, provides otherwise), excluding its conflict-of-law provisions.
With respect to disputes in which at least one party is a citizen of,
or an entity chartered or registered to do business in the United
States of America, any litigation relating to this License shall be
subject to the jurisdiction of the Federal Courts of the Northern
District of California, with venue lying in Santa Clara County,
California, with the losing party responsible for costs, including
without limitation, court costs and reasonable attorneys' fees and
expenses. The application of the United Nations Convention on
Contracts for the International Sale of Goods is expressly excluded.
Any law or regulation which provides that the language of a contract
shall be construed against the drafter shall not apply to this
License.
12. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is
responsible for claims and damages arising, directly or indirectly,
out of its utilization of rights under this License and You agree to
work with Initial Developer and Contributors to distribute such
responsibility on an equitable basis. Nothing herein is intended or
shall be deemed to constitute any admission of liability.
13. MULTIPLE-LICENSED CODE.
Initial Developer may designate portions of the Covered Code as
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
Developer permits you to utilize portions of the Covered Code under
Your choice of the NPL or the alternative licenses, if any, specified
by the Initial Developer in the file described in Exhibit A.
EXHIBIT A -Mozilla Public License.
``The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is ______________________________________.
The Initial Developer of the Original Code is ________________________.
Portions created by ______________________ are Copyright (C) ______
_______________________. All Rights Reserved.
Contributor(s): ______________________________________.
Alternatively, the contents of this file may be used under the terms
of the _____ license (the "[___] License"), in which case the
provisions of [______] License are applicable instead of those
above. If you wish to allow use of your version of this file only
under the terms of the [____] License and not to allow others to use
your version of this file under the MPL, indicate your decision by
deleting the provisions above and replace them with the notice and
other provisions required by the [___] License. If you do not delete
the provisions above, a recipient may use your version of this file
under either the MPL or the [___] License."
[NOTE: The text of this Exhibit A may differ slightly from the text of
the notices in the Source Code files of the Original Code. You should
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]

3561
gfx/cairo/cairo/ChangeLog Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

9
gfx/cairo/cairo/INSTALL Normal file
Просмотреть файл

@ -0,0 +1,9 @@
This package uses automake, in order to generate the Makefiles use:
$ autogen.sh
After that, standard build procedures apply:
$ make
# make install

Просмотреть файл

@ -0,0 +1,59 @@
SUBDIRS = src test
EXTRA_DIST = \
COPYING \
COPYING-LGPL-2.1 \
COPYING-MPL-1.1 \
cairo.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = cairo.pc
# Some custom targets to make it easier to release things.
# Use either:
# make release-check
# or make release-publish
RELEASE_UPLOAD_HOST = cairographics.org
RELEASE_UPLOAD_DIR = /srv/cairo.freedesktop.org/www/snapshots
RELEASE_URL_BASE = http://cairographics.org/snapshots
RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org
tar_file = $(PACKAGE)-$(VERSION).tar.gz
md5_file = $(tar_file).md5
$(md5_file): $(tar_file)
md5sum $^ > $@
release-remove-old:
rm -f $(tar_file) $(md5_file)
release-check: release-remove-old distcheck $(md5_file)
release-verify-newer:
@echo -n "Checking that no $(VERSION) release already exists..."
@ssh $(RELEASE_UPLOAD_HOST) test ! -e $(RELEASE_UPLOAD_DIR)/$(tar_file) \
|| (echo "Ouch." && echo "Found: $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)/$(tar_file)" \
&& echo "The version in configure.in must be incremented before a new release." \
&& false)
@echo "Good."
release-publish: release-verify-newer release-check
mkdir -p releases
scp $(tar_file) $(md5_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)
mv $(tar_file) $(md5_file) releases
ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && touch $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
@echo ""
@echo "Please send an announcement to $(RELEASE_ANNOUNCE_LIST)"
@echo "including the following:"
@echo ""
@echo "Subject: $(PACKAGE) snapshot $(VERSION) now available"
@echo ""
@echo "A new $(PACKAGE) snapshot $(VERSION) is now available from:"
@echo ""
@echo " $(RELEASE_URL_BASE)/$(tar_file)"
@echo " $(RELEASE_URL_BASE)/$(md5_file)"
@echo -n " "
@cat releases/$(md5_file)
@echo ""
@echo "Also, please include the new entries from the NEWS file."

745
gfx/cairo/cairo/Makefile.in Normal file
Просмотреть файл

@ -0,0 +1,745 @@
# Makefile.in generated by automake 1.9.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/cairo.pc.in \
$(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog INSTALL NEWS TODO config.guess config.sub depcomp \
install-sh ltmain.sh missing mkinstalldirs
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = cairo.pc
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
pkgconfigDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgconfig_DATA)
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ATSUI_FONT_FEATURE = @ATSUI_FONT_FEATURE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_HAS_ATSUI_FONT_FALSE = @CAIRO_HAS_ATSUI_FONT_FALSE@
CAIRO_HAS_ATSUI_FONT_TRUE = @CAIRO_HAS_ATSUI_FONT_TRUE@
CAIRO_HAS_FT_FONT_FALSE = @CAIRO_HAS_FT_FONT_FALSE@
CAIRO_HAS_FT_FONT_TRUE = @CAIRO_HAS_FT_FONT_TRUE@
CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@
CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@
CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@
CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@
CAIRO_HAS_PNG_SURFACE_FALSE = @CAIRO_HAS_PNG_SURFACE_FALSE@
CAIRO_HAS_PNG_SURFACE_TRUE = @CAIRO_HAS_PNG_SURFACE_TRUE@
CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@
CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@
CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@
CAIRO_HAS_QUARTZ_SURFACE_TRUE = @CAIRO_HAS_QUARTZ_SURFACE_TRUE@
CAIRO_HAS_XCB_SURFACE_FALSE = @CAIRO_HAS_XCB_SURFACE_FALSE@
CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@
CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@
CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
FREETYPE_CONFIG = @FREETYPE_CONFIG@
FREETYPE_LIBS = @FREETYPE_LIBS@
FT_FONT_FEATURE = @FT_FONT_FEATURE@
GLITZ_CFLAGS = @GLITZ_CFLAGS@
GLITZ_LIBS = @GLITZ_LIBS@
GLITZ_REQUIRES = @GLITZ_REQUIRES@
GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PDF_LIBS = @PDF_LIBS@
PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@
PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES = @PNG_REQUIRES@
PNG_SURFACE_FEATURE = @PNG_SURFACE_FEATURE@
PS_LIBS = @PS_LIBS@
PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@
QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@
RANLIB = @RANLIB@
SANITY_CHECKING_FEATURE = @SANITY_CHECKING_FEATURE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_INFO = @VERSION_INFO@
XCB_CFLAGS = @XCB_CFLAGS@
XCB_LIBS = @XCB_LIBS@
XCB_SURFACE_FEATURE = @XCB_SURFACE_FEATURE@
XLIB_SURFACE_FEATURE = @XLIB_SURFACE_FEATURE@
XRENDER_CFLAGS = @XRENDER_CFLAGS@
XRENDER_LIBS = @XRENDER_LIBS@
XRENDER_REQUIRES = @XRENDER_REQUIRES@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = src test
EXTRA_DIST = \
COPYING \
COPYING-LGPL-2.1 \
COPYING-MPL-1.1 \
cairo.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = cairo.pc
# Some custom targets to make it easier to release things.
# Use either:
# make release-check
# or make release-publish
RELEASE_UPLOAD_HOST = cairographics.org
RELEASE_UPLOAD_DIR = /srv/cairo.freedesktop.org/www/snapshots
RELEASE_URL_BASE = http://cairographics.org/snapshots
RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org
tar_file = $(PACKAGE)-$(VERSION).tar.gz
md5_file = $(tar_file).md5
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
cairo.pc: $(top_builddir)/config.status $(srcdir)/cairo.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
$(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkdir_p) $(distdir)/. $(distdir)/src
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am uninstall-pkgconfigDATA
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-generic clean-libtool clean-recursive \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-pkgconfigDATA install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-libtool \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-info-am \
uninstall-pkgconfigDATA
$(md5_file): $(tar_file)
md5sum $^ > $@
release-remove-old:
rm -f $(tar_file) $(md5_file)
release-check: release-remove-old distcheck $(md5_file)
release-verify-newer:
@echo -n "Checking that no $(VERSION) release already exists..."
@ssh $(RELEASE_UPLOAD_HOST) test ! -e $(RELEASE_UPLOAD_DIR)/$(tar_file) \
|| (echo "Ouch." && echo "Found: $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)/$(tar_file)" \
&& echo "The version in configure.in must be incremented before a new release." \
&& false)
@echo "Good."
release-publish: release-verify-newer release-check
mkdir -p releases
scp $(tar_file) $(md5_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)
mv $(tar_file) $(md5_file) releases
ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && touch $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
@echo ""
@echo "Please send an announcement to $(RELEASE_ANNOUNCE_LIST)"
@echo "including the following:"
@echo ""
@echo "Subject: $(PACKAGE) snapshot $(VERSION) now available"
@echo ""
@echo "A new $(PACKAGE) snapshot $(VERSION) is now available from:"
@echo ""
@echo " $(RELEASE_URL_BASE)/$(tar_file)"
@echo " $(RELEASE_URL_BASE)/$(md5_file)"
@echo -n " "
@cat releases/$(md5_file)
@echo ""
@echo "Also, please include the new entries from the NEWS file."
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

465
gfx/cairo/cairo/NEWS Normal file
Просмотреть файл

@ -0,0 +1,465 @@
Snapshot 0.3.0 (2005-01-21 Carl Worth <cworth@cworth.org>)
==========================================================
Major API changes
-----------------
1) The public header files will no longer be directly installed into
the system include directory. They will now be installed in a
subdirectory named "cairo", (eg. in /usr/include/cairo rather than
in /usr/include).
As always, the easiest way for applications to discover the
location of the header file is to let pkg-config generate the
necessary -I CFLAGS and -L/-l LDFLAGS. For example:
cc `pkg-config --cflags --libs cairo` -o foo foo.c
IMPORTANT: Users with old versions of cairo installed will need to
manually remove cairo.h and cairo-features.h from the
system include directories in order to prevent the old
headers from being used in preference to the new ones.
2) The backend-specific portions of the old monolithic cairo.h have
been split out into individual public header files. The new files
are:
cairo-atsui.h
cairo-ft.h
cairo-glitz.h
cairo-pdf.h
cairo-png.h
cairo-ps.h
cairo-quartz.h
cairo-xcb.h
cairo-xlib.h
Applications will need to be modified to explicitly include the new
header files where appropriate.
3) There are two new graphics backends in this snapshot, a PDF
backend, and a Quartz backend. There is also one new font backend,
ATSUI.
PDF backend
-----------
Kristian Høgsberg has contributed a new backend to allow cairo-based
applications to generate PDF output. The interface for creating a PDF
surface is similar to that of the PS backend, as can be seen in
cairo-pdf.h:
void
cairo_set_target_pdf (cairo_t *cr,
FILE *file,
double width_inches,
double height_inches,
double x_pixels_per_inch,
double y_pixels_per_inch);
cairo_surface_t *
cairo_pdf_surface_create (FILE *file,
double width_inches,
double height_inches,
double x_pixels_per_inch,
double y_pixels_per_inch);
Once a PDF surface has been created, applications can draw to it as
any other cairo surface.
This code is still a bit rough around the edges, and does not yet
support clipping, surface patterns, or transparent gradients. Text
only works with TrueType fonts at this point and only black text is
supported. Also, the size of the generated PDF files is currently
quite big.
Kristian is still actively developing this backend, so watch this
space for future progress.
Quartz backend
--------------
Calum Robinson has contributed a new backend to allow cairo
applications to target native Mac OS X windows through the Quartz
API. Geoff Norton integrated this backend into the current
configure-based build system, while Calum also provided Xcode build
support in the separate "macosx" module available in CVS.
The new interface, available in cairo-quartz.h, is as follows:
void
cairo_set_target_quartz_context (cairo_t *cr,
CGContextRef context,
int width,
int height);
cairo_surface_t *
cairo_quartz_surface_create (CGContextRef context,
int width,
int height);
There is an example program available in CVS in cairo-demo/quartz. It
is a port of Keith Packard's fdclock program originally written for
the xlib backend. A screenshot of this program running on Mac OS X is
available here:
http://cairographics.org/~cworth/images/fdclock-quartz.png
ATSUI font backend
------------------
This new font backend complements the Quartz backend by allowing
applications to use native font selection on Mac OS X. The interface
is a single new function:
cairo_font_t *
cairo_atsui_font_create (ATSUStyle style);
Minor API changes
-----------------
Prototype for non-existent function "cairo_ft_font_destroy" removed.
Now depends on libpixman 0.1.2 or newer, (0.1.3 is being released
concurrently and has some useful performance improvements).
Default paint color is now opaque black, (was opaque white). Default
background color is transparent (as before).
Renamed "struct cairo" to "struct _cairo" to free up the word "cairo"
from the C++ identifier name space.
Functions returning multiple return values through provided pointers,
(cairo_matrix_get_affine, cairo_current_point, and
cairo_current_color_rgb), will now accept NULL for values the user
wants to ignore.
CAIRO_HAS_FREETYPE_FONT has now been renamed to CAIRO_HAS_FT_FONT.
Performance improvements
------------------------
Alexander Larsson provided some fantastic performance improvements
yielding a 10000% performance improvement in his application, (when
also including his performance work in libpixman-0.1.3). These include
* Fixed handling of cache misses.
* Creating intermediate clip surfaces at the minimal size required.
* Eliminating roundtrips when creating intermediate Xlib surfaces.
Implementation
--------------
Major re-work of font metrics system by Keith Packard. Font metrics
should now be much more reliable.
Glitz backend
-------------
Updated for glitz-0.3.0.
Bug fixes in reference counting.
Test suite
----------
New tests for cache crashing, rotating text, improper filling of
complex polygons, and leaky rasterization.
Bug fixes
---------
Fixed assertion failure when selecting the same font multiple times in
sequence.
Fixed reference counting so cache_destroy functions work.
Remove unintended copyright statement from files generated with
PostScript backend.
Fixed to eliminate new warnings from gcc 3.4 and gcc 4.
Snapshot 0.2.0 (2004-10-27 Carl Worth <cworth@cworth.org>)
===========================================================
New license: LGPL/MPL
---------------------
The most significant news with this release is that the license of
cairo has changed. It is now dual-licensed under the LGPL and the
MPL. For details see the COPYING file as well as COPYING-LGPL-2.1 and
COPYING-MPL-1.1.
I express my thanks to everyone involved in the license change process
for their patience and support!
New font and glyph internals
----------------------------
Graydon Hoare has put a tremendous amount of work into new internals
for handling fonts and glyphs, including caches where appropriate.
This work has no impact on the user-level API, but should result in
great performance improvements for applications using text.
New test suite
--------------
This snapshot of cairo includes a (small) test suite in
cairo/test. The tests can be run with "make check". The test suite was
designed to make it very easy to add new tests, and we hope to see
many contributions here. As you find bugs, please try adding a minimal
test case to the suite, and submit it with the bug report to the
cairo@cairographics.org mailing list. This will make it much easier
for us to track progress in fixing bugs.
New name for glitz backend
--------------------------
The gl backend has now been renamed to the glitz backend. This means
that the following names have changed:
CAIRO_HAS_GL_SURFACE -> CAIRO_HAS_GLITZ_SURFACE
cairo_set_target_gl -> cairo_set_target_glitz
cairo_gl_surface_create -> cairo_glitz_surface_create
This change obviously breaks backwards compatibility for applications
using the old gl backend.
Up-to-date with latest glitz snapshots
--------------------------------------
This snapshot of cairo is now up to date with the latest glitz
snapshot, (currently 0.2.3). We know that the latest cairo and glitz
snapshots have been incompatible for a very long time. We've finally
fixed that now and we're determined to not let that happen again.
Revert some tessellation regression bugs
----------------------------------------
People that have been seeing some tessellation bugs, (eg. leaked
fills), in the CVS version of cairo may have better luck with this
release. A change since the last snapshot was identified to trigger
some of these bugs and was reverted before making the snapshot. The
behavior should be the same as the previous (0.1.23) snapshot.
Miscellaneous changes
---------------------
Changed CAIRO_FILTER_DEFAULT to CAIRO_FILTER_BEST to make gradients
easier.
Track XCB API change regarding iterators.
Various bug fixes
-----------------
Fix calculation of required number of vertices for pen.
Fix to avoid zero-dimensioned pixmaps.
Fix broken sort of pen vertices.
Fix bug when cairo_show_text called with a NULL string.
Fix clipping bugs.
Fix bug in computing image length with XCB.
Fix infinite loop bug in cairo_arc.
Fix memory management interactions with libpixman.
Snapshot 0.1.23 (2004-05-11 Carl Worth <cworth@isi.edu>)
========================================================
Fixes for gcc 3.4
-----------------
Fix prototype mismatches so that cairo can be built by gcc 3.4.
Updates to track glitz
----------------------
Various fixes to support the latest glitz snapshot (0.1.2).
Gradient updates
----------------
Radial gradients now support both inner and outer circles.
Transformed linear gradients are now properly handled.
Fixes for extend type reflect.
Glitz updates
-------------
Converted shading routines to use fixed point values and introduced a
shading operator structure for more efficient shading calculations.
Support compositing with mask surface when mask is solid or
multi-texturing is available.
PNG backend cleanups
--------------------
Fix output to properly compensate for pre-multiplied alpha format in cairo.
Add support for A8 and A1 image formats.
Bug fixes
---------
Avoid crash or infinite loop on null strings and degeneratively short
splines.
New? bugs in cairo_clip
-----------------------
There are some fairly serious bugs in cairo_clip. It is sometimes
causing an incorrect result. And even when it does work, it is
sometimes so slow as to be unusable. Some of these bugs may not be
new, (indeed cairo_clip has only ever had a braindead-slow
implementation), but I think they're worth mentioning here.
Snapshot 0.1.22 (2004-04-16 Carl Worth <cworth@isi.edu>)
========================================================
Cairo was updated to track the changes in libpixman, and now depends
on libpixman version 0.1.1.
Snapshot 0.1.21 (2004-04-09 David Reveman <c99drn@cs.umu.se>)
=============================================================
New OpenGL backend
------------------
The OpenGL backend provides hardware accelerated output for
X11 and OS X. The significant new functions are:
cairo_set_target_gl
cairo_gl_surface_create
Automatic detection of available backends
-----------------------------------------
The configure script now automatically detect what backends are
available, (use ./configure --disable-`backend' to prevent
compilation of specific backends).
Snapshot 0.1.20 (2004-04-06 Carl Worth <cworth@isi.edu>)
========================================================
New pattern API
---------------
David Reveman has contributed a new pattern API which enable linear
and radial gradient patterns in addition to the original surface-based
patterns. The significant new top-level functions are:
cairo_pattern_create_linear
cairo_pattern_create_radial
cairo_pattern_create_for_surface
cairo_pattern_add_color_stop
cairo_set_pattern
Any code using the old cairo_set_pattern, (which accepted a
cairo_surface_t rather than a cairo_pattern_t), will need to be
updated.
Update to XCB backend
---------------------
The XCB backend is now enabled by default, (use ./configure
--disable-xcb to turn it off).
Faster clipping
---------------
Graydon Hoare has added optimizations that make cairo_clip much faster
when the path is a pixel-aligned, rectangular region.
Bug fixes.
Snapshot 0.1.19 (2004-02-24 Carl Worth <cworth@isi.edu>)
========================================================
New PNG backend
---------------
Olivier Andrieu contributed a new PNG backend. It builds on the
existing image backend to make it easy to render "directly" to a
.png file. The user never needs to deal with the actual image
buffer. The significant new functions are:
cairo_set_target_png
cairo_png_surface_create
The PNG backend is not enabled by default so that by default there is
not a new dependency on libpng. Use ./configure --enable-png to enable
this backend.
Snapshot 0.1.18 (2004-02-17 Carl Worth <cworth@isi.edu>)
========================================================
Path query functionality
------------------------
It's now possible to query the current path. The two new functions
are:
cairo_current_path
cairo_current_path_flat
Each function accepts a number of callback functions that will be
called for each element in the path (move_to, line_to, curve_to,
close_path). The cairo_current_path_flat function does not accept a
curve_to callback. Instead, all curved portions of the path will be
converted to line segments, (within the current tolerance value). This
can be handy for doing things like text-on-path without having to
manually interpolate bezier splines.
New XCB backend
---------------
Jamey Sharp has contributed a second X backend that uses the new, lean
XCB library rather than Xlib. It cannot currently be compiled at the
same time as the Xlib backend. See ./configure --enable-xcb.
Build fixes for cygwin.
Bug fixes.
Snapshot 0.1.17 (2003-12-16 Carl Worth <cworth@isi.edu>)
========================================================
Better text support
-------------------
This snapshot provides much better text support by implementing the
following four functions:
cairo_text_extents
cairo_glyph_extents
cairo_text_path
cairo_glyph_path
The text/glyph_extents functions can be used to determine the bounding
box (and advance) for text as if drawn by show_text/glyphs.
The text/glyph_path objects functions place text shapes on the current
path, where they can be subsequently manipulated. For example,
following these functions with cairo_stroke allows outline text to be
drawn. Calling cairo_clip allows clipping to a text-shaped region.
Combined dependencies
---------------------
The cairo core now depends only on the libpixman library. This single
library replaces the three previous libraries libic, libpixregion, and
slim. Thanks to Dave Beckett <dave.beckett@bristol.ac.uk> for all of
the heavy lifting with this renaming effort.
Conditional compilation of backends
-----------------------------------
Cairo now allows optional backends to be disabled at compile time. The
following options may now be passed to the configure script:
--disable-xlib
--disable-ps
Note that the first option is a change from the old --without-x option
which will no longer have any effect.
OS X supported - several byte-order issues resolved
---------------------------------------------------
Cairo has now been successfully compiled under OS X. Testing revealed
that there were some byte-order problems in the PostScript backend and
the PNG generation in the demos. These have now been resolved.
2003-10
=======
Graydon Hoare <graydon@redhat.com> implemented the first real text
support using Freetype/fontconfig, (previous versions of cairo used
Xft and could only draw text when using an X backend).
2003-09
=======
Graydon Hoare <graydon@redhat.com> added the first real support for
running cairo with a non-render-aware X server.
Jamey Sharp <jamey@minilop.net> virtualized the backend font and
surface interfaces in September, 2003.
2003-06
=======
Xr is renamed cairo to avoid confusion since it no longer had a strict
dependence on X.
2003-05
=======
A new image surface backend is added to Xr. Keith Packard
<keithp@keithp.com> wrote the image compositing code in libic that is
used for the image_surface backend. This code was originally written
as the software fallback for the render extension within the X
server.
2002-06
=======
Carl Worth <cworth@isi.edu> wrote the first lines of Xr, after Keith
Packard <keithp@keithp.com> proposed the plan for a stateful drawing
library in C providing a PostScript-like rendering model.

60
gfx/cairo/cairo/README Normal file
Просмотреть файл

@ -0,0 +1,60 @@
Cairo - Multi-platform 2D graphics library
http://cairographics.org
Compiling
---------
See the INSTALL document for build instructions.
Description
-----------
Cairo is a vector graphics library with cross-device output
support. Currently supported output targets include the X Window
System and in-memory image buffers. PostScript and PDF file output is
planned. Cairo is designed to produce identical output on all output
media while taking advantage of display hardware acceleration when
available (eg. through the X Render Extension).
Cairo provides a stateful user-level API with capabilities similar to
the PDF 1.4 imaging model. Cairo provides operations including
stroking and filling Bezier cubic splines, transforming and
compositing translucent images, and antialiased text rendering.
Cairo was once named Xr, (or Xr/Xc), so if you came looking for that
software, you've found it.
Dependencies
------------
Cairo currently requires the following supporting libraries:
libpixman
Xft2
fontconfig
freetype2
Documentation
-------------
There's not much documentation yet apart from the cairo.h header
file. We'll be correcting that shortly.
In the meantime, the cairo-demo module in CVS provides a few example
programs using cairo. These may be helpful to a programmer just
beginning with cairo. Also, familiarity with the PostScript imaging
model will help in understanding cairo.
History
-------
Cairo was originally developed by Carl Worth <cworth@isi.edu> and
Keith Packard <keithp@keithp.com>. Many thanks are due to Lyle Ramshaw
without whose patient help our ignorance would be much more apparent.
Mailing List
------------
If you have trouble with cairo or you have some ideas for how it could be
improved, please feel free to send a message to cairo@cairographics.org
Cairo is still under active development and all discussion happens on
that list. So if you want to lurk or, (even better), take part in the
development, take a look. Subscription information and archives are
available:
http://cairographics.org/cgi-bin/mailman/listinfo/cairo

279
gfx/cairo/cairo/TODO Normal file
Просмотреть файл

@ -0,0 +1,279 @@
* Add support for non-antialiased rendering. API ?
* Cleanup cairo_snippets so they operate in a more default cairo
environment, (particularly with a default CTM).
* Add one of cairo_surface_finish/_finalize/_close to resolve the
"reference counting vs garbage collection" thread.
* Shove experimental snapping code from libsvg-cairo down int cairo
proper.
* Clean up the cache code a bit, (there is at least one redundant
level of cacheing, and there are some minor style issues).
* Implement the parallel install stuff, (most importantly, push
cairo.h down into into one directory below $(includedir)).
* Add CAIRO_FILL_RULE_INVERSE_WINDING and CAIRO_FILL_RULE_INVERSE_EVEN_ODD
* Simplifying the operator set?
* Fix clipping to work for all operators. The equation we have come up
with is:
((src Op dest) In clip) Add (dest Out clip)
* Resolve the rest of the rendering equation. We need a fundamental
equation upon which more convenient operations are based, (at least
formally). Some of the common operations that should be convenient:
* display surface
* display surface multiplied by constant alpha
* display pattern masked by surface
So this involves deciding whether to expose a new mask object in the
graphics state, and deciding exactly what set_alpha means. It almost
certainly means adding cairo_show_surface_mask.
* Implement a hidden transform, (as per the result of the hidden
offset thread on the mailing list).
* Replace PNG backend with an image_surface function to save a PNG
image.
* Clean up the API in preparation for freezing and release.
* Implement a PDF backend.
* Make a more interesting PS backend, (other than the current
"giant-image for every page" approach).
* Figure out what to do with DPI for image/png backends.
* Change stroke code to go through one giant polygon. This will fix
problems with stroking self-intersecting paths.
* Implement cairo_stroke_path, (very easy to do after the above change
is done).
* Re-work the backend clipping interface to use geometry rather than
images.
* Fix the intersection problem, (see reference to Hobby's paper
mentioned in cairo_traps.c).
* Add a new cairo_text_glyphs function (a sort of bridge between the
toy and the real text API):
> void
> cairo_text_glyphs (cairo_t *cr, const unsigned char *utf8,
> cairo_glyph_t *glyphs, int *num_glyphs);
>
> with num_glyphs as an input-output parameter. The behavior of this
> function would be such that calling:
>
> cairo_text_glyphs (cr, string, glyphs, &num_glyphs);
> cairo_show_glyphs (cr, glyphs, num_glyphs);
>
> would be equivalent too:
>
> cairo_show_text (cr, string);
>
> as long as the original size of glyphs/num_glyphs was large
> enough.
* Implement dashing for cairo_curve_to.
* Implement support for programmatic patterns, (ie. figure out how to
do gradients the Right Way).
* Implement cairo_arc_to.
* Fix support for old X servers so that it is not swamped with image
transport. The key idea is to assume that nothing external to cairo
will be drawing to the same drawable after it is handed to
cairo. Beyond that, we might actually provide support for cooperating
with external entities by adding one or more of the following
functions:
cairo_flush
cairo_erase
cairo_mark_dirty
* Re-implement the trapezoid rasterization algorithm according to the
new "specification".
* Stroking closed, degenerate paths should still draw caps. Round
caps are easy; square should probably draw an axis-aligned square.
* It would be nice if the user had a mechanism to reliably draw custom
caps. One approach here would be to provide the coordinates of the
butt cap faces so that the user can append seamless caps to the
current path. We may also need to provide the coordinates of the
faces of every dash as well.
* Should add geometry pruning as appropriate.
* We need a way to get at the image data after something
like cairo_surface_create_similar with the image backend.
* Three suggestions from Owen that will help GTK+ performance:
- The ability have an additional rectangle-list clip in the
Xlib surface. Frequently during an expose event, GTK+ is
drawing L shaped areas
XXXXXX
X.....
X.....
And passing the real clip to the server is going to save
a lot of pixel operations that will be thrown away.
- The ability to pass in a width/height to cairo_xlib_surface_create()
to avoid a round-trip. (Round-trips are bad to the point where
querying the the server is something you don't want to do in
production software)
- More of a future thing, the ability to hint to to cairo that
the contents of the Xlib surface passed to
cairo_xlib_surface_create() are a solid fill ... this is
very much the normal case for GTK+ usage and allows for
big optimization in the no-RENDER case.
(see http://mail.gnome.org/archives/gtk-devel-list/2003-March/msg00045.html
* Verification, profiling, optimization.
centi_unfinished.svg may provide a good test case.
A comparison with PostScript
============================
Here's a list of several classes of PostScript operators indicating
which operators have rough equivalents in cairo and which do not. In
general, the name of a cairo function corresponding to a PostScript
operator can be obtained by inserting a '_' between each word and
prefixing it with "cairo_". For example, "cairo_move_to" corresponds
to the PostScript "moveto".
In cases where the name of the cairo function deviates from this
convention, or when the behavior of the cairo function is
significantly different, the change is noted in parentheses below.
This list is not exhaustive, (there are definitely some minor (major?)
semantic deviations that are not noted below). Also, this list is
almost certainly out of date with respect to the current cairo
implementation. Caveat lector.
Operators that are not yet in cairo, but probably should be: arcto,
strokepath, rectclip?, clipsave/restore?, setstrokeadjust?,
currentdash, grestoreall?, initgraphics?, currentgstate?, setgstate?,
erasepage?, setsmoothness?
Painting operators
------------------
in cairo: stroke, fill, eofill (set_fill_rule/fill), image
(show_surface)
not in cairo: erasepage, rectstroke, rectfill, shfill, colorimage,
imagemask
Path construction operators
---------------------------
in cairo: arc, arcn (arc_negative), newpath, moveto, rmoveto
(rel_move_to), lineto, rlineto (rel_line_to), curveto, rcurveto
(rel_curve_to), closepath, currentpoint, charpath (text_path),
pathforall (current_path), flattenpath (current_path_flat)
not in cairo: arct, arcto, reversepath, strokepath, clippath, pathbbox
Clipping
--------
in cairo: clip, eoclip (set_fill_rule/clip)
not in cairo: initclip, rectclip, clipsave, cliprestore
Graphics state operators
------------------------
in cairo: setlinewidth, currentlinewidth, setlinecap, currentlinecap,
setlinejoin, currentlinejoin, setmiterlimit, currentmiterlimit,
setdash
not in cairo: setstrokeadjust, currentstrokeadjust, currentdash
Color specification operators
-----------------------------
in cairo: setrgbcolor, currentcolor
not in cairo: setcolor, setgray, currentgray, currentrgbcolor,
sethsbcolor, currenthsbcolor, setcmykcolor, currentcmykcolor,
setcolorspace, currentcolorspace
Form and pattern operators
--------------------------
in cairo: setpattern, makepattern (lock_pattern)
not in cairo: execform
Whole-state manipulation
------------------------
in cairo: gsave (save), grestore (restore)
not in cairo: grestoreall, initgraphics, gstate, currentgstate,
setgstate
Coordinate system and matrix operators
--------------------------------------
in cairo: identmatrix (identity_matrix), initmatrix (default_matrix),
setmatrix, translate, scale, rotate, concatmatrix, currentmatrix,
transform (transform_point), dtransform (transform_distance)
not in cairo: matrix, defaultmatrix, concat, itransform, idtransform,
invertmatrix
Insideness testing
------------------
in cairo: infill, instroke, ineofill (set_fill_rule/in_fill)
not in cairo: inufill, inustroke, inueofill
Device setup
------------
in cairo: showpage, copypage
not in cairo: setpagedevice, currentpagedevice, nulldevice
Glyph and font operators
------------------------
in cairo: currentfont, definefont (font_create_for_ft_face),
undefine_font (font_destroy), findfont (font_create), makefont
(transform_font), setfont, scalefont, selectfont, show (show_text),
stringwidth (x/y in text_extents), xyshow (glyph_show -- but ignoring
current_point and using absolute positions)
not in cairo, (and likely not needed): composefont, rootfont, ashow,
widthshow, awidthshow, xshow, xyshow, yshow, glyphshow, cshow, kshow,
FontDirectory, GlobalFontDirectory, StandardEncoding,
ISOLatin1Encoding, findencoding, setcachedevice, setcachedevice2,
setcharwidth
Graphics state operators (device-dependent)
-------------------------------------------
in cairo: setflat (set_tolerance), currentflat (current_tolerance)
not in cairo: sethalftone, currenthalftone, setscreen, currentscreen,
setcolorscreen, currentcolorscreen, settransfer, currenttransfer,
setcolortransfer, currentcolortransfer, setblackgeneration,
currentblackgeneration, setundercolorremoval,
currentundercolorremoval, setcolorrendering, currentcolorrendering,
setoverprint, currentoverprint, setsmoothness, currentsmoothness
PostScript operators never to be in cairo
-----------------------------------------
Operator Stack Manipulation Operators, Arithmetic and Math Operators,
Array Operators, Packed Array Operators, Dictionary Operators, String
Operators, Rational,Boolean,and Bitwise Operators, Control Operators,
Type,Attribute,and Conversion Operators, File Operators, Resource
Operators, Virtual Memory Operators, Miscellaneous Operators,
Interpreter Parameter Operators, Errors, User Path Operators

7067
gfx/cairo/cairo/aclocal.m4 поставляемый Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: cairo
Description: Multi-platform 2D graphics library
Version: @VERSION@
Requires: fontconfig libpixman @XRENDER_REQUIRES@ @PNG_REQUIRES@ @GLITZ_REQUIRES@
Libs: @FREETYPE_LIBS@ -L${libdir} -lcairo
Cflags: @FREETYPE_CFLAGS@ -I${includedir}/cairo

0
gfx/cairo/cairo/config.guess поставляемый Executable file
Просмотреть файл

Просмотреть файл

@ -0,0 +1,71 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `sincos' function. */
#undef HAVE_SINCOS
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if the system has the type `uint128_t'. */
#undef HAVE_UINT128_T
/* Define to 1 if the system has the type `uint64_t'. */
#undef HAVE_UINT64_T
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING

0
gfx/cairo/cairo/config.sub поставляемый Executable file
Просмотреть файл

24688
gfx/cairo/cairo/configure поставляемый Executable file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,374 @@
AC_INIT(src/cairo.h)
dnl ===========================================================================
# Package version number, (as distinct from shared library version)
CAIRO_VERSION=0.3.0
# libtool shared library version
# Increment if the interface has additions, changes, removals.
LT_CURRENT=1
# Increment any time the source changes; set to
# 0 if you increment CURRENT
LT_REVISION=0
# Increment if any interfaces have been added; set to 0
# if any interfaces have been removed. removal has
# precedence over adding, so set to 0 if both happened.
LT_AGE=0
VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(VERSION_INFO)
dnl ===========================================================================
AM_INIT_AUTOMAKE(cairo, $CAIRO_VERSION)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_PROG_CC
AC_PROG_CPP
AM_PROG_LIBTOOL
AC_STDC_HEADERS
AC_C_BIGENDIAN
AC_CHECK_LIBM
LIBS="$LIBS $LIBM"
AC_CHECK_FUNCS(sincos)
dnl ===========================================================================
AC_ARG_ENABLE(xlib,
[ --disable-xlib Disable cairo's Xlib backend],
[use_xlib=$enableval], [use_xlib=yes])
if test "x$use_xlib" = "xyes"; then
dnl Check for Xrender header files if the Xrender package is not installed:
PKG_CHECK_MODULES(XRENDER, xrender >= 0.6, [
XRENDER_REQUIRES=xrender
use_xlib=yes], [
AC_CHECK_HEADER(X11/extensions/Xrender.h, [
AC_PATH_XTRA
XRENDER_LIBS="$X_LIBS -lXrender -lXext -lX11 $X_EXTRA_LIBS"
use_xlib=yes], [
use_xlib="no (requires Xrender http://freedesktop.org/software/xlibs)"])])
fi
if test "x$use_xlib" != "xyes"; then
XLIB_SURFACE_FEATURE=CAIRO_HAS_NO_XLIB_SURFACE
AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, false)
else
XLIB_SURFACE_FEATURE=CAIRO_HAS_XLIB_SURFACE
AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, true)
fi
AC_SUBST(XLIB_SURFACE_FEATURE)
AC_SUBST(XRENDER_REQUIRES)
CAIRO_CFLAGS="$CAIRO_CFLAGS $XRENDER_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XRENDER_LIBS"
AC_ARG_ENABLE(quartz,
[ --disable-quartz Disable cairo's quartz backend],
[use_quartz=$enableval], [use_quartz=yes])
if test "x$use_quartz" = "xyes"; then
dnl There is no pkgconfig for quartz; lets do a header check
AC_CHECK_HEADER(Carbon/Carbon.h, [use_quartz=yes], [use_quartz=no])
fi
if test "x$use_quartz" != "xyes"; then
QUARTZ_SURFACE_FEATURE=CAIRO_HAS_NO_QUARTZ_SURFACE
AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, false)
else
QUARTZ_SURFACE_FEATURE=CAIRO_HAS_QUARTZ_SURFACE
QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, true)
fi
AC_SUBST(QUARTZ_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $QUARTZ_LIBS"
dnl ===========================================================================
AC_ARG_ENABLE(xcb,
[ --disable-xcb Disable cairo's XCB backend],
[use_xcb=$enableval], [use_xcb=yes])
if test "x$use_xcb" = "xyes"; then
PKG_CHECK_MODULES(XCB, xcb, [use_xcb=yes], [
use_xcb="no (requires XCB http://freedesktop.org/software/xcb)"])
fi
if test "x$use_xcb" != "xyes"; then
XCB_SURFACE_FEATURE=CAIRO_HAS_NO_XCB_SURFACE
AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, false)
else
XCB_SURFACE_FEATURE=CAIRO_HAS_XCB_SURFACE
AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, true)
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $XCB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XCB_LIBS"
AC_SUBST(XCB_SURFACE_FEATURE)
dnl ===========================================================================
AC_ARG_ENABLE(ps,
[ --disable-ps Disable cairo's PostScript backend],
[use_ps=$enableval], [use_ps=yes])
if test "x$use_ps" != "xyes"; then
PS_SURFACE_FEATURE=CAIRO_HAS_NO_PS_SURFACE
AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, false)
else
PS_SURFACE_FEATURE=CAIRO_HAS_PS_SURFACE
PS_LIBS=-lz
AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, true)
fi
CAIRO_LIBS="$CAIRO_LIBS $PS_LIBS"
AC_SUBST(PS_SURFACE_FEATURE)
AC_SUBST(PS_LIBS)
dnl ===========================================================================
AC_ARG_ENABLE(pdf,
[ --disable-pdf Disable cairo's PDF backend],
[use_pdf=$enableval], [use_pdf=yes])
if test "x$use_pdf" != "xyes"; then
PDF_SURFACE_FEATURE=CAIRO_HAS_NO_PDF_SURFACE
AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, false)
else
PDF_SURFACE_FEATURE=CAIRO_HAS_PDF_SURFACE
PDF_LIBS=-lz
AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, true)
fi
CAIRO_LIBS="$CAIRO_LIBS $PDF_LIBS"
AC_SUBST(PDF_SURFACE_FEATURE)
AC_SUBST(PDF_LIBS)
dnl ===========================================================================
AC_ARG_ENABLE(png,
[ --disable-png Disable cairo's PNG backend],
[use_png=$enableval], [use_png=yes])
if test "x$use_png" = "xyes"; then
PKG_CHECK_MODULES(PNG, libpng12, [
PNG_REQUIRES=libpng12
use_png=yes], [
PKG_CHECK_MODULES(PNG, libpng10, [
PNG_REQUIRES=libpng10
use_png=yes], [use_png="no (requires libpng http://www.libpng.org)"])])
fi
if test "x$use_png" != "xyes"; then
PNG_SURFACE_FEATURE=CAIRO_HAS_NO_PNG_SURFACE
AM_CONDITIONAL(CAIRO_HAS_PNG_SURFACE, false)
else
PNG_SURFACE_FEATURE=CAIRO_HAS_PNG_SURFACE
AM_CONDITIONAL(CAIRO_HAS_PNG_SURFACE, true)
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $PNG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PNG_LIBS"
AC_SUBST(PNG_SURFACE_FEATURE)
AC_SUBST(PNG_REQUIRES)
dnl ===========================================================================
AC_ARG_ENABLE(glitz,
[ --disable-glitz Disable cairo's glitz backend],
[use_glitz=$enableval], [use_glitz=yes])
if test "x$use_glitz" = "xyes"; then
PKG_CHECK_MODULES(GLITZ, glitz >= 0.3.0, [
GLITZ_REQUIRES=glitz
use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/software/glitz)"])
fi
if test "x$use_glitz" != "xyes"; then
GLITZ_SURFACE_FEATURE=CAIRO_HAS_NO_GLITZ_SURFACE
AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, false)
else
GLITZ_SURFACE_FEATURE=CAIRO_HAS_GLITZ_SURFACE
AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, true)
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $GLITZ_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS"
AC_SUBST(GLITZ_SURFACE_FEATURE)
AC_SUBST(GLITZ_REQUIRES)
dnl ===========================================================================
AC_ARG_ENABLE(sanity-checking,
[ --disable-sanity Disable cairo's sanity checking routines],
[check_sanity=$enableval], [check_sanity=yes])
if test "x$check_sanity" != "xyes"; then
SANITY_CHECKING_FEATURE=CAIRO_NO_SANITY_CHECKING
else
SANITY_CHECKING_FEATURE=CAIRO_DO_SANITY_CHECKING
fi
AC_SUBST(SANITY_CHECKING_FEATURE)
dnl ===========================================================================
PKG_CHECK_MODULES(PIXMAN, libpixman >= 0.1.2)
CAIRO_CFLAGS="$CAIRO_CFLAGS $PIXMAN_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PIXMAN_LIBS"
dnl ===========================================================================
AC_ARG_ENABLE(freetype,
[ --disable-freetype Disable cairo's freetype font backend],
[use_freetype=$enableval], [use_freetype=yes])
if test "x$use_freetype" = "xyes"; then
PKG_CHECK_MODULES(FONTCONFIG, fontconfig,
[use_freetype=yes], [use_freetype=no])
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $FONTCONFIG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FONTCONFIG_LIBS"
# Test for freetype2 separate from pkg-config since at least up to
# 2003-06-07, there was no freetype2.pc in the release.
#
# Freetype versions come in three forms:
# release (such as 2.1.5)
# libtool (such as 9.4.3) (returned by freetype-config)
# platform-specific/soname (such as 6.3.4)
# and they recommend you never use the platform-specific version
# (see docs/VERSION.DLL in freetype2 sources)
#
# Set these as appropriate:
# release number - for information only
FREETYPE_MIN_RELEASE=2.1.0
# libtool-specific version - this is what is checked
FREETYPE_MIN_VERSION=8.0.2
if test "x$use_freetype" = "xyes"; then
if test -z "$FREETYPE_CONFIG"; then
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
fi
if test "$FREETYPE_CONFIG" = "no" ; then
AC_MSG_ERROR(No freetype-config script found in path or FREETYPE_CONFIG)
fi
AC_MSG_CHECKING(freetype2 libtool version)
FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
VERSION_DEC=`echo $FREETYPE_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
MIN_VERSION_DEC=`echo $FREETYPE_MIN_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
if test $VERSION_DEC -lt $MIN_VERSION_DEC; then
AC_MSG_ERROR($FREETYPE_VERSION - version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)
fi
AC_MSG_RESULT($FREETYPE_VERSION - OK)
FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS"
if test "x$use_freetype" != "xyes"; then
FT_FONT_FEATURE=CAIRO_HAS_NO_FT_FONT
AM_CONDITIONAL(CAIRO_HAS_FT_FONT, false)
else
FT_FONT_FEATURE=CAIRO_HAS_FT_FONT
AM_CONDITIONAL(CAIRO_HAS_FT_FONT, true)
fi
AC_SUBST(FT_FONT_FEATURE)
dnl ===========================================================================
dnl This check should default to 'yes' once we have code to actually
dnl check for the atsui font backend.
AC_ARG_ENABLE(atsui,
[ --disable-atsui Disable cairo's atsui font backend],
[use_atsui=$enableval], [use_atsui=yes])
if test "x$use_atsui" = "xyes"; then
dnl There is no pkgconfig for atsui; lets do a header check
AC_CHECK_HEADER(Carbon/Carbon.h, [use_atsui=yes], [use_atsui=no])
fi
if test "x$use_atsui" != "xyes"; then
ATSUI_FONT_FEATURE=CAIRO_HAS_NO_ATSUI_FONT
AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, false)
else
ATSUI_FONT_FEATURE=CAIRO_HAS_ATSUI_FONT
AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, true)
fi
AC_SUBST(ATSUI_FONT_FEATURE)
dnl ===========================================================================
dnl Checks for precise integer types
AC_CHECK_TYPES([uint64_t, uint128_t])
dnl Use lots of warning flags with GCC
WARN_CFLAGS=""
if test "x$GCC" = "xyes"; then
WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \
-Wnested-externs -fno-strict-aliasing"
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $WARN_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS"
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LIBS)
dnl ===========================================================================
AC_OUTPUT([
cairo.pc
Makefile
src/Makefile
src/cairo-features.h
test/Makefile
])
dnl ===========================================================================
echo ""
echo "cairo will be compiled with the following surface backends:"
echo " Xlib: $use_xlib"
echo " Quartz: $use_quartz"
echo " XCB: $use_xcb"
echo " PostScript: $use_ps"
echo " PDF: $use_pdf"
echo " PNG: $use_png"
echo " glitz: $use_glitz"
echo ""
echo "and the following font backends:"
echo " freetype: $use_freetype"
echo " atsui: $use_atsui"
echo ""

0
gfx/cairo/cairo/depcomp Executable file
Просмотреть файл

0
gfx/cairo/cairo/install-sh Executable file
Просмотреть файл

Просмотреть файл

0
gfx/cairo/cairo/missing Executable file
Просмотреть файл

0
gfx/cairo/cairo/mkinstalldirs Executable file
Просмотреть файл

Просмотреть файл

@ -0,0 +1,100 @@
cairoincludedir = $(includedir)/cairo
cairoinclude_HEADERS = \
cairo.h \
cairo-atsui.h \
cairo-features.h\
cairo-ft.h \
cairo-glitz.h \
cairo-pdf.h \
cairo-png.h \
cairo-ps.h \
cairo-quartz.h \
cairo-xcb.h \
cairo-xlib.h
lib_LTLIBRARIES = libcairo.la
if CAIRO_HAS_PS_SURFACE
libcairo_ps_sources = cairo_ps_surface.c cairo-ps.h
endif
if CAIRO_HAS_PDF_SURFACE
libcairo_pdf_sources = cairo_pdf_surface.c cairo-pdf.h
endif
if CAIRO_HAS_PNG_SURFACE
libcairo_png_sources = cairo_png_surface.c cairo-png.h
endif
if CAIRO_HAS_XLIB_SURFACE
libcairo_xlib_sources = cairo_xlib_surface.c cairo-xlib.h
endif
if CAIRO_HAS_QUARTZ_SURFACE
libcairo_quartz_sources = cairo_quartz_surface.c cairo-quartz.h
endif
if CAIRO_HAS_XCB_SURFACE
libcairo_xcb_sources = cairo_xcb_surface.c cairo-xcb.h
endif
if CAIRO_HAS_GLITZ_SURFACE
libcairo_glitz_sources = cairo_glitz_surface.c cairo-glitz.h
endif
if CAIRO_HAS_ATSUI_FONT
libcairo_atsui_sources = cairo_atsui_font.c cairo-atsui.h
endif
if CAIRO_HAS_FT_FONT
libcairo_ft_sources = cairo_ft_font.c cairo-ft.h
endif
# These names match automake style variable definition conventions so
# without these lines, automake will complain during the handling of
# the libcairo_la_LIBADD below. (The INCLUDES is an autoconf only
# term and automake does not care about it)
FONTCONFIG_LIBS=@FONTCONFIG_LIBS@
XRENDER_LIBS=@XRENDER_LIBS@
libcairo_la_SOURCES = \
cairo.c \
cairo.h \
cairo_array.c \
cairo_cache.c \
cairo_color.c \
cairo_fixed.c \
cairo_font.c \
cairo_gstate.c \
cairo_hull.c \
cairo_image_surface.c \
cairo_matrix.c \
cairo_path.c \
cairo_path_bounds.c \
cairo_path_fill.c \
cairo_path_stroke.c \
cairo_pen.c \
cairo_polygon.c \
cairo_slope.c \
cairo_spline.c \
cairo_surface.c \
cairo_traps.c \
cairo_pattern.c \
cairo_wideint.c \
cairo-wideint.h \
$(libcairo_atsui_sources)\
$(libcairo_ft_sources)\
$(libcairo_ps_sources) \
$(libcairo_pdf_sources) \
$(libcairo_png_sources) \
$(libcairo_xlib_sources)\
$(libcairo_quartz_sources)\
$(libcairo_xcb_sources) \
$(libcairo_glitz_sources)\
cairoint.h
libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined
INCLUDES = -I$(srcdir) $(CAIRO_CFLAGS)
libcairo_la_LIBADD = $(CAIRO_LIBS)

Просмотреть файл

@ -0,0 +1,663 @@
# Makefile.in generated by automake 1.9.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = $(libcairo_la_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = src
DIST_COMMON = $(cairoinclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/cairo-features.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = cairo-features.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cairoincludedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libcairo_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am__libcairo_la_SOURCES_DIST = cairo.c cairo.h cairo_array.c \
cairo_cache.c cairo_color.c cairo_fixed.c cairo_font.c \
cairo_gstate.c cairo_hull.c cairo_image_surface.c \
cairo_matrix.c cairo_path.c cairo_path_bounds.c \
cairo_path_fill.c cairo_path_stroke.c cairo_pen.c \
cairo_polygon.c cairo_slope.c cairo_spline.c cairo_surface.c \
cairo_traps.c cairo_pattern.c cairo_wideint.c cairo-wideint.h \
cairo_atsui_font.c cairo-atsui.h cairo_ft_font.c cairo-ft.h \
cairo_ps_surface.c cairo-ps.h cairo_pdf_surface.c cairo-pdf.h \
cairo_png_surface.c cairo-png.h cairo_xlib_surface.c \
cairo-xlib.h cairo_quartz_surface.c cairo-quartz.h \
cairo_xcb_surface.c cairo-xcb.h cairo_glitz_surface.c \
cairo-glitz.h cairoint.h
@CAIRO_HAS_ATSUI_FONT_TRUE@am__objects_1 = cairo_atsui_font.lo
@CAIRO_HAS_FT_FONT_TRUE@am__objects_2 = cairo_ft_font.lo
@CAIRO_HAS_PS_SURFACE_TRUE@am__objects_3 = cairo_ps_surface.lo
@CAIRO_HAS_PDF_SURFACE_TRUE@am__objects_4 = cairo_pdf_surface.lo
@CAIRO_HAS_PNG_SURFACE_TRUE@am__objects_5 = cairo_png_surface.lo
@CAIRO_HAS_XLIB_SURFACE_TRUE@am__objects_6 = cairo_xlib_surface.lo
@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__objects_7 = \
@CAIRO_HAS_QUARTZ_SURFACE_TRUE@ cairo_quartz_surface.lo
@CAIRO_HAS_XCB_SURFACE_TRUE@am__objects_8 = cairo_xcb_surface.lo
@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__objects_9 = cairo_glitz_surface.lo
am_libcairo_la_OBJECTS = cairo.lo cairo_array.lo cairo_cache.lo \
cairo_color.lo cairo_fixed.lo cairo_font.lo cairo_gstate.lo \
cairo_hull.lo cairo_image_surface.lo cairo_matrix.lo \
cairo_path.lo cairo_path_bounds.lo cairo_path_fill.lo \
cairo_path_stroke.lo cairo_pen.lo cairo_polygon.lo \
cairo_slope.lo cairo_spline.lo cairo_surface.lo cairo_traps.lo \
cairo_pattern.lo cairo_wideint.lo $(am__objects_1) \
$(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_5) $(am__objects_6) $(am__objects_7) \
$(am__objects_8) $(am__objects_9)
libcairo_la_OBJECTS = $(am_libcairo_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libcairo_la_SOURCES)
DIST_SOURCES = $(am__libcairo_la_SOURCES_DIST)
cairoincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(cairoinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ATSUI_FONT_FEATURE = @ATSUI_FONT_FEATURE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_HAS_ATSUI_FONT_FALSE = @CAIRO_HAS_ATSUI_FONT_FALSE@
CAIRO_HAS_ATSUI_FONT_TRUE = @CAIRO_HAS_ATSUI_FONT_TRUE@
CAIRO_HAS_FT_FONT_FALSE = @CAIRO_HAS_FT_FONT_FALSE@
CAIRO_HAS_FT_FONT_TRUE = @CAIRO_HAS_FT_FONT_TRUE@
CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@
CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@
CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@
CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@
CAIRO_HAS_PNG_SURFACE_FALSE = @CAIRO_HAS_PNG_SURFACE_FALSE@
CAIRO_HAS_PNG_SURFACE_TRUE = @CAIRO_HAS_PNG_SURFACE_TRUE@
CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@
CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@
CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@
CAIRO_HAS_QUARTZ_SURFACE_TRUE = @CAIRO_HAS_QUARTZ_SURFACE_TRUE@
CAIRO_HAS_XCB_SURFACE_FALSE = @CAIRO_HAS_XCB_SURFACE_FALSE@
CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@
CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@
CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
# These names match automake style variable definition conventions so
# without these lines, automake will complain during the handling of
# the libcairo_la_LIBADD below. (The INCLUDES is an autoconf only
# term and automake does not care about it)
FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
FREETYPE_CONFIG = @FREETYPE_CONFIG@
FREETYPE_LIBS = @FREETYPE_LIBS@
FT_FONT_FEATURE = @FT_FONT_FEATURE@
GLITZ_CFLAGS = @GLITZ_CFLAGS@
GLITZ_LIBS = @GLITZ_LIBS@
GLITZ_REQUIRES = @GLITZ_REQUIRES@
GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PDF_LIBS = @PDF_LIBS@
PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@
PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES = @PNG_REQUIRES@
PNG_SURFACE_FEATURE = @PNG_SURFACE_FEATURE@
PS_LIBS = @PS_LIBS@
PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@
QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@
RANLIB = @RANLIB@
SANITY_CHECKING_FEATURE = @SANITY_CHECKING_FEATURE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_INFO = @VERSION_INFO@
XCB_CFLAGS = @XCB_CFLAGS@
XCB_LIBS = @XCB_LIBS@
XCB_SURFACE_FEATURE = @XCB_SURFACE_FEATURE@
XLIB_SURFACE_FEATURE = @XLIB_SURFACE_FEATURE@
XRENDER_CFLAGS = @XRENDER_CFLAGS@
XRENDER_LIBS = @XRENDER_LIBS@
XRENDER_REQUIRES = @XRENDER_REQUIRES@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
cairoincludedir = $(includedir)/cairo
cairoinclude_HEADERS = \
cairo.h \
cairo-atsui.h \
cairo-features.h\
cairo-ft.h \
cairo-glitz.h \
cairo-pdf.h \
cairo-png.h \
cairo-ps.h \
cairo-quartz.h \
cairo-xcb.h \
cairo-xlib.h
lib_LTLIBRARIES = libcairo.la
@CAIRO_HAS_PS_SURFACE_TRUE@libcairo_ps_sources = cairo_ps_surface.c cairo-ps.h
@CAIRO_HAS_PDF_SURFACE_TRUE@libcairo_pdf_sources = cairo_pdf_surface.c cairo-pdf.h
@CAIRO_HAS_PNG_SURFACE_TRUE@libcairo_png_sources = cairo_png_surface.c cairo-png.h
@CAIRO_HAS_XLIB_SURFACE_TRUE@libcairo_xlib_sources = cairo_xlib_surface.c cairo-xlib.h
@CAIRO_HAS_QUARTZ_SURFACE_TRUE@libcairo_quartz_sources = cairo_quartz_surface.c cairo-quartz.h
@CAIRO_HAS_XCB_SURFACE_TRUE@libcairo_xcb_sources = cairo_xcb_surface.c cairo-xcb.h
@CAIRO_HAS_GLITZ_SURFACE_TRUE@libcairo_glitz_sources = cairo_glitz_surface.c cairo-glitz.h
@CAIRO_HAS_ATSUI_FONT_TRUE@libcairo_atsui_sources = cairo_atsui_font.c cairo-atsui.h
@CAIRO_HAS_FT_FONT_TRUE@libcairo_ft_sources = cairo_ft_font.c cairo-ft.h
libcairo_la_SOURCES = \
cairo.c \
cairo.h \
cairo_array.c \
cairo_cache.c \
cairo_color.c \
cairo_fixed.c \
cairo_font.c \
cairo_gstate.c \
cairo_hull.c \
cairo_image_surface.c \
cairo_matrix.c \
cairo_path.c \
cairo_path_bounds.c \
cairo_path_fill.c \
cairo_path_stroke.c \
cairo_pen.c \
cairo_polygon.c \
cairo_slope.c \
cairo_spline.c \
cairo_surface.c \
cairo_traps.c \
cairo_pattern.c \
cairo_wideint.c \
cairo-wideint.h \
$(libcairo_atsui_sources)\
$(libcairo_ft_sources)\
$(libcairo_ps_sources) \
$(libcairo_pdf_sources) \
$(libcairo_png_sources) \
$(libcairo_xlib_sources)\
$(libcairo_quartz_sources)\
$(libcairo_xcb_sources) \
$(libcairo_glitz_sources)\
cairoint.h
libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined
INCLUDES = -I$(srcdir) $(CAIRO_CFLAGS)
libcairo_la_LIBADD = $(CAIRO_LIBS)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
cairo-features.h: $(top_builddir)/config.status $(srcdir)/cairo-features.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libcairo.la: $(libcairo_la_OBJECTS) $(libcairo_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libcairo_la_LDFLAGS) $(libcairo_la_OBJECTS) $(libcairo_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_array.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_atsui_font.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_cache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_color.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_fixed.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_font.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_ft_font.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_glitz_surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_gstate.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_hull.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_image_surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_matrix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_path.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_path_bounds.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_path_fill.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_path_stroke.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_pattern.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_pdf_surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_pen.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_png_surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_polygon.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_ps_surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_quartz_surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_slope.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_spline.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_traps.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_wideint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_xcb_surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_xlib_surface.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-cairoincludeHEADERS: $(cairoinclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(cairoincludedir)" || $(mkdir_p) "$(DESTDIR)$(cairoincludedir)"
@list='$(cairoinclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(cairoincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(cairoincludedir)/$$f'"; \
$(cairoincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(cairoincludedir)/$$f"; \
done
uninstall-cairoincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(cairoinclude_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(cairoincludedir)/$$f'"; \
rm -f "$(DESTDIR)$(cairoincludedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cairoincludedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-cairoincludeHEADERS
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-cairoincludeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-cairoincludeHEADERS install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-libLTLIBRARIES install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-cairoincludeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

Просмотреть файл

@ -0,0 +1,50 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2004 Calum Robinson
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is Calum Robinson
*
* Contributor(s):
* Calum Robinson <calumr@mac.com>
*/
#include <cairo.h>
#ifndef CAIRO_ATSUI_H
#define CAIRO_ATSUI_H
#ifdef CAIRO_HAS_ATSUI_FONT
/* ATSUI platform-specific font interface */
#include <Carbon/Carbon.h>
cairo_font_t *
cairo_atsui_font_create(ATSUStyle style);
#endif /* CAIRO_HAS_ATSUI_FONT */
#endif /* CAIRO_ATSUI_H */

Просмотреть файл

@ -0,0 +1,60 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2003 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl Worth <cworth@east.isi.edu>
*/
#ifndef CAIRO_FEATURES_H
#define CAIRO_FEATURES_H
#define CAIRO_HAS_PS_SURFACE
#define CAIRO_HAS_PDF_SURFACE
#define CAIRO_HAS_PNG_SURFACE
#define CAIRO_HAS_XLIB_SURFACE
#define CAIRO_HAS_NO_QUARTZ_SURFACE
#define CAIRO_HAS_NO_XCB_SURFACE
#define CAIRO_HAS_GLITZ_SURFACE
#define CAIRO_HAS_FT_FONT
#define CAIRO_HAS_NO_ATSUI_FONT
#define CAIRO_DO_SANITY_CHECKING
#endif

Просмотреть файл

@ -0,0 +1,60 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2003 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl Worth <cworth@east.isi.edu>
*/
#ifndef CAIRO_FEATURES_H
#define CAIRO_FEATURES_H
#define @PS_SURFACE_FEATURE@
#define @PDF_SURFACE_FEATURE@
#define @PNG_SURFACE_FEATURE@
#define @XLIB_SURFACE_FEATURE@
#define @QUARTZ_SURFACE_FEATURE@
#define @XCB_SURFACE_FEATURE@
#define @GLITZ_SURFACE_FEATURE@
#define @FT_FONT_FEATURE@
#define @ATSUI_FONT_FEATURE@
#define @SANITY_CHECKING_FEATURE@
#endif

Просмотреть файл

@ -0,0 +1,62 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <cairo.h>
#ifndef CAIRO_FT_H
#define CAIRO_FT_H
#ifdef CAIRO_HAS_FT_FONT
/* Fontconfig/Freetype platform-specific font interface */
#include <fontconfig/fontconfig.h>
#include <ft2build.h>
#include FT_FREETYPE_H
cairo_font_t *
cairo_ft_font_create (FT_Library ft_library, FcPattern *pattern);
cairo_font_t *
cairo_ft_font_create_for_ft_face (FT_Face face);
FT_Face
cairo_ft_font_face (cairo_font_t *ft_font);
FcPattern *
cairo_ft_font_pattern (cairo_font_t *ft_font);
#endif /* CAIRO_HAS_FT_FONT */
#endif /* CAIRO_FT_H */

Просмотреть файл

@ -0,0 +1,53 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <cairo.h>
#ifndef CAIRO_GLITZ_H
#define CAIRO_GLITZ_H
#ifdef CAIRO_HAS_GLITZ_SURFACE
#include <glitz.h>
void
cairo_set_target_glitz (cairo_t *cr,
glitz_surface_t *surface);
cairo_surface_t *
cairo_glitz_surface_create (glitz_surface_t *surface);
#endif /* CAIRO_HAS_GLITZ_SURFACE */
#endif /* CAIRO_GLITZ_H */

Просмотреть файл

@ -0,0 +1,62 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <cairo.h>
#ifndef CAIRO_PDF_H
#define CAIRO_PDF_H
#ifdef CAIRO_HAS_PDF_SURFACE
#include <stdio.h>
void
cairo_set_target_pdf (cairo_t *cr,
FILE *file,
double width_inches,
double height_inches,
double x_pixels_per_inch,
double y_pixels_per_inch);
cairo_surface_t *
cairo_pdf_surface_create (FILE *file,
double width_inches,
double height_inches,
double x_pixels_per_inch,
double y_pixels_per_inch);
#endif /* CAIRO_HAS_PDF_SURFACE */
#endif /* CAIRO_PDF_H */

Просмотреть файл

@ -0,0 +1,59 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <cairo.h>
#ifndef CAIRO_PNG_H
#define CAIRO_PNG_H
#ifdef CAIRO_HAS_PNG_SURFACE
#include <stdio.h>
void
cairo_set_target_png (cairo_t *cr,
FILE *file,
cairo_format_t format,
int width,
int height);
cairo_surface_t *
cairo_png_surface_create (FILE *file,
cairo_format_t format,
int width,
int height);
#endif /* CAIRO_HAS_PNG_SURFACE */
#endif /* CAIRO_PNG_H */

Просмотреть файл

@ -0,0 +1,63 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <cairo.h>
#ifndef CAIRO_PS_H
#define CAIRO_PS_H
#ifdef CAIRO_HAS_PS_SURFACE
#include <stdio.h>
void
cairo_set_target_ps (cairo_t *cr,
FILE *file,
double width_inches,
double height_inches,
double x_pixels_per_inch,
double y_pixels_per_inch);
/* PS-surface functions */
cairo_surface_t *
cairo_ps_surface_create (FILE *file,
double width_inches,
double height_inches,
double x_pixels_per_inch,
double y_pixels_per_inch);
#endif /* CAIRO_HAS_PS_SURFACE */
#endif /* CAIRO_PS_H */

Просмотреть файл

@ -0,0 +1,58 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <cairo.h>
#ifndef CAIRO_QUARTZ_H
#define CAIRO_QUARTZ_H
#ifdef CAIRO_HAS_QUARTZ_SURFACE
#include <Carbon/Carbon.h>
void
cairo_set_target_quartz_context( cairo_t *cr,
CGContextRef context,
int width,
int height);
cairo_surface_t *
cairo_quartz_surface_create ( CGContextRef context,
int width,
int height);
#endif /* CAIRO_HAS_QUARTZ_SURFACE */
#endif /* CAIRO_QUARTZ_H */

Просмотреть файл

@ -0,0 +1,285 @@
/*
* $Id: cairo-wideint.h,v 1.1 2005-02-24 20:08:53 tor%cs.brown.edu Exp $
*
* Copyright © 2004 Keith Packard
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is Keith Packard
*
* Contributor(s):
* Keith R. Packard <keithp@keithp.com>
*
*/
#ifndef CAIRO_WIDEINT_H
#define CAIRO_WIDEINT_H
#include <stdint.h>
/*
* 64-bit datatypes. Two separate implementations, one using
* built-in 64-bit signed/unsigned types another implemented
* as a pair of 32-bit ints
*/
#define I cairo_private
#if !HAVE_UINT64_T
typedef struct _cairo_uint64 {
uint32_t lo, hi;
} cairo_uint64_t, cairo_int64_t;
cairo_uint64_t I _cairo_uint32_to_uint64 (uint32_t i);
#define _cairo_uint64_to_uint32(a) ((a).lo)
cairo_uint64_t I _cairo_uint64_add (cairo_uint64_t a, cairo_uint64_t b);
cairo_uint64_t I _cairo_uint64_sub (cairo_uint64_t a, cairo_uint64_t b);
cairo_uint64_t I _cairo_uint64_mul (cairo_uint64_t a, cairo_uint64_t b);
cairo_uint64_t I _cairo_uint32x32_64_mul (uint32_t a, uint32_t b);
cairo_uint64_t I _cairo_uint64_lsl (cairo_uint64_t a, int shift);
cairo_uint64_t I _cairo_uint64_rsl (cairo_uint64_t a, int shift);
cairo_uint64_t I _cairo_uint64_rsa (cairo_uint64_t a, int shift);
int I _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b);
int I _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b);
cairo_uint64_t I _cairo_uint64_negate (cairo_uint64_t a);
#define _cairo_uint64_negative(a) (((int32_t) ((a).hi)) < 0)
cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a);
#define _cairo_uint64_to_int64(i) (i)
#define _cairo_int64_to_uint64(i) (i)
cairo_int64_t I _cairo_int32_to_int64(int32_t i);
#define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32(a))
#define _cairo_int64_add(a,b) _cairo_uint64_add (a,b)
#define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b)
#define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b)
int I _cairo_int32x32_64_mul (int32_t a, int32_t b);
int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b);
#define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b)
#define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b)
#define _cairo_int64_rsl(a,b) _cairo_uint64_rsl (a,b)
#define _cairo_int64_rsa(a,b) _cairo_uint64_rsa (a,b)
#define _cairo_int64_negate(a) _cairo_uint64_negate(a)
#define _cairo_int64_negative(a) (((int32_t) ((a).hi)) < 0)
#define _cairo_int64_not(a) _cairo_uint64_not(a)
#else
typedef uint64_t cairo_uint64_t;
typedef int64_t cairo_int64_t;
#define _cairo_uint32_to_uint64(i) ((uint64_t) (i))
#define _cairo_uint64_to_uint32(i) ((uint32_t) (i))
#define _cairo_uint64_add(a,b) ((a) + (b))
#define _cairo_uint64_sub(a,b) ((a) - (b))
#define _cairo_uint64_mul(a,b) ((a) * (b))
#define _cairo_uint32x32_64_mul(a,b) ((uint64_t) (a) * (b))
#define _cairo_uint64_lsl(a,b) ((a) << (b))
#define _cairo_uint64_rsl(a,b) ((uint64_t) (a) >> (b))
#define _cairo_uint64_rsa(a,b) ((uint64_t) ((int64_t) (a) >> (b)))
#define _cairo_uint64_lt(a,b) ((a) < (b))
#define _cairo_uint64_eq(a,b) ((a) == (b))
#define _cairo_uint64_negate(a) ((uint64_t) -((int64_t) (a)))
#define _cairo_uint64_negative(a) ((int64_t) (a) < 0)
#define _cairo_uint64_not(a) (~(a))
#define _cairo_uint64_to_int64(i) ((int64_t) (i))
#define _cairo_int64_to_uint64(i) ((uint64_t) (i))
#define _cairo_int32_to_int64(i) ((int64_t) (i))
#define _cairo_int64_to_int32(i) ((int32_t) (i))
#define _cairo_int64_add(a,b) ((a) + (b))
#define _cairo_int64_sub(a,b) ((a) - (b))
#define _cairo_int64_mul(a,b) ((a) * (b))
#define _cairo_int32x32_64_mul(a,b) ((int64_t) (a) * (b))
#define _cairo_int64_lt(a,b) ((a) < (b))
#define _cairo_int64_eq(a,b) ((a) == (b))
#define _cairo_int64_lsl(a,b) ((a) << (b))
#define _cairo_int64_rsl(a,b) ((int64_t) ((uint64_t) (a) >> (b)))
#define _cairo_int64_rsa(a,b) ((int64_t) (a) >> (b))
#define _cairo_int64_negate(a) (-(a))
#define _cairo_int64_negative(a) ((a) < 0)
#define _cairo_int64_not(a) (~(a))
#endif
/*
* 64-bit comparisions derived from lt or eq
*/
#define _cairo_uint64_le(a,b) (!_cairo_uint64_gt(a,b))
#define _cairo_uint64_ne(a,b) (!_cairo_uint64_eq(a,b))
#define _cairo_uint64_ge(a,b) (!_cairo_uint64_lt(a,b))
#define _cairo_uint64_gt(a,b) _cairo_uint64_lt(b,a)
#define _cairo_int64_le(a,b) (!_cairo_int64_gt(a,b))
#define _cairo_int64_ne(a,b) (!_cairo_int64_eq(a,b))
#define _cairo_int64_ge(a,b) (!_cairo_int64_lt(a,b))
#define _cairo_int64_gt(a,b) _cairo_int64_lt(b,a)
/*
* As the C implementation always computes both, create
* a function which returns both for the 'native' type as well
*/
typedef struct _cairo_uquorem64 {
cairo_uint64_t quo;
cairo_uint64_t rem;
} cairo_uquorem64_t;
typedef struct _cairo_quorem64 {
cairo_int64_t quo;
cairo_int64_t rem;
} cairo_quorem64_t;
cairo_uquorem64_t I
_cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den);
cairo_quorem64_t I
_cairo_int64_divrem (cairo_int64_t num, cairo_int64_t den);
/*
* 128-bit datatypes. Again, provide two implementations in
* case the machine has a native 128-bit datatype. GCC supports int128_t
* on ia64
*/
#if !HAVE_UINT128_T
typedef struct cairo_uint128 {
cairo_uint64_t lo, hi;
} cairo_uint128_t, cairo_int128_t;
cairo_uint128_t I _cairo_uint32_to_uint128 (uint32_t i);
cairo_uint128_t I _cairo_uint64_to_uint128 (cairo_uint64_t i);
#define _cairo_uint128_to_uint64(a) ((a).lo)
#define _cairo_uint128_to_uint32(a) _cairo_uint64_to_uint32(_cairo_uint128_to_uint64(a))
cairo_uint128_t I _cairo_uint128_add (cairo_uint128_t a, cairo_uint128_t b);
cairo_uint128_t I _cairo_uint128_sub (cairo_uint128_t a, cairo_uint128_t b);
cairo_uint128_t I _cairo_uint128_mul (cairo_uint128_t a, cairo_uint128_t b);
cairo_uint128_t I _cairo_uint64x64_128_mul (cairo_uint64_t a, cairo_uint64_t b);
cairo_uint128_t I _cairo_uint128_lsl (cairo_uint128_t a, int shift);
cairo_uint128_t I _cairo_uint128_rsl (cairo_uint128_t a, int shift);
cairo_uint128_t I _cairo_uint128_rsa (cairo_uint128_t a, int shift);
int I _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b);
int I _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b);
cairo_uint128_t I _cairo_uint128_negate (cairo_uint128_t a);
#define _cairo_uint128_negative(a) (_cairo_uint64_negative(a.hi))
cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a);
#define _cairo_uint128_to_int128_(i) (i)
#define _cairo_int128_to_uint128(i) (i)
cairo_int128_t I _cairo_int32_to_int128 (int32_t i);
cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i);
#define _cairo_int128_to_int64(a) ((cairo_int64_t) (a).lo)
#define _cairo_int128_to_int32(a) _cairo_int64_to_int32(_cairo_int128_to_int64(a))
#define _cairo_int128_add(a,b) _cairo_uint128_add(a,b)
#define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b)
#define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b)
cairo_uint128_t I _cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b);
#define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b)
#define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b)
#define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b)
int I _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b);
#define _cairo_int128_eq(a,b) _cairo_uint128_eq (a,b)
#define _cairo_int128_negate(a) _cairo_uint128_negate(a)
#define _cairo_int128_negative(a) (_cairo_uint128_negative(a))
#define _cairo_int128_not(a) _cairo_uint128_not(a)
#else /* !HAVE_UINT128_T */
typedef uint128_t cairo_uint128_t;
typedef int128_t cairo_int128_t;
#define _cairo_uint32_to_uint128(i) ((uint128_t) (i))
#define _cairo_uint64_to_uint128(i) ((uint128_t) (i))
#define _cairo_uint128_to_uint64(i) ((uint64_t) (i))
#define _cairo_uint128_to_uint32(i) ((uint32_t) (i))
#define _cairo_uint128_add(a,b) ((a) + (b))
#define _cairo_uint128_sub(a,b) ((a) - (b))
#define _cairo_uint128_mul(a,b) ((a) * (b))
#define _cairo_uint64x64_128_mul(a,b) ((uint128_t) (a) * (b))
#define _cairo_uint128_lsl(a,b) ((a) << (b))
#define _cairo_uint128_rsl(a,b) ((uint128_t) (a) >> (b))
#define _cairo_uint128_rsa(a,b) ((uint128_t) ((int128_t) (a) >> (b)))
#define _cairo_uint128_lt(a,b) ((a) < (b))
#define _cairo_uint128_eq(a,b) ((a) == (b))
#define _cairo_uint128_negate(a) ((uint128_t) -((int128_t) (a)))
#define _cairo_uint128_negative(a) ((int128_t) (a) < 0)
#define _cairo_uint128_not(a) (~(a))
#define _cairo_uint128_to_int128(i) ((int128_t) (i))
#define _cairo_int128_to_uint128(i) ((uint128_t) (i))
#define _cairo_int32_to_int128(i) ((int128_t) (i))
#define _cairo_int64_to_int128(i) ((int128_t) (i))
#define _cairo_int128_to_int64(i) ((int64_t) (i))
#define _cairo_int128_to_int32(i) ((int32_t) (i))
#define _cairo_int128_add(a,b) ((a) + (b))
#define _cairo_int128_sub(a,b) ((a) - (b))
#define _cairo_int128_mul(a,b) ((a) * (b))
#define _cairo_int64x64_128_mul(a,b) ((int128_t) (a) * (b))
#define _cairo_int128_lt(a,b) ((a) < (b))
#define _cairo_int128_eq(a,b) ((a) == (b))
#define _cairo_int128_lsl(a,b) ((a) << (b))
#define _cairo_int128_rsl(a,b) ((int128_t) ((uint128_t) (a) >> (b)))
#define _cairo_int128_rsa(a,b) ((int128_t) (a) >> (b))
#define _cairo_int128_negate(a) (-(a))
#define _cairo_int128_negative(a) ((a) < 0)
#define _cairo_int128_not(a) (~(a))
#endif /* HAVE_UINT128_T */
typedef struct _cairo_uquorem128 {
cairo_uint128_t quo;
cairo_uint128_t rem;
} cairo_uquorem128_t;
typedef struct _cairo_quorem128 {
cairo_int128_t quo;
cairo_int128_t rem;
} cairo_quorem128_t;
cairo_uquorem128_t I
_cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den);
cairo_quorem128_t I
_cairo_int128_divrem (cairo_int128_t num, cairo_int128_t den);
#define _cairo_uint128_le(a,b) (!_cairo_uint128_gt(a,b))
#define _cairo_uint128_ne(a,b) (!_cairo_uint128_eq(a,b))
#define _cairo_uint128_ge(a,b) (!_cairo_uint128_lt(a,b))
#define _cairo_uint128_gt(a,b) _cairo_uint128_lt(b,a)
#define _cairo_int128_le(a,b) (!_cairo_int128_gt(a,b))
#define _cairo_int128_ne(a,b) (!_cairo_int128_eq(a,b))
#define _cairo_int128_ge(a,b) (!_cairo_int128_lt(a,b))
#define _cairo_int128_gt(a,b) _cairo_int128_lt(b,a)
#undef I
#endif /* CAIRO_WIDEINT_H */

Просмотреть файл

@ -0,0 +1,54 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <cairo.h>
#ifndef CAIRO_XCB_H
#define CAIRO_XCB_H
#ifdef CAIRO_HAS_XCB_SURFACE
#include <X11/XCB/xcb.h>
#include <X11/XCB/render.h>
void
cairo_set_target_xcb (cairo_t *cr,
XCBConnection *dpy,
XCBDRAWABLE drawable,
XCBVISUALTYPE *visual,
cairo_format_t format);
#endif /* CAIRO_HAS_XCB_SURFACE */
#endif /* CAIRO_XCB_H */

Просмотреть файл

@ -0,0 +1,71 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <cairo.h>
#ifndef CAIRO_XLIB_H
#define CAIRO_XLIB_H
#ifdef CAIRO_HAS_XLIB_SURFACE
#include <X11/extensions/Xrender.h>
/* XXX: This shold be renamed to cairo_set_target_xlib to match the
* other backends */
void
cairo_set_target_drawable (cairo_t *cr,
Display *dpy,
Drawable drawable);
/* XXX: This is a mess from the user's POV. Should the Visual or the
cairo_format_t control what render format is used? Maybe I can have
cairo_surface_create_for_window with a visual, and
cairo_surface_create_for_pixmap with a cairo_format_t. Would that work?
*/
cairo_surface_t *
cairo_xlib_surface_create (Display *dpy,
Drawable drawable,
Visual *visual,
cairo_format_t format,
Colormap colormap);
/* XXX: This has been proposed
cairo_status_t
cairo_xlib_surface_set_size (cairo_surface_t *surface, int width, int height);
*/
#endif /* CAIRO_HAS_XLIB_SURFACE */
#endif /* CAIRO_XLIB_H */

1221
gfx/cairo/cairo/src/cairo.c Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

731
gfx/cairo/cairo/src/cairo.h Normal file
Просмотреть файл

@ -0,0 +1,731 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#ifndef CAIRO_H
#define CAIRO_H
#include <cairo-features.h>
#include <pixman.h>
typedef struct _cairo cairo_t;
typedef struct _cairo_surface cairo_surface_t;
typedef struct _cairo_matrix cairo_matrix_t;
typedef struct _cairo_pattern cairo_pattern_t;
#ifdef __cplusplus
extern "C" {
#endif
/* Functions for manipulating state objects */
cairo_t *
cairo_create (void);
void
cairo_reference (cairo_t *cr);
void
cairo_destroy (cairo_t *cr);
void
cairo_save (cairo_t *cr);
void
cairo_restore (cairo_t *cr);
/* XXX: Replace with cairo_current_gstate/cairo_set_gstate */
void
cairo_copy (cairo_t *dest, cairo_t *src);
/* XXX: I want to rethink this API
void
cairo_push_group (cairo_t *cr);
void
cairo_pop_group (cairo_t *cr);
*/
/* Modify state */
void
cairo_set_target_surface (cairo_t *cr, cairo_surface_t *surface);
typedef enum cairo_format {
CAIRO_FORMAT_ARGB32,
CAIRO_FORMAT_RGB24,
CAIRO_FORMAT_A8,
CAIRO_FORMAT_A1
} cairo_format_t;
void
cairo_set_target_image (cairo_t *cr,
char *data,
cairo_format_t format,
int width,
int height,
int stride);
typedef enum cairo_operator {
CAIRO_OPERATOR_CLEAR,
CAIRO_OPERATOR_SRC,
CAIRO_OPERATOR_DST,
CAIRO_OPERATOR_OVER,
CAIRO_OPERATOR_OVER_REVERSE,
CAIRO_OPERATOR_IN,
CAIRO_OPERATOR_IN_REVERSE,
CAIRO_OPERATOR_OUT,
CAIRO_OPERATOR_OUT_REVERSE,
CAIRO_OPERATOR_ATOP,
CAIRO_OPERATOR_ATOP_REVERSE,
CAIRO_OPERATOR_XOR,
CAIRO_OPERATOR_ADD,
CAIRO_OPERATOR_SATURATE
} cairo_operator_t;
void
cairo_set_operator (cairo_t *cr, cairo_operator_t op);
/* XXX: Probably want to bite the bullet and expose a cairo_color_t object */
/* XXX: I've been trying to come up with a sane way to specify:
cairo_set_color (cairo_t *cr, cairo_color_t *color);
Keith wants to be able to support super-luminescent colors,
(premultiplied colors with R/G/B greater than alpha). The current
API does not allow that. Adding a premulitplied RGBA cairo_color_t
would do the trick.
One problem though is that alpha is currently orthogonal to
color. For example, show_surface uses gstate->alpha but ignores the
color. So, it doesn't seem be right to have cairo_set_color modify
the behavior of cairo_show_surface.
*/
void
cairo_set_rgb_color (cairo_t *cr, double red, double green, double blue);
void
cairo_set_pattern (cairo_t *cr, cairo_pattern_t *pattern);
void
cairo_set_alpha (cairo_t *cr, double alpha);
/* XXX: Currently, the tolerance value is specified by the user in
terms of device-space units. If I'm not mistaken, this is the only
value in this API that is not expressed in user-space units. I
should think whether this value should be user-space instead. */
void
cairo_set_tolerance (cairo_t *cr, double tolerance);
typedef enum cairo_fill_rule {
CAIRO_FILL_RULE_WINDING,
CAIRO_FILL_RULE_EVEN_ODD
} cairo_fill_rule_t;
void
cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule);
void
cairo_set_line_width (cairo_t *cr, double width);
typedef enum cairo_line_cap {
CAIRO_LINE_CAP_BUTT,
CAIRO_LINE_CAP_ROUND,
CAIRO_LINE_CAP_SQUARE
} cairo_line_cap_t;
void
cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap);
typedef enum cairo_line_join {
CAIRO_LINE_JOIN_MITER,
CAIRO_LINE_JOIN_ROUND,
CAIRO_LINE_JOIN_BEVEL
} cairo_line_join_t;
void
cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join);
void
cairo_set_dash (cairo_t *cr, double *dashes, int ndash, double offset);
void
cairo_set_miter_limit (cairo_t *cr, double limit);
void
cairo_translate (cairo_t *cr, double tx, double ty);
void
cairo_scale (cairo_t *cr, double sx, double sy);
void
cairo_rotate (cairo_t *cr, double angle);
void
cairo_concat_matrix (cairo_t *cr,
cairo_matrix_t *matrix);
void
cairo_set_matrix (cairo_t *cr,
cairo_matrix_t *matrix);
void
cairo_default_matrix (cairo_t *cr);
/* XXX: There's been a proposal to add cairo_default_matrix_exact */
void
cairo_identity_matrix (cairo_t *cr);
void
cairo_transform_point (cairo_t *cr, double *x, double *y);
void
cairo_transform_distance (cairo_t *cr, double *dx, double *dy);
void
cairo_inverse_transform_point (cairo_t *cr, double *x, double *y);
void
cairo_inverse_transform_distance (cairo_t *cr, double *dx, double *dy);
/* Path creation functions */
void
cairo_new_path (cairo_t *cr);
void
cairo_move_to (cairo_t *cr, double x, double y);
void
cairo_line_to (cairo_t *cr, double x, double y);
void
cairo_curve_to (cairo_t *cr,
double x1, double y1,
double x2, double y2,
double x3, double y3);
void
cairo_arc (cairo_t *cr,
double xc, double yc,
double radius,
double angle1, double angle2);
void
cairo_arc_negative (cairo_t *cr,
double xc, double yc,
double radius,
double angle1, double angle2);
/* XXX: NYI
void
cairo_arc_to (cairo_t *cr,
double x1, double y1,
double x2, double y2,
double radius);
*/
void
cairo_rel_move_to (cairo_t *cr, double dx, double dy);
void
cairo_rel_line_to (cairo_t *cr, double dx, double dy);
void
cairo_rel_curve_to (cairo_t *cr,
double dx1, double dy1,
double dx2, double dy2,
double dx3, double dy3);
void
cairo_rectangle (cairo_t *cr,
double x, double y,
double width, double height);
/* XXX: This is the same name that PostScript uses, but to me the name
suggests an actual drawing operation ala cairo_stroke --- especially
since I want to add a cairo_path_t and with that it would be
natural to have "cairo_stroke_path (cairo_t *, cairo_path_t *)"
Maybe we could use something like "cairo_outline_path (cairo_t *)"?
*/
/* XXX: NYI
void
cairo_stroke_path (cairo_t *cr);
*/
void
cairo_close_path (cairo_t *cr);
/* Painting functions */
void
cairo_stroke (cairo_t *cr);
void
cairo_fill (cairo_t *cr);
void
cairo_copy_page (cairo_t *cr);
void
cairo_show_page (cairo_t *cr);
/* Insideness testing */
int
cairo_in_stroke (cairo_t *cr, double x, double y);
int
cairo_in_fill (cairo_t *cr, double x, double y);
/* Rectangular extents */
void
cairo_stroke_extents (cairo_t *cr,
double *x1, double *y1,
double *x2, double *y2);
void
cairo_fill_extents (cairo_t *cr,
double *x1, double *y1,
double *x2, double *y2);
/* Clipping */
void
cairo_init_clip (cairo_t *cr);
/* Note: cairo_clip does not consume the current path */
void
cairo_clip (cairo_t *cr);
/* Font/Text functions */
typedef struct _cairo_font cairo_font_t;
typedef struct {
unsigned long index;
double x;
double y;
} cairo_glyph_t;
typedef struct {
double x_bearing;
double y_bearing;
double width;
double height;
double x_advance;
double y_advance;
} cairo_text_extents_t;
typedef struct {
double ascent;
double descent;
double height;
double max_x_advance;
double max_y_advance;
} cairo_font_extents_t;
typedef enum cairo_font_slant {
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_SLANT_ITALIC,
CAIRO_FONT_SLANT_OBLIQUE
} cairo_font_slant_t;
typedef enum cairo_font_weight {
CAIRO_FONT_WEIGHT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD
} cairo_font_weight_t;
/* This interface is for dealing with text as text, not caring about the
font object inside the the cairo_t. */
void
cairo_select_font (cairo_t *cr,
const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight);
void
cairo_scale_font (cairo_t *cr, double scale);
void
cairo_transform_font (cairo_t *cr, cairo_matrix_t *matrix);
void
cairo_show_text (cairo_t *cr, const unsigned char *utf8);
void
cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
cairo_font_t *
cairo_current_font (cairo_t *cr);
void
cairo_current_font_extents (cairo_t *cr,
cairo_font_extents_t *extents);
void
cairo_set_font (cairo_t *cr, cairo_font_t *font);
void
cairo_text_extents (cairo_t *cr,
const unsigned char *utf8,
cairo_text_extents_t *extents);
void
cairo_glyph_extents (cairo_t *cr,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents);
void
cairo_text_path (cairo_t *cr, const unsigned char *utf8);
void
cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
/* Portable interface to general font features. */
void
cairo_font_reference (cairo_font_t *font);
void
cairo_font_destroy (cairo_font_t *font);
void
cairo_font_set_transform (cairo_font_t *font,
cairo_matrix_t *matrix);
void
cairo_font_current_transform (cairo_font_t *font,
cairo_matrix_t *matrix);
/* Image functions */
/* XXX: Eliminate width/height here */
void
cairo_show_surface (cairo_t *cr,
cairo_surface_t *surface,
int width,
int height);
/* Query functions */
/* XXX: It would be nice if I could find a simpler way to make the
definitions for the deprecated functions. Ideally, I would just
have to put DEPRECATE (cairo_get_operator, cairo_current_operator)
into one file and be done with it. For now, I've got a little more
typing than that. */
cairo_operator_t
cairo_current_operator (cairo_t *cr);
void
cairo_current_rgb_color (cairo_t *cr, double *red, double *green, double *blue);
cairo_pattern_t *
cairo_current_pattern (cairo_t *cr);
double
cairo_current_alpha (cairo_t *cr);
/* XXX: Do we want cairo_current_pattern as well? */
double
cairo_current_tolerance (cairo_t *cr);
void
cairo_current_point (cairo_t *cr, double *x, double *y);
cairo_fill_rule_t
cairo_current_fill_rule (cairo_t *cr);
double
cairo_current_line_width (cairo_t *cr);
cairo_line_cap_t
cairo_current_line_cap (cairo_t *cr);
cairo_line_join_t
cairo_current_line_join (cairo_t *cr);
double
cairo_current_miter_limit (cairo_t *cr);
/* XXX: How to do cairo_current_dash??? Do we want to switch to a cairo_dash object? */
void
cairo_current_matrix (cairo_t *cr, cairo_matrix_t *matrix);
/* XXX: Need to decide the memory mangement semantics of this
function. Should it reference the surface again? */
cairo_surface_t *
cairo_current_target_surface (cairo_t *cr);
typedef void (cairo_move_to_func_t) (void *closure,
double x, double y);
typedef void (cairo_line_to_func_t) (void *closure,
double x, double y);
typedef void (cairo_curve_to_func_t) (void *closure,
double x1, double y1,
double x2, double y2,
double x3, double y3);
typedef void (cairo_close_path_func_t) (void *closure);
extern void
cairo_current_path (cairo_t *cr,
cairo_move_to_func_t *move_to,
cairo_line_to_func_t *line_to,
cairo_curve_to_func_t *curve_to,
cairo_close_path_func_t *close_path,
void *closure);
extern void
cairo_current_path_flat (cairo_t *cr,
cairo_move_to_func_t *move_to,
cairo_line_to_func_t *line_to,
cairo_close_path_func_t *close_path,
void *closure);
/* Error status queries */
typedef enum cairo_status {
CAIRO_STATUS_SUCCESS = 0,
CAIRO_STATUS_NO_MEMORY,
CAIRO_STATUS_INVALID_RESTORE,
CAIRO_STATUS_INVALID_POP_GROUP,
CAIRO_STATUS_NO_CURRENT_POINT,
CAIRO_STATUS_INVALID_MATRIX,
CAIRO_STATUS_NO_TARGET_SURFACE,
CAIRO_STATUS_NULL_POINTER
} cairo_status_t;
cairo_status_t
cairo_status (cairo_t *cr);
const char *
cairo_status_string (cairo_t *cr);
/* Surface manipulation */
/* XXX: We may want to rename this function in light of the new
virtualized surface backends... */
cairo_surface_t *
cairo_surface_create_for_image (char *data,
cairo_format_t format,
int width,
int height,
int stride);
/* XXX: I want to remove this function, (replace with
cairo_set_target_scratch or similar). */
cairo_surface_t *
cairo_surface_create_similar (cairo_surface_t *other,
cairo_format_t format,
int width,
int height);
void
cairo_surface_reference (cairo_surface_t *surface);
void
cairo_surface_destroy (cairo_surface_t *surface);
/* XXX: Note: The current Render/Ic implementations don't do the right
thing with repeat when the surface has a non-identity matrix. */
/* XXX: Rework this as a cairo function with an enum: cairo_set_pattern_extend */
cairo_status_t
cairo_surface_set_repeat (cairo_surface_t *surface, int repeat);
/* XXX: Rework this as a cairo function: cairo_set_pattern_transform */
cairo_status_t
cairo_surface_set_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix);
/* XXX: Rework this as a cairo function: cairo_current_pattern_transform */
cairo_status_t
cairo_surface_get_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix);
typedef enum {
CAIRO_FILTER_FAST,
CAIRO_FILTER_GOOD,
CAIRO_FILTER_BEST,
CAIRO_FILTER_NEAREST,
CAIRO_FILTER_BILINEAR,
CAIRO_FILTER_GAUSSIAN
} cairo_filter_t;
/* XXX: Rework this as a cairo function: cairo_set_pattern_filter */
cairo_status_t
cairo_surface_set_filter (cairo_surface_t *surface, cairo_filter_t filter);
cairo_filter_t
cairo_surface_get_filter (cairo_surface_t *surface);
/* Image-surface functions */
cairo_surface_t *
cairo_image_surface_create (cairo_format_t format,
int width,
int height);
cairo_surface_t *
cairo_image_surface_create_for_data (char *data,
cairo_format_t format,
int width,
int height,
int stride);
/* Pattern creation functions */
cairo_pattern_t *
cairo_pattern_create_for_surface (cairo_surface_t *surface);
cairo_pattern_t *
cairo_pattern_create_linear (double x0, double y0,
double x1, double y1);
cairo_pattern_t *
cairo_pattern_create_radial (double cx0, double cy0, double radius0,
double cx1, double cy1, double radius1);
void
cairo_pattern_reference (cairo_pattern_t *pattern);
void
cairo_pattern_destroy (cairo_pattern_t *pattern);
cairo_status_t
cairo_pattern_add_color_stop (cairo_pattern_t *pattern,
double offset,
double red, double green, double blue,
double alpha);
cairo_status_t
cairo_pattern_set_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix);
cairo_status_t
cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix);
typedef enum {
CAIRO_EXTEND_NONE,
CAIRO_EXTEND_REPEAT,
CAIRO_EXTEND_REFLECT
} cairo_extend_t;
cairo_status_t
cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
cairo_extend_t
cairo_pattern_get_extend (cairo_pattern_t *pattern);
cairo_status_t
cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
cairo_filter_t
cairo_pattern_get_filter (cairo_pattern_t *pattern);
/* Matrix functions */
/* XXX: Rename all of these to cairo_transform_t */
cairo_matrix_t *
cairo_matrix_create (void);
void
cairo_matrix_destroy (cairo_matrix_t *matrix);
cairo_status_t
cairo_matrix_copy (cairo_matrix_t *matrix, const cairo_matrix_t *other);
cairo_status_t
cairo_matrix_set_identity (cairo_matrix_t *matrix);
cairo_status_t
cairo_matrix_set_affine (cairo_matrix_t *cr,
double a, double b,
double c, double d,
double tx, double ty);
cairo_status_t
cairo_matrix_get_affine (cairo_matrix_t *matrix,
double *a, double *b,
double *c, double *d,
double *tx, double *ty);
cairo_status_t
cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty);
cairo_status_t
cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy);
cairo_status_t
cairo_matrix_rotate (cairo_matrix_t *matrix, double radians);
cairo_status_t
cairo_matrix_invert (cairo_matrix_t *matrix);
cairo_status_t
cairo_matrix_multiply (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b);
cairo_status_t
cairo_matrix_transform_distance (cairo_matrix_t *matrix, double *dx, double *dy);
cairo_status_t
cairo_matrix_transform_point (cairo_matrix_t *matrix, double *x, double *y);
/* Deprecated functions. We've made some effort to allow the
deprecated functions to continue to work for now, (with useful
warnings). But the deprecated functions will not appear in the next
release. */
#ifndef _CAIROINT_H_
#define cairo_get_operator cairo_get_operator_DEPRECATED_BY_cairo_current_operator
#define cairo_get_rgb_color cairo_get_rgb_color_DEPRECATED_BY_cairo_current_rgb_color
#define cairo_get_alpha cairo_get_alpha_DEPRECATED_BY_cairo_current_alpha
#define cairo_get_tolerance cairo_get_tolerance_DEPRECATED_BY_cairo_current_tolerance
#define cairo_get_current_point cairo_get_current_point_DEPRECATED_BY_cairo_current_point
#define cairo_get_fill_rule cairo_get_fill_rule_DEPRECATED_BY_cairo_current_fill_rule
#define cairo_get_line_width cairo_get_line_width_DEPRECATED_BY_cairo_current_line_width
#define cairo_get_line_cap cairo_get_line_cap_DEPRECATED_BY_cairo_current_line_cap
#define cairo_get_line_join cairo_get_line_join_DEPRECATED_BY_cairo_current_line_join
#define cairo_get_miter_limit cairo_get_miter_limit_DEPRECATED_BY_cairo_current_miter_limit
#define cairo_get_matrix cairo_get_matrix_DEPRECATED_BY_cairo_current_matrix
#define cairo_get_target_surface cairo_get_target_surface_DEPRECATED_BY_cairo_current_target_surface
#define cairo_get_status cairo_get_status_DEPRECATED_BY_cairo_status
#define cairo_get_status_string cairo_get_status_string_DEPRECATED_BY_cairo_status_string
#endif
#ifdef __cplusplus
}
#endif
#endif /* CAIRO_H */

Просмотреть файл

Просмотреть файл

@ -0,0 +1,807 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2004 Calum Robinson
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is Calum Robinson
*
* Contributor(s):
* Calum Robinson <calumr@mac.com>
*/
#include <stdlib.h>
#include <math.h>
#include "cairo-atsui.h"
#include "cairoint.h"
#pragma mark Types
typedef struct {
cairo_unscaled_font_t base;
ATSUStyle style;
ATSUFontID fontID;
} cairo_atsui_font_t;
typedef struct cairo_ATSUI_glyph_path_callback_info_t {
cairo_path_t *path;
cairo_matrix_t scale;
} cairo_ATSUI_glyph_path_callback_info_t;
#pragma mark Private Functions
static CGAffineTransform CGAffineTransformMakeWithCairoFontScale(cairo_font_scale_t scale)
{
return CGAffineTransformMake( scale.matrix[0][0], scale.matrix[0][1],
scale.matrix[1][0], scale.matrix[1][1],
0, 0);
}
static ATSUStyle CreateSizedCopyOfStyle(ATSUStyle inStyle, cairo_font_scale_t *scale)
{
ATSUStyle style;
OSStatus err;
// Set the style's size
CGAffineTransform theTransform = CGAffineTransformMakeWithCairoFontScale(*scale);
Fixed theSize = FloatToFixed(CGSizeApplyAffineTransform(CGSizeMake(1.0, 1.0), theTransform).height);
const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag };
const ByteCount theFontStyleSizes[] = { sizeof(Fixed) };
ATSUAttributeValuePtr theFontStyleValues[] = { &theSize };
err = ATSUCreateAndCopyStyle(inStyle, &style);
err = ATSUSetAttributes( style,
sizeof(theFontStyleTags) / sizeof(ATSUAttributeTag),
theFontStyleTags, theFontStyleSizes, theFontStyleValues);
return style;
}
#pragma mark Public Functions
static cairo_unscaled_font_t *
_cairo_atsui_font_create( const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight)
{
cairo_atsui_font_t *font = NULL;
ATSUStyle style;
ATSUFontID fontID;
OSStatus err;
Boolean isItalic, isBold;
err = ATSUCreateStyle(&style);
switch (weight)
{
case CAIRO_FONT_WEIGHT_BOLD:
isBold = true;
break;
case CAIRO_FONT_WEIGHT_NORMAL:
default:
isBold = false;
break;
}
switch (slant)
{
case CAIRO_FONT_SLANT_ITALIC:
isItalic = true;
break;
case CAIRO_FONT_SLANT_OBLIQUE:
isItalic = false;
break;
case CAIRO_FONT_SLANT_NORMAL:
default:
isItalic = false;
break;
}
err = ATSUFindFontFromName( family, strlen(family),
kFontFamilyName,
kFontNoPlatformCode,
kFontRomanScript,
kFontNoLanguageCode,
&fontID);
ATSUAttributeTag styleTags[] = {kATSUQDItalicTag, kATSUQDBoldfaceTag, kATSUFontTag};
ATSUAttributeValuePtr styleValues[] = {&isItalic, &isBold, &fontID};
ByteCount styleSizes[] = {sizeof(Boolean), sizeof(Boolean), sizeof(ATSUFontID)};
err = ATSUSetAttributes( style,
sizeof(styleTags) / sizeof(styleTags[0]),
styleTags,
styleSizes,
styleValues);
font = malloc(sizeof(cairo_atsui_font_t));
if (_cairo_unscaled_font_init(&font->base, &cairo_atsui_font_backend) == CAIRO_STATUS_SUCCESS)
{
font->style = style;
font->fontID = fontID;
return &font->base;
}
free(font);
return NULL;
}
static void
_cairo_atsui_font_destroy(void *abstract_font)
{
cairo_atsui_font_t *font = abstract_font;
if (font == NULL)
return;
if (font->style)
ATSUDisposeStyle(font->style);
free(font);
}
static cairo_status_t
_cairo_atsui_font_text_to_glyphs( void *abstract_font,
cairo_font_scale_t *sc,
const unsigned char *utf8,
cairo_glyph_t **glyphs,
int *nglyphs)
{
cairo_atsui_font_t *font = abstract_font;
size_t i;
OSStatus err;
ATSUTextLayout textLayout;
ATSLayoutRecord *layoutRecords;
ItemCount glyphCount, charCount;
UniChar *theText;
ATSUStyle style;
charCount = strlen(utf8);
err = ATSUCreateTextLayout(&textLayout);
// Set the text in the text layout object, so we can measure it
theText = (UniChar *)malloc(charCount * sizeof(UniChar));
for (i = 0; i < charCount; i++)
{
theText[i] = utf8[i];
}
err = ATSUSetTextPointerLocation( textLayout,
theText,
0,
charCount,
charCount);
style = CreateSizedCopyOfStyle(font->style, sc);
// Set the style for all of the text
err = ATSUSetRunStyle( textLayout,
style,
kATSUFromTextBeginning,
kATSUToTextEnd);
// Get the glyphs from the text layout object
err = ATSUDirectGetLayoutDataArrayPtrFromTextLayout( textLayout,
0,
kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
(void *)&layoutRecords,
&glyphCount);
*nglyphs = glyphCount;
*glyphs = (cairo_glyph_t *)malloc(glyphCount * (sizeof(cairo_glyph_t)));
if (*glyphs == NULL)
{
return CAIRO_STATUS_NO_MEMORY;
}
for (i = 0; i < glyphCount; i++)
{
(*glyphs)[i].index = layoutRecords[i].glyphID;
(*glyphs)[i].x = FixedToFloat(layoutRecords[i].realPos);
(*glyphs)[i].y = 0;
}
free(theText);
ATSUDirectReleaseLayoutDataArrayPtr( NULL,
kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
(void *)&layoutRecords);
ATSUDisposeTextLayout(textLayout);
ATSUDisposeStyle(style);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_atsui_font_font_extents( void *abstract_font,
cairo_font_scale_t *sc,
cairo_font_extents_t *extents)
{
cairo_atsui_font_t *font = abstract_font;
ATSFontRef atsFont;
ATSFontMetrics metrics;
OSStatus err;
// TODO - test this
atsFont = FMGetATSFontRefFromFont(font->fontID);
if (atsFont)
{
err = ATSFontGetHorizontalMetrics(atsFont, kATSOptionFlagsDefault, &metrics);
if (err == noErr)
{
extents->ascent = metrics.ascent;
extents->descent = metrics.descent;
extents->height = metrics.capHeight;
extents->max_x_advance = metrics.maxAdvanceWidth;
// The FT backend doesn't handle max_y_advance either, so we'll ignore it for now.
extents->max_y_advance = 0.0;
return CAIRO_STATUS_SUCCESS;
}
}
return CAIRO_STATUS_NULL_POINTER;
}
static cairo_status_t
_cairo_atsui_font_glyph_extents( void *abstract_font,
cairo_font_scale_t *sc,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents)
{
cairo_atsui_font_t *font = abstract_font;
cairo_point_double_t origin;
cairo_point_double_t glyph_min, glyph_max;
cairo_point_double_t total_min, total_max;
OSStatus err;
ATSUStyle style;
int i;
if (num_glyphs == 0)
{
extents->x_bearing = 0.0;
extents->y_bearing = 0.0;
extents->width = 0.0;
extents->height = 0.0;
extents->x_advance = 0.0;
extents->y_advance = 0.0;
return CAIRO_STATUS_SUCCESS;
}
origin.x = glyphs[0].x;
origin.y = glyphs[0].y;
style = CreateSizedCopyOfStyle(font->style, sc);
for (i = 0; i < num_glyphs; i++)
{
GlyphID theGlyph = glyphs[i].index;
double minX, maxX, ascent, descent;
ATSGlyphIdealMetrics metricsH, metricsV;
err = ATSUGlyphGetIdealMetrics( style,
1,
&theGlyph,
0,
&metricsH);
ATSUVerticalCharacterType verticalType = kATSUStronglyVertical;
ATSUAttributeTag theTag = kATSUVerticalCharacterTag;
ByteCount theSize = sizeof(ATSUVerticalCharacterType);
err = ATSUSetAttributes(style, 1, &theTag, &theSize, (ATSUAttributeValuePtr)&verticalType);
err = ATSUGlyphGetIdealMetrics( style,
1,
&theGlyph,
0,
&metricsV);
minX = metricsH.otherSideBearing.x;
maxX = metricsH.advance.x;
ascent = metricsV.advance.x;
descent = metricsV.otherSideBearing.x;
glyph_min.x = glyphs[i].x + minX;
glyph_min.y = glyphs[i].y + descent;
glyph_max.x = glyphs[i].x + maxX;
glyph_max.y = glyphs[i].y + ascent;
if (i==0)
{
total_min = glyph_min;
total_max = glyph_max;
}
else
{
if (glyph_min.x < total_min.x)
total_min.x = glyph_min.x;
if (glyph_min.y < total_min.y)
total_min.y = glyph_min.y;
if (glyph_max.x > total_max.x)
total_max.x = glyph_max.x;
if (glyph_max.y > total_max.y)
total_max.y = glyph_max.y;
}
}
extents->x_bearing = total_min.x - origin.x;
extents->y_bearing = total_min.y - origin.y;
extents->width = total_max.x - total_min.x;
extents->height = total_max.y - total_min.y;
extents->x_advance = glyphs[i-1].x - origin.x;
extents->y_advance = glyphs[i-1].y - origin.y;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_atsui_font_glyph_bbox( void *abstract_font,
cairo_font_scale_t *sc,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_box_t *bbox)
{
cairo_atsui_font_t *font = abstract_font;
cairo_fixed_t x1, y1, x2, y2;
int i;
OSStatus err;
ATSUStyle style;
bbox->p1.x = bbox->p1.y = CAIRO_MAXSHORT << 16;
bbox->p2.x = bbox->p2.y = CAIRO_MINSHORT << 16;
style = CreateSizedCopyOfStyle(font->style, sc);
for (i = 0; i < num_glyphs; i++)
{
GlyphID theGlyph = glyphs[i].index;
ATSGlyphIdealMetrics metrics;
err = ATSUGlyphGetIdealMetrics( style,
1,
&theGlyph,
0,
&metrics);
x1 = _cairo_fixed_from_double(glyphs[i].x);
y1 = _cairo_fixed_from_double(glyphs[i].y);
x2 = x1 + _cairo_fixed_from_double(metrics.advance.x);
y2 = y1 + _cairo_fixed_from_double(metrics.advance.y);
if (x1 < bbox->p1.x)
bbox->p1.x = x1;
if (y1 < bbox->p1.y)
bbox->p1.y = y1;
if (x2 > bbox->p2.x)
bbox->p2.x = x2;
if (y2 > bbox->p2.y)
bbox->p2.y = y2;
}
ATSUDisposeStyle(style);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_atsui_font_show_glyphs( void *abstract_font,
cairo_font_scale_t *sc,
cairo_operator_t operator,
cairo_surface_t *source,
cairo_surface_t *surface,
int source_x,
int source_y,
const cairo_glyph_t *glyphs,
int num_glyphs)
{
cairo_atsui_font_t *font = abstract_font;
CGContextRef myBitmapContext;
CGColorSpaceRef colorSpace;
cairo_image_surface_t *destImageSurface;
int i;
destImageSurface = _cairo_surface_get_image(surface);
// Create a CGBitmapContext for the dest surface for drawing into
colorSpace = CGColorSpaceCreateDeviceRGB();
myBitmapContext = CGBitmapContextCreate( destImageSurface->data,
destImageSurface->width,
destImageSurface->height,
destImageSurface->depth / 4,
destImageSurface->stride,
colorSpace,
kCGImageAlphaPremultipliedFirst);
ATSFontRef atsFont = FMGetATSFontRefFromFont(font->fontID);
CGFontRef cgFont = CGFontCreateWithPlatformFont(&atsFont);
CGContextSetFont(myBitmapContext, cgFont);
CGAffineTransform textTransform = CGAffineTransformMakeWithCairoFontScale(*sc);
CGSize textSize = CGSizeMake(1.0, 1.0);
textSize = CGSizeApplyAffineTransform(textSize, textTransform);
CGContextSetFontSize(myBitmapContext, textSize.width);
// TODO - bold and italic text
//
// We could draw the text using ATSUI and get bold, italics
// etc. for free, but ATSUI does a lot of text layout work
// that we don't really need...
for (i = 0; i < num_glyphs; i++)
{
CGGlyph theGlyph = glyphs[i].index;
CGContextShowGlyphsAtPoint(myBitmapContext, source_x + glyphs[i].x, destImageSurface->height - (source_y + glyphs[i].y), &theGlyph, 1);
}
CGColorSpaceRelease(colorSpace);
CGContextRelease(myBitmapContext);
return CAIRO_STATUS_SUCCESS;
}
#pragma mark -
static OSStatus MyATSCubicMoveToCallback(const Float32Point *pt, void *callBackDataPtr)
{
cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
double scaledPt[2];
cairo_point_t point;
scaledPt[0] = pt->x;
scaledPt[1] = pt->y;
cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
point.x = _cairo_fixed_from_double(scaledPt[0]);
point.y = _cairo_fixed_from_double(scaledPt[1]);
_cairo_path_move_to(info->path, &point);
return noErr;
}
static OSStatus MyATSCubicLineToCallback(const Float32Point *pt, void *callBackDataPtr)
{
cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
cairo_point_t point;
double scaledPt[2];
scaledPt[0] = pt->x;
scaledPt[1] = pt->y;
cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
point.x = _cairo_fixed_from_double(scaledPt[0]);
point.y = _cairo_fixed_from_double(scaledPt[1]);
_cairo_path_line_to(info->path, &point);
return noErr;
}
static OSStatus MyATSCubicCurveToCallback( const Float32Point *pt1,
const Float32Point *pt2,
const Float32Point *pt3,
void *callBackDataPtr)
{
cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
cairo_point_t p0, p1, p2;
double scaledPt[2];
scaledPt[0] = pt1->x;
scaledPt[1] = pt1->y;
cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
p0.x = _cairo_fixed_from_double(scaledPt[0]);
p0.y = _cairo_fixed_from_double(scaledPt[1]);
scaledPt[0] = pt2->x;
scaledPt[1] = pt2->y;
cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
p1.x = _cairo_fixed_from_double(scaledPt[0]);
p1.y = _cairo_fixed_from_double(scaledPt[1]);
scaledPt[0] = pt3->x;
scaledPt[1] = pt3->y;
cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
p2.x = _cairo_fixed_from_double(scaledPt[0]);
p2.y = _cairo_fixed_from_double(scaledPt[1]);
_cairo_path_curve_to(info->path, &p0, &p1, &p2);
return noErr;
}
static OSStatus MyCubicClosePathProc(void * callBackDataPtr)
{
cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
_cairo_path_close_path(info->path);
return noErr;
}
static cairo_status_t
_cairo_atsui_font_glyph_path( void *abstract_font,
cairo_font_scale_t *sc,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_path_t *path)
{
int i;
cairo_atsui_font_t *font = abstract_font;
OSStatus err;
cairo_ATSUI_glyph_path_callback_info_t info;
ATSUStyle style;
static ATSCubicMoveToUPP moveProc = NULL;
static ATSCubicLineToUPP lineProc = NULL;
static ATSCubicCurveToUPP curveProc = NULL;
static ATSCubicClosePathUPP closePathProc = NULL;
if (moveProc == NULL)
{
moveProc = NewATSCubicMoveToUPP(MyATSCubicMoveToCallback);
lineProc = NewATSCubicLineToUPP(MyATSCubicLineToCallback);
curveProc = NewATSCubicCurveToUPP(MyATSCubicCurveToCallback);
closePathProc = NewATSCubicClosePathUPP(MyCubicClosePathProc);
}
info.path = path;
style = CreateSizedCopyOfStyle(font->style, sc);
for (i = 0; i < num_glyphs; i++)
{
GlyphID theGlyph = glyphs[i].index;
cairo_matrix_set_affine( &info.scale,
1.0, 0.0,
0.0, 1.0,
glyphs[i].x, glyphs[i].y);
err = ATSUGlyphGetCubicPaths( style,
theGlyph,
moveProc,
lineProc,
curveProc,
closePathProc,
(void *)&info,
&err);
}
err = ATSUDisposeStyle(style);
return CAIRO_STATUS_SUCCESS;
}
#pragma mark -
static cairo_status_t
_cairo_atsui_font_create_glyph(cairo_image_glyph_cache_entry_t *val)
{
// TODO
printf("_cairo_atsui_font_create_glyph is unimplemented\n");
// I'm not sure if we need this, given that the ATSUI backend does no caching(?)
return CAIRO_STATUS_SUCCESS;
}
cairo_font_t *
cairo_atsui_font_create(ATSUStyle style)
{
cairo_font_scale_t scale;
cairo_font_t *scaled;
cairo_atsui_font_t *f = NULL;
scaled = malloc(sizeof(cairo_font_t));
if (scaled == NULL)
return NULL;
f = malloc(sizeof(cairo_atsui_font_t));
if (f)
{
if (_cairo_unscaled_font_init(&f->base, &cairo_atsui_font_backend) == CAIRO_STATUS_SUCCESS)
{
f->style = style;
_cairo_font_init(scaled, &scale, &f->base);
return scaled;
}
}
free(scaled);
return NULL;
}
#pragma mark Backend
const cairo_font_backend_t cairo_atsui_font_backend = {
_cairo_atsui_font_create,
_cairo_atsui_font_destroy,
_cairo_atsui_font_font_extents,
_cairo_atsui_font_text_to_glyphs,
_cairo_atsui_font_glyph_extents,
_cairo_atsui_font_glyph_bbox,
_cairo_atsui_font_show_glyphs,
_cairo_atsui_font_glyph_path,
_cairo_atsui_font_create_glyph
};

Просмотреть файл

@ -0,0 +1,454 @@
/* cairo - a vector graphics library with display and print output
*
* This file is Copyright © 2004 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is Red Hat, Inc.
*
* Contributor(s):
* Keith Packard
* Graydon Hoare <graydon@redhat.com>
*/
#include "cairoint.h"
/*
* This structure, and accompanying table, is borrowed/modified from the
* file xserver/render/glyph.c in the freedesktop.org x server, with
* permission (and suggested modification of doubling sizes) by Keith
* Packard.
*/
static const cairo_cache_arrangement_t cache_arrangements [] = {
{ 16, 43, 41 },
{ 32, 73, 71 },
{ 64, 151, 149 },
{ 128, 283, 281 },
{ 256, 571, 569 },
{ 512, 1153, 1151 },
{ 1024, 2269, 2267 },
{ 2048, 4519, 4517 },
{ 4096, 9013, 9011 },
{ 8192, 18043, 18041 },
{ 16384, 36109, 36107 },
{ 32768, 72091, 72089 },
{ 65536, 144409, 144407 },
{ 131072, 288361, 288359 },
{ 262144, 576883, 576881 },
{ 524288, 1153459, 1153457 },
{ 1048576, 2307163, 2307161 },
{ 2097152, 4613893, 4613891 },
{ 4194304, 9227641, 9227639 },
{ 8388608, 18455029, 18455027 },
{ 16777216, 36911011, 36911009 },
{ 33554432, 73819861, 73819859 },
{ 67108864, 147639589, 147639587 },
{ 134217728, 295279081, 295279079 },
{ 268435456, 590559793, 590559791 }
};
#define N_CACHE_SIZES (sizeof(cache_arrangements)/sizeof(cache_arrangements[0]))
/*
* Entries 'e' are poiners, in one of 3 states:
*
* e == NULL: The entry has never had anything put in it
* e != DEAD_ENTRY: The entry has an active value in it currently
* e == DEAD_ENTRY: The entry *had* a value in it at some point, but the
* entry has been killed. Lookups requesting free space can
* reuse these entries; lookups requesting a precise match
* should neither return these entries nor stop searching when
* seeing these entries.
*
* We expect keys will not be destroyed frequently, so our table does not
* contain any explicit shrinking code nor any chain-coalescing code for
* entries randomly deleted by memory pressure (except during rehashing, of
* course). These assumptions are potentially bad, but they make the
* implementation straightforward.
*
* Revisit later if evidence appears that we're using excessive memory from
* a mostly-dead table.
*
* Generally you do not need to worry about freeing cache entries; the
* cache will expire entries randomly as it experiences memory pressure.
* There is currently no explicit entry-removing call, though one can be
* added easily.
*
* This table is open-addressed with double hashing. Each table size is a
* prime chosen to be a little more than double the high water mark for a
* given arrangement, so the tables should remain < 50% full. The table
* size makes for the "first" hash modulus; a second prime (2 less than the
* first prime) serves as the "second" hash modulus, which is co-prime and
* thus guarantees a complete permutation of table indices.
*
*/
#define DEAD_ENTRY ((cairo_cache_entry_base_t *) 1)
#define NULL_ENTRY_P(cache, i) ((cache)->entries[i] == NULL)
#define DEAD_ENTRY_P(cache, i) ((cache)->entries[i] == DEAD_ENTRY)
#define LIVE_ENTRY_P(cache, i) \
(!((NULL_ENTRY_P((cache),(i))) || (DEAD_ENTRY_P((cache),(i)))))
#ifdef CAIRO_DO_SANITY_CHECKING
static void
_cache_sane_state (cairo_cache_t *cache)
{
assert (cache != NULL);
assert (cache->entries != NULL);
assert (cache->backend != NULL);
assert (cache->arrangement != NULL);
/* Cannot check this, a single object may larger */
/* assert (cache->used_memory <= cache->max_memory); */
assert (cache->live_entries <= cache->arrangement->size);
}
#else
#define _cache_sane_state(c)
#endif
static void
_entry_destroy (cairo_cache_t *cache, unsigned long i)
{
_cache_sane_state (cache);
if (LIVE_ENTRY_P(cache, i))
{
cairo_cache_entry_base_t *entry = cache->entries[i];
assert(cache->live_entries > 0);
assert(cache->used_memory >= entry->memory);
cache->live_entries--;
cache->used_memory -= entry->memory;
cache->backend->destroy_entry (cache, entry);
cache->entries[i] = DEAD_ENTRY;
}
}
static cairo_cache_entry_base_t **
_cache_lookup (cairo_cache_t *cache,
void *key,
int (*predicate)(void*,void*,void*))
{
cairo_cache_entry_base_t **probe;
unsigned long hash;
unsigned long table_size, i, idx, step;
_cache_sane_state (cache);
assert (key != NULL);
table_size = cache->arrangement->size;
hash = cache->backend->hash (cache, key);
idx = hash % table_size;
step = 0;
for (i = 0; i < table_size; ++i)
{
#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE
cache->probes++;
#endif
assert(idx < table_size);
probe = cache->entries + idx;
/*
* There are two lookup modes: searching for a free slot and searching
* for an exact entry.
*/
if (predicate != NULL)
{
/* We are looking up an exact entry. */
if (*probe == NULL)
/* Found an empty spot, there can't be a match */
break;
else if (*probe != DEAD_ENTRY
&& (*probe)->hashcode == hash
&& predicate (cache, key, *probe))
return probe;
}
else
{
/* We are just looking for a free slot. */
if (*probe == NULL
|| *probe == DEAD_ENTRY)
return probe;
}
if (step == 0) {
step = hash % cache->arrangement->rehash;
if (step == 0)
step = 1;
}
idx += step;
if (idx >= table_size)
idx -= table_size;
}
/*
* The table should not have permitted you to get here if you were just
* looking for a free slot: there should have been room.
*/
assert(predicate != NULL);
return NULL;
}
static cairo_cache_entry_base_t **
_find_available_entry_for (cairo_cache_t *cache,
void *key)
{
return _cache_lookup (cache, key, NULL);
}
static cairo_cache_entry_base_t **
_find_exact_live_entry_for (cairo_cache_t *cache,
void *key)
{
return _cache_lookup (cache, key, cache->backend->keys_equal);
}
static const cairo_cache_arrangement_t *
_find_cache_arrangement (unsigned long proposed_size)
{
unsigned long idx;
for (idx = 0; idx < N_CACHE_SIZES; ++idx)
if (cache_arrangements[idx].high_water_mark >= proposed_size)
return &cache_arrangements[idx];
return NULL;
}
static cairo_status_t
_resize_cache (cairo_cache_t *cache, unsigned long proposed_size)
{
cairo_cache_t tmp;
cairo_cache_entry_base_t **e;
unsigned long new_size, i;
tmp = *cache;
tmp.arrangement = _find_cache_arrangement (proposed_size);
assert(tmp.arrangement != NULL);
if (tmp.arrangement == cache->arrangement)
return CAIRO_STATUS_SUCCESS;
new_size = tmp.arrangement->size;
tmp.entries = calloc (new_size, sizeof (cairo_cache_entry_base_t *));
if (tmp.entries == NULL)
return CAIRO_STATUS_NO_MEMORY;
for (i = 0; i < cache->arrangement->size; ++i) {
if (LIVE_ENTRY_P(cache, i)) {
e = _find_available_entry_for (&tmp, cache->entries[i]);
assert (e != NULL);
*e = cache->entries[i];
}
}
free (cache->entries);
cache->entries = tmp.entries;
cache->arrangement = tmp.arrangement;
return CAIRO_STATUS_SUCCESS;
}
#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE
static double
_load_factor (cairo_cache_t *cache)
{
return ((double) cache->live_entries)
/ ((double) cache->arrangement->size);
}
#endif
static unsigned long
_random_live_entry (cairo_cache_t *cache)
{
unsigned long idx;
assert(cache != NULL);
do {
idx = rand () % cache->arrangement->size;
} while (! LIVE_ENTRY_P(cache, idx));
return idx;
}
/* public API follows */
cairo_status_t
_cairo_cache_init (cairo_cache_t *cache,
const cairo_cache_backend_t *backend,
unsigned long max_memory)
{
assert (backend != NULL);
if (cache != NULL){
cache->arrangement = &cache_arrangements[0];
cache->refcount = 1;
cache->max_memory = max_memory;
cache->used_memory = 0;
cache->live_entries = 0;
#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE
cache->hits = 0;
cache->misses = 0;
cache->probes = 0;
#endif
cache->backend = backend;
cache->entries = calloc (sizeof(cairo_cache_entry_base_t *),
cache->arrangement->size);
if (cache->entries == NULL)
return CAIRO_STATUS_NO_MEMORY;
}
_cache_sane_state (cache);
return CAIRO_STATUS_SUCCESS;
}
void
_cairo_cache_reference (cairo_cache_t *cache)
{
_cache_sane_state (cache);
cache->refcount++;
}
void
_cairo_cache_destroy (cairo_cache_t *cache)
{
unsigned long i;
if (cache != NULL) {
_cache_sane_state (cache);
if (--cache->refcount > 0)
return;
for (i = 0; i < cache->arrangement->size; ++i) {
_entry_destroy (cache, i);
}
free (cache->entries);
cache->entries = NULL;
cache->backend->destroy_cache (cache);
}
}
cairo_status_t
_cairo_cache_lookup (cairo_cache_t *cache,
void *key,
void **entry_return)
{
unsigned long idx;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_cache_entry_base_t **slot = NULL, *new_entry;
_cache_sane_state (cache);
#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE
if ((cache->hits + cache->misses) % 0xffff == 0)
printf("cache %p stats: size %ld, live %ld, load %.2f\n"
" mem %ld/%ld, hit %ld, miss %ld\n"
" probe %ld, %.2f probe/access\n",
cache,
cache->arrangement->size,
cache->live_entries,
_load_factor (cache),
cache->used_memory,
cache->max_memory,
cache->hits,
cache->misses,
cache->probes,
((double) cache->probes)
/ ((double) (cache->hits +
cache->misses + 1)));
#endif
/* See if we have an entry in the table already. */
slot = _find_exact_live_entry_for (cache, key);
if (slot != NULL) {
#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE
cache->hits++;
#endif
*entry_return = *slot;
return status;
}
#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE
cache->misses++;
#endif
/* Build the new entry. */
status = cache->backend->create_entry (cache, key,
entry_return);
if (status != CAIRO_STATUS_SUCCESS)
return status;
new_entry = (cairo_cache_entry_base_t *) (*entry_return);
/* Store the hash value in case the backend forgot. */
new_entry->hashcode = cache->backend->hash (cache, key);
/* Make some entries die if we're under memory pressure. */
while (cache->live_entries > 0 &&
((cache->max_memory - cache->used_memory) < new_entry->memory)) {
idx = _random_live_entry (cache);
assert (idx < cache->arrangement->size);
_entry_destroy (cache, idx);
}
/* Can't assert this; new_entry->memory may be larger than max_memory */
/* assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); */
/* Make room in the table for a new slot. */
status = _resize_cache (cache, cache->live_entries + 1);
if (status != CAIRO_STATUS_SUCCESS) {
cache->backend->destroy_entry (cache, new_entry);
*entry_return = NULL;
return status;
}
slot = _find_available_entry_for (cache, key);
assert(slot != NULL);
/* Store entry in slot and increment statistics. */
*slot = new_entry;
cache->live_entries++;
cache->used_memory += new_entry->memory;
_cache_sane_state (cache);
return status;
}
unsigned long
_cairo_hash_string (const char *c)
{
/* This is the djb2 hash. */
unsigned long hash = 5381;
while (*c)
hash = ((hash << 5) + hash) + *c++;
return hash;
}

Просмотреть файл

@ -0,0 +1,96 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
static cairo_color_t const CAIRO_COLOR_WHITE = {
1.0, 1.0, 1.0, 1.0,
0xffff, 0xffff, 0xffff, 0xffff
};
static void
_cairo_color_compute_shorts (cairo_color_t *color);
void
_cairo_color_init (cairo_color_t *color)
{
*color = CAIRO_COLOR_WHITE;
}
void
_cairo_color_fini (cairo_color_t *color)
{
/* Nothing to do here */
}
void
_cairo_color_set_rgb (cairo_color_t *color, double red, double green, double blue)
{
color->red = red;
color->green = green;
color->blue = blue;
_cairo_color_compute_shorts (color);
}
void
_cairo_color_get_rgb (cairo_color_t *color, double *red, double *green, double *blue)
{
if (red)
*red = color->red;
if (green)
*green = color->green;
if (blue)
*blue = color->blue;
}
void
_cairo_color_set_alpha (cairo_color_t *color, double alpha)
{
color->alpha = alpha;
_cairo_color_compute_shorts (color);
}
static void
_cairo_color_compute_shorts (cairo_color_t *color)
{
color->red_short = (color->red * color->alpha) * 0xffff;
color->green_short = (color->green * color->alpha) * 0xffff;
color->blue_short = (color->blue * color->alpha) * 0xffff;
color->alpha_short = color->alpha * 0xffff;
}

Просмотреть файл

@ -0,0 +1,91 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2003 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
cairo_fixed_t
_cairo_fixed_from_int (int i)
{
return i << 16;
}
cairo_fixed_t
_cairo_fixed_from_double (double d)
{
return (cairo_fixed_t) (d * 65536);
}
cairo_fixed_t
_cairo_fixed_from_26_6 (uint32_t i)
{
return i << 10;
}
double
_cairo_fixed_to_double (cairo_fixed_t f)
{
return ((double) f) / 65536.0;
}
int
_cairo_fixed_is_integer (cairo_fixed_t f)
{
return (f & 0xFFFF) == 0;
}
int
_cairo_fixed_integer_part (cairo_fixed_t f)
{
return f >> 16;
}
int
_cairo_fixed_integer_floor (cairo_fixed_t f)
{
if (f >= 0)
return f >> 16;
else
return -((-f - 1) >> 16) - 1;
}
int
_cairo_fixed_integer_ceil (cairo_fixed_t f)
{
if (f >= 0)
return ((f - 1)>>16) + 1;
else
return - (-f >> 16);
}

Просмотреть файл

@ -0,0 +1,521 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
/* First we implement a global font cache for named fonts. */
typedef struct {
cairo_cache_entry_base_t base;
const char *family;
cairo_font_slant_t slant;
cairo_font_weight_t weight;
} cairo_font_cache_key_t;
typedef struct {
cairo_font_cache_key_t key;
cairo_unscaled_font_t *unscaled;
} cairo_font_cache_entry_t;
static unsigned long
_font_cache_hash (void *cache, void *key)
{
unsigned long hash;
cairo_font_cache_key_t *in;
in = (cairo_font_cache_key_t *) key;
/* 1607 and 1451 are just a couple random primes. */
hash = _cairo_hash_string (in->family);
hash += ((unsigned long) in->slant) * 1607;
hash += ((unsigned long) in->weight) * 1451;
return hash;
}
static int
_font_cache_keys_equal (void *cache,
void *k1,
void *k2)
{
cairo_font_cache_key_t *a, *b;
a = (cairo_font_cache_key_t *) k1;
b = (cairo_font_cache_key_t *) k2;
return (strcmp (a->family, b->family) == 0)
&& (a->weight == b->weight)
&& (a->slant == b->slant);
}
static cairo_status_t
_font_cache_create_entry (void *cache,
void *key,
void **return_value)
{
const cairo_font_backend_t *backend = CAIRO_FONT_BACKEND_DEFAULT;
cairo_font_cache_key_t *k;
cairo_font_cache_entry_t *entry;
k = (cairo_font_cache_key_t *) key;
/* XXX: The current freetype backend may return NULL, (for example
* if no fonts are installed), but I would like to guarantee that
* the toy API always returns at least *some* font, so I would
* like to build in some sort fo font here, (even a really lame,
* ugly one if necessary). */
entry = malloc (sizeof (cairo_font_cache_entry_t));
if (entry == NULL)
goto FAIL;
entry->key.slant = k->slant;
entry->key.weight = k->weight;
entry->key.family = strdup(k->family);
if (entry->key.family == NULL)
goto FREE_ENTRY;
entry->unscaled = backend->create (k->family, k->slant, k->weight);
if (entry->unscaled == NULL)
goto FREE_FAMILY;
/* Not sure how to measure backend font mem; use a simple count for now.*/
entry->key.base.memory = 1;
*return_value = entry;
return CAIRO_STATUS_SUCCESS;
FREE_FAMILY:
free ((void *) entry->key.family);
FREE_ENTRY:
free (entry);
FAIL:
return CAIRO_STATUS_NO_MEMORY;
}
static void
_font_cache_destroy_entry (void *cache,
void *entry)
{
cairo_font_cache_entry_t *e;
e = (cairo_font_cache_entry_t *) entry;
_cairo_unscaled_font_destroy (e->unscaled);
free ((void *) e->key.family);
free (e);
}
static void
_font_cache_destroy_cache (void *cache)
{
free (cache);
}
static const cairo_cache_backend_t cairo_font_cache_backend = {
_font_cache_hash,
_font_cache_keys_equal,
_font_cache_create_entry,
_font_cache_destroy_entry,
_font_cache_destroy_cache
};
static void
_lock_global_font_cache (void)
{
/* FIXME: implement locking. */
}
static void
_unlock_global_font_cache (void)
{
/* FIXME: implement locking. */
}
static cairo_cache_t *
_global_font_cache = NULL;
static cairo_cache_t *
_get_global_font_cache (void)
{
if (_global_font_cache == NULL) {
_global_font_cache = malloc (sizeof (cairo_cache_t));
if (_global_font_cache == NULL)
goto FAIL;
if (_cairo_cache_init (_global_font_cache,
&cairo_font_cache_backend,
CAIRO_FONT_CACHE_NUM_FONTS_DEFAULT))
goto FAIL;
}
return _global_font_cache;
FAIL:
if (_global_font_cache)
free (_global_font_cache);
_global_font_cache = NULL;
return NULL;
}
/* Now the internal "unscaled + scale" font API */
cairo_unscaled_font_t *
_cairo_unscaled_font_create (const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight)
{
cairo_cache_t * cache;
cairo_font_cache_key_t key;
cairo_font_cache_entry_t *font;
cairo_status_t status;
_lock_global_font_cache ();
cache = _get_global_font_cache ();
if (cache == NULL) {
_unlock_global_font_cache ();
return NULL;
}
key.family = family;
key.slant = slant;
key.weight = weight;
status = _cairo_cache_lookup (cache, &key, (void **) &font);
if (status) {
_unlock_global_font_cache ();
return NULL;
}
_cairo_unscaled_font_reference (font->unscaled);
_unlock_global_font_cache ();
return font->unscaled;
}
void
_cairo_font_init (cairo_font_t *scaled,
cairo_font_scale_t *scale,
cairo_unscaled_font_t *unscaled)
{
scaled->scale = *scale;
scaled->unscaled = unscaled;
scaled->refcount = 1;
}
cairo_status_t
_cairo_unscaled_font_init (cairo_unscaled_font_t *font,
const cairo_font_backend_t *backend)
{
font->refcount = 1;
font->backend = backend;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_unscaled_font_text_to_glyphs (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
const unsigned char *utf8,
cairo_glyph_t **glyphs,
int *num_glyphs)
{
return font->backend->text_to_glyphs (font, scale, utf8, glyphs, num_glyphs);
}
cairo_status_t
_cairo_unscaled_font_glyph_extents (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents)
{
return font->backend->glyph_extents(font, scale, glyphs, num_glyphs, extents);
}
cairo_status_t
_cairo_unscaled_font_glyph_bbox (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_box_t *bbox)
{
return font->backend->glyph_bbox (font, scale, glyphs, num_glyphs, bbox);
}
cairo_status_t
_cairo_unscaled_font_show_glyphs (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_operator_t operator,
cairo_surface_t *source,
cairo_surface_t *surface,
int source_x,
int source_y,
cairo_glyph_t *glyphs,
int num_glyphs)
{
cairo_status_t status;
if (surface->backend->show_glyphs != NULL) {
status = surface->backend->show_glyphs (font, scale, operator, source,
surface, source_x, source_y,
glyphs, num_glyphs);
if (status == CAIRO_STATUS_SUCCESS)
return status;
}
/* Surface display routine either does not exist or failed. */
return font->backend->show_glyphs (font, scale, operator, source,
surface, source_x, source_y,
glyphs, num_glyphs);
}
cairo_status_t
_cairo_unscaled_font_glyph_path (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_path_t *path)
{
return font->backend->glyph_path (font, scale, glyphs, num_glyphs, path);
}
cairo_status_t
_cairo_unscaled_font_font_extents (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_font_extents_t *extents)
{
return font->backend->font_extents(font, scale, extents);
}
void
_cairo_unscaled_font_reference (cairo_unscaled_font_t *font)
{
font->refcount++;
}
void
_cairo_unscaled_font_destroy (cairo_unscaled_font_t *font)
{
if (--(font->refcount) > 0)
return;
if (font->backend)
font->backend->destroy (font);
}
/* Public font API follows. */
void
cairo_font_reference (cairo_font_t *font)
{
font->refcount++;
}
void
cairo_font_destroy (cairo_font_t *font)
{
if (--(font->refcount) > 0)
return;
if (font->unscaled)
_cairo_unscaled_font_destroy (font->unscaled);
free (font);
}
void
cairo_font_set_transform (cairo_font_t *font,
cairo_matrix_t *matrix)
{
double dummy;
cairo_matrix_get_affine (matrix,
&font->scale.matrix[0][0],
&font->scale.matrix[0][1],
&font->scale.matrix[1][0],
&font->scale.matrix[1][1],
&dummy, &dummy);
}
void
cairo_font_current_transform (cairo_font_t *font,
cairo_matrix_t *matrix)
{
cairo_matrix_set_affine (matrix,
font->scale.matrix[0][0],
font->scale.matrix[0][1],
font->scale.matrix[1][0],
font->scale.matrix[1][1],
0, 0);
}
/* Now we implement functions to access a default global image & metrics
* cache.
*/
unsigned long
_cairo_glyph_cache_hash (void *cache, void *key)
{
cairo_glyph_cache_key_t *in;
in = (cairo_glyph_cache_key_t *) key;
return
((unsigned long) in->unscaled)
^ ((unsigned long) in->scale.matrix[0][0])
^ ((unsigned long) in->scale.matrix[0][1])
^ ((unsigned long) in->scale.matrix[1][0])
^ ((unsigned long) in->scale.matrix[1][1])
^ in->index;
}
int
_cairo_glyph_cache_keys_equal (void *cache,
void *k1,
void *k2)
{
cairo_glyph_cache_key_t *a, *b;
a = (cairo_glyph_cache_key_t *) k1;
b = (cairo_glyph_cache_key_t *) k2;
return (a->index == b->index)
&& (a->unscaled == b->unscaled)
&& (a->scale.matrix[0][0] == b->scale.matrix[0][0])
&& (a->scale.matrix[0][1] == b->scale.matrix[0][1])
&& (a->scale.matrix[1][0] == b->scale.matrix[1][0])
&& (a->scale.matrix[1][1] == b->scale.matrix[1][1]);
}
static cairo_status_t
_image_glyph_cache_create_entry (void *cache,
void *key,
void **return_value)
{
cairo_glyph_cache_key_t *k = (cairo_glyph_cache_key_t *) key;
cairo_image_glyph_cache_entry_t *im;
cairo_status_t status;
im = calloc (1, sizeof (cairo_image_glyph_cache_entry_t));
if (im == NULL)
return CAIRO_STATUS_NO_MEMORY;
im->key = *k;
status = im->key.unscaled->backend->create_glyph (im);
if (status != CAIRO_STATUS_SUCCESS) {
free (im);
return status;
}
_cairo_unscaled_font_reference (im->key.unscaled);
im->key.base.memory =
sizeof (cairo_image_glyph_cache_entry_t)
+ (im->image ?
sizeof (cairo_image_surface_t)
+ 28 * sizeof (int) /* rough guess at size of pixman image structure */
+ (im->image->height * im->image->stride) : 0);
*return_value = im;
return CAIRO_STATUS_SUCCESS;
}
static void
_image_glyph_cache_destroy_entry (void *cache,
void *value)
{
cairo_image_glyph_cache_entry_t *im;
im = (cairo_image_glyph_cache_entry_t *) value;
_cairo_unscaled_font_destroy (im->key.unscaled);
cairo_surface_destroy (&(im->image->base));
free (im);
}
static void
_image_glyph_cache_destroy_cache (void *cache)
{
free (cache);
}
static const cairo_cache_backend_t cairo_image_cache_backend = {
_cairo_glyph_cache_hash,
_cairo_glyph_cache_keys_equal,
_image_glyph_cache_create_entry,
_image_glyph_cache_destroy_entry,
_image_glyph_cache_destroy_cache
};
void
_cairo_lock_global_image_glyph_cache()
{
/* FIXME: implement locking. */
}
void
_cairo_unlock_global_image_glyph_cache()
{
/* FIXME: implement locking. */
}
static cairo_cache_t *
_global_image_glyph_cache = NULL;
cairo_cache_t *
_cairo_get_global_image_glyph_cache ()
{
if (_global_image_glyph_cache == NULL) {
_global_image_glyph_cache = malloc (sizeof (cairo_cache_t));
if (_global_image_glyph_cache == NULL)
goto FAIL;
if (_cairo_cache_init (_global_image_glyph_cache,
&cairo_image_cache_backend,
CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT))
goto FAIL;
}
return _global_image_glyph_cache;
FAIL:
if (_global_image_glyph_cache)
free (_global_image_glyph_cache);
_global_image_glyph_cache = NULL;
return NULL;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,202 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2003 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
typedef struct cairo_hull
{
cairo_point_t point;
cairo_slope_t slope;
int discard;
} cairo_hull_t;
static cairo_hull_t *
_cairo_hull_create (cairo_pen_vertex_t *vertices, int num_vertices)
{
int i;
cairo_hull_t *hull;
cairo_point_t *p, *extremum, tmp;
extremum = &vertices[0].point;
for (i = 1; i < num_vertices; i++) {
p = &vertices[i].point;
if (p->y < extremum->y || (p->y == extremum->y && p->x < extremum->x))
extremum = p;
}
/* Put the extremal point at the beginning of the array */
tmp = *extremum;
*extremum = vertices[0].point;
vertices[0].point = tmp;
hull = malloc (num_vertices * sizeof (cairo_hull_t));
if (hull == NULL)
return NULL;
for (i = 0; i < num_vertices; i++) {
hull[i].point = vertices[i].point;
_cairo_slope_init (&hull[i].slope, &hull[0].point, &hull[i].point);
/* Discard all points coincident with the extremal point */
if (i != 0 && hull[i].slope.dx == 0 && hull[i].slope.dy == 0)
hull[i].discard = 1;
else
hull[i].discard = 0;
}
return hull;
}
static int
_cairo_hull_vertex_compare (const void *av, const void *bv)
{
cairo_hull_t *a = (cairo_hull_t *) av;
cairo_hull_t *b = (cairo_hull_t *) bv;
int ret;
ret = _cairo_slope_compare (&a->slope, &b->slope);
/* In the case of two vertices with identical slope from the
extremal point discard the nearer point. */
if (ret == 0) {
cairo_fixed_48_16_t a_dist, b_dist;
a_dist = ((cairo_fixed_48_16_t) a->slope.dx * a->slope.dx +
(cairo_fixed_48_16_t) a->slope.dy * a->slope.dy);
b_dist = ((cairo_fixed_48_16_t) b->slope.dx * b->slope.dx +
(cairo_fixed_48_16_t) b->slope.dy * b->slope.dy);
if (a_dist < b_dist) {
a->discard = 1;
ret = -1;
} else {
b->discard = 1;
ret = 1;
}
}
return ret;
}
static int
_cairo_hull_prev_valid (cairo_hull_t *hull, int num_hull, int index)
{
do {
/* hull[0] is always valid, so don't test and wraparound */
index--;
} while (hull[index].discard);
return index;
}
static int
_cairo_hull_next_valid (cairo_hull_t *hull, int num_hull, int index)
{
do {
index = (index + 1) % num_hull;
} while (hull[index].discard);
return index;
}
static cairo_status_t
_cairo_hull_eliminate_concave (cairo_hull_t *hull, int num_hull)
{
int i, j, k;
cairo_slope_t slope_ij, slope_jk;
i = 0;
j = _cairo_hull_next_valid (hull, num_hull, i);
k = _cairo_hull_next_valid (hull, num_hull, j);
do {
_cairo_slope_init (&slope_ij, &hull[i].point, &hull[j].point);
_cairo_slope_init (&slope_jk, &hull[j].point, &hull[k].point);
/* Is the angle formed by ij and jk concave? */
if (_cairo_slope_compare (&slope_ij, &slope_jk) >= 0) {
if (i == k)
return CAIRO_STATUS_SUCCESS;
hull[j].discard = 1;
j = i;
i = _cairo_hull_prev_valid (hull, num_hull, j);
} else {
i = j;
j = k;
k = _cairo_hull_next_valid (hull, num_hull, j);
}
} while (j != 0);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_hull_to_pen (cairo_hull_t *hull, cairo_pen_vertex_t *vertices, int *num_vertices)
{
int i, j = 0;
for (i = 0; i < *num_vertices; i++) {
if (hull[i].discard)
continue;
vertices[j++].point = hull[i].point;
}
*num_vertices = j;
return CAIRO_STATUS_SUCCESS;
}
/* Given a set of vertices, compute the convex hull using the Graham
scan algorithm. */
cairo_status_t
_cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices)
{
cairo_hull_t *hull;
int num_hull = *num_vertices;
hull = _cairo_hull_create (vertices, num_hull);
if (hull == NULL)
return CAIRO_STATUS_NO_MEMORY;
qsort (hull + 1, num_hull - 1,
sizeof (cairo_hull_t), _cairo_hull_vertex_compare);
_cairo_hull_eliminate_concave (hull, num_hull);
_cairo_hull_to_pen (hull, vertices, num_vertices);
free (hull);
return CAIRO_STATUS_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,530 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2003 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
static const cairo_surface_backend_t cairo_image_surface_backend;
static int
_cairo_format_bpp (cairo_format_t format)
{
switch (format) {
case CAIRO_FORMAT_A1:
return 1;
case CAIRO_FORMAT_A8:
return 8;
case CAIRO_FORMAT_RGB24:
case CAIRO_FORMAT_ARGB32:
default:
return 32;
}
}
static cairo_image_surface_t *
_cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image)
{
cairo_image_surface_t *surface;
surface = malloc (sizeof (cairo_image_surface_t));
if (surface == NULL)
return NULL;
_cairo_surface_init (&surface->base, &cairo_image_surface_backend);
surface->pixman_image = pixman_image;
surface->data = (char *) pixman_image_get_data (pixman_image);
surface->owns_data = 0;
surface->width = pixman_image_get_width (pixman_image);
surface->height = pixman_image_get_height (pixman_image);
surface->stride = pixman_image_get_stride (pixman_image);
surface->depth = pixman_image_get_depth (pixman_image);
return surface;
}
cairo_image_surface_t *
_cairo_image_surface_create_with_masks (char *data,
cairo_format_masks_t *format,
int width,
int height,
int stride)
{
cairo_image_surface_t *surface;
pixman_format_t *pixman_format;
pixman_image_t *pixman_image;
pixman_format = pixman_format_create_masks (format->bpp,
format->alpha_mask,
format->red_mask,
format->green_mask,
format->blue_mask);
if (pixman_format == NULL)
return NULL;
pixman_image = pixman_image_create_for_data ((pixman_bits_t *) data, pixman_format,
width, height, format->bpp, stride);
pixman_format_destroy (pixman_format);
if (pixman_image == NULL)
return NULL;
surface = _cairo_image_surface_create_for_pixman_image (pixman_image);
return surface;
}
static pixman_format_t *
_create_pixman_format (cairo_format_t format)
{
switch (format) {
case CAIRO_FORMAT_A1:
return pixman_format_create (PIXMAN_FORMAT_NAME_A1);
break;
case CAIRO_FORMAT_A8:
return pixman_format_create (PIXMAN_FORMAT_NAME_A8);
break;
case CAIRO_FORMAT_RGB24:
return pixman_format_create (PIXMAN_FORMAT_NAME_RGB24);
break;
case CAIRO_FORMAT_ARGB32:
default:
return pixman_format_create (PIXMAN_FORMAT_NAME_ARGB32);
break;
}
}
cairo_surface_t *
cairo_image_surface_create (cairo_format_t format,
int width,
int height)
{
cairo_image_surface_t *surface;
pixman_format_t *pixman_format;
pixman_image_t *pixman_image;
pixman_format = _create_pixman_format (format);
if (pixman_format == NULL)
return NULL;
pixman_image = pixman_image_create (pixman_format, width, height);
pixman_format_destroy (pixman_format);
if (pixman_image == NULL)
return NULL;
surface = _cairo_image_surface_create_for_pixman_image (pixman_image);
return &surface->base;
}
cairo_surface_t *
cairo_image_surface_create_for_data (char *data,
cairo_format_t format,
int width,
int height,
int stride)
{
cairo_image_surface_t *surface;
pixman_format_t *pixman_format;
pixman_image_t *pixman_image;
pixman_format = _create_pixman_format (format);
if (pixman_format == NULL)
return NULL;
pixman_image = pixman_image_create_for_data ((pixman_bits_t *) data, pixman_format,
width, height,
_cairo_format_bpp (format),
stride);
pixman_format_destroy (pixman_format);
if (pixman_image == NULL)
return NULL;
surface = _cairo_image_surface_create_for_pixman_image (pixman_image);
return &surface->base;
}
static cairo_surface_t *
_cairo_image_surface_create_similar (void *abstract_src,
cairo_format_t format,
int drawable,
int width,
int height)
{
return cairo_image_surface_create (format, width, height);
}
static void
_cairo_image_abstract_surface_destroy (void *abstract_surface)
{
cairo_image_surface_t *surface = abstract_surface;
if (surface->pixman_image)
pixman_image_destroy (surface->pixman_image);
if (surface->owns_data) {
free (surface->data);
surface->data = NULL;
}
free (surface);
}
void
_cairo_image_surface_assume_ownership_of_data (cairo_image_surface_t *surface)
{
surface->owns_data = 1;
}
static double
_cairo_image_surface_pixels_per_inch (void *abstract_surface)
{
/* XXX: We'll want a way to let the user set this. */
return 96.0;
}
static cairo_image_surface_t *
_cairo_image_surface_get_image (void *abstract_surface)
{
cairo_image_surface_t *surface = abstract_surface;
cairo_surface_reference (&surface->base);
return surface;
}
static cairo_status_t
_cairo_image_surface_set_image (void *abstract_surface,
cairo_image_surface_t *image)
{
if (image == abstract_surface)
return CAIRO_STATUS_SUCCESS;
/* XXX: This case has not yet been implemented. We'll lie for now. */
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_image_abstract_surface_set_matrix (void *abstract_surface,
cairo_matrix_t *matrix)
{
cairo_image_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_matrix (surface, matrix);
}
cairo_status_t
_cairo_image_surface_set_matrix (cairo_image_surface_t *surface,
cairo_matrix_t *matrix)
{
pixman_transform_t pixman_transform;
pixman_transform.matrix[0][0] = _cairo_fixed_from_double (matrix->m[0][0]);
pixman_transform.matrix[0][1] = _cairo_fixed_from_double (matrix->m[1][0]);
pixman_transform.matrix[0][2] = _cairo_fixed_from_double (matrix->m[2][0]);
pixman_transform.matrix[1][0] = _cairo_fixed_from_double (matrix->m[0][1]);
pixman_transform.matrix[1][1] = _cairo_fixed_from_double (matrix->m[1][1]);
pixman_transform.matrix[1][2] = _cairo_fixed_from_double (matrix->m[2][1]);
pixman_transform.matrix[2][0] = 0;
pixman_transform.matrix[2][1] = 0;
pixman_transform.matrix[2][2] = _cairo_fixed_from_double (1);
pixman_image_set_transform (surface->pixman_image, &pixman_transform);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_image_abstract_surface_set_filter (void *abstract_surface, cairo_filter_t filter)
{
cairo_image_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_filter (surface, filter);
}
cairo_status_t
_cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t filter)
{
pixman_filter_t pixman_filter;
switch (filter) {
case CAIRO_FILTER_FAST:
pixman_filter = PIXMAN_FILTER_FAST;
break;
case CAIRO_FILTER_GOOD:
pixman_filter = PIXMAN_FILTER_GOOD;
break;
case CAIRO_FILTER_BEST:
pixman_filter = PIXMAN_FILTER_BEST;
break;
case CAIRO_FILTER_NEAREST:
pixman_filter = PIXMAN_FILTER_NEAREST;
break;
case CAIRO_FILTER_BILINEAR:
pixman_filter = PIXMAN_FILTER_BILINEAR;
break;
default:
pixman_filter = PIXMAN_FILTER_BEST;
}
pixman_image_set_filter (surface->pixman_image, pixman_filter);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_image_abstract_surface_set_repeat (void *abstract_surface, int repeat)
{
cairo_image_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_repeat (surface, repeat);
}
cairo_status_t
_cairo_image_surface_set_repeat (cairo_image_surface_t *surface, int repeat)
{
pixman_image_set_repeat (surface->pixman_image, repeat);
return CAIRO_STATUS_SUCCESS;
}
static pixman_operator_t
_pixman_operator (cairo_operator_t operator)
{
switch (operator) {
case CAIRO_OPERATOR_CLEAR:
return PIXMAN_OPERATOR_CLEAR;
case CAIRO_OPERATOR_SRC:
return PIXMAN_OPERATOR_SRC;
case CAIRO_OPERATOR_DST:
return PIXMAN_OPERATOR_DST;
case CAIRO_OPERATOR_OVER:
return PIXMAN_OPERATOR_OVER;
case CAIRO_OPERATOR_OVER_REVERSE:
return PIXMAN_OPERATOR_OVER_REVERSE;
case CAIRO_OPERATOR_IN:
return PIXMAN_OPERATOR_IN;
case CAIRO_OPERATOR_IN_REVERSE:
return PIXMAN_OPERATOR_IN_REVERSE;
case CAIRO_OPERATOR_OUT:
return PIXMAN_OPERATOR_OUT;
case CAIRO_OPERATOR_OUT_REVERSE:
return PIXMAN_OPERATOR_OUT_REVERSE;
case CAIRO_OPERATOR_ATOP:
return PIXMAN_OPERATOR_ATOP;
case CAIRO_OPERATOR_ATOP_REVERSE:
return PIXMAN_OPERATOR_ATOP_REVERSE;
case CAIRO_OPERATOR_XOR:
return PIXMAN_OPERATOR_XOR;
case CAIRO_OPERATOR_ADD:
return PIXMAN_OPERATOR_ADD;
case CAIRO_OPERATOR_SATURATE:
return PIXMAN_OPERATOR_SATURATE;
default:
return PIXMAN_OPERATOR_OVER;
}
}
static cairo_int_status_t
_cairo_image_surface_composite (cairo_operator_t operator,
cairo_surface_t *generic_src,
cairo_surface_t *generic_mask,
void *abstract_dst,
int src_x,
int src_y,
int mask_x,
int mask_y,
int dst_x,
int dst_y,
unsigned int width,
unsigned int height)
{
cairo_image_surface_t *dst = abstract_dst;
cairo_image_surface_t *src = (cairo_image_surface_t *) generic_src;
cairo_image_surface_t *mask = (cairo_image_surface_t *) generic_mask;
if (generic_src->backend != dst->base.backend ||
(generic_mask && (generic_mask->backend != dst->base.backend)))
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
pixman_composite (_pixman_operator (operator),
src->pixman_image,
mask ? mask->pixman_image : NULL,
dst->pixman_image,
src_x, src_y,
mask_x, mask_y,
dst_x, dst_y,
width, height);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_image_surface_fill_rectangles (void *abstract_surface,
cairo_operator_t operator,
const cairo_color_t *color,
cairo_rectangle_t *rects,
int num_rects)
{
cairo_image_surface_t *surface = abstract_surface;
pixman_color_t pixman_color;
pixman_color.red = color->red_short;
pixman_color.green = color->green_short;
pixman_color.blue = color->blue_short;
pixman_color.alpha = color->alpha_short;
/* XXX: The pixman_rectangle_t cast is evil... it needs to go away somehow. */
pixman_fill_rectangles (_pixman_operator(operator), surface->pixman_image,
&pixman_color, (pixman_rectangle_t *) rects, num_rects);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_image_surface_composite_trapezoids (cairo_operator_t operator,
cairo_surface_t *generic_src,
void *abstract_dst,
int x_src,
int y_src,
cairo_trapezoid_t *traps,
int num_traps)
{
cairo_image_surface_t *dst = abstract_dst;
cairo_image_surface_t *src = (cairo_image_surface_t *) generic_src;
if (generic_src->backend != dst->base.backend)
return CAIRO_INT_STATUS_UNSUPPORTED;
/* XXX: The pixman_trapezoid_t cast is evil and needs to go away somehow. */
pixman_composite_trapezoids (operator, src->pixman_image, dst->pixman_image,
x_src, y_src, (pixman_trapezoid_t *) traps, num_traps);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_image_surface_copy_page (void *abstract_surface)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_image_surface_show_page (void *abstract_surface)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_image_abstract_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
cairo_image_surface_t *surface = (cairo_image_surface_t *) abstract_surface;
return _cairo_image_surface_set_clip_region (surface, region);
}
cairo_int_status_t
_cairo_image_surface_set_clip_region (cairo_image_surface_t *surface,
pixman_region16_t *region)
{
if (region) {
pixman_region16_t *rcopy;
rcopy = pixman_region_create();
/* pixman_image_set_clip_region expects to take ownership of the
* passed-in region, so we create a copy to give it. */
/* XXX: I think that's probably a bug in pixman. But its
* memory management issues need auditing anyway, so a
* workaround like this is fine for now. */
pixman_region_copy (rcopy, region);
pixman_image_set_clip_region (surface->pixman_image, rcopy);
} else {
pixman_image_set_clip_region (surface->pixman_image, region);
}
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_image_abstract_surface_create_pattern (void *abstract_surface,
cairo_pattern_t *pattern,
cairo_box_t *box)
{
cairo_image_surface_t *image;
/* Fall back to general pattern creation for surface patterns. */
if (pattern->type == CAIRO_PATTERN_SURFACE)
return CAIRO_INT_STATUS_UNSUPPORTED;
image = _cairo_pattern_get_image (pattern, box);
if (image) {
pattern->source = &image->base;
return CAIRO_STATUS_SUCCESS;
} else
return CAIRO_STATUS_NO_MEMORY;
}
static const cairo_surface_backend_t cairo_image_surface_backend = {
_cairo_image_surface_create_similar,
_cairo_image_abstract_surface_destroy,
_cairo_image_surface_pixels_per_inch,
_cairo_image_surface_get_image,
_cairo_image_surface_set_image,
_cairo_image_abstract_surface_set_matrix,
_cairo_image_abstract_surface_set_filter,
_cairo_image_abstract_surface_set_repeat,
_cairo_image_surface_composite,
_cairo_image_surface_fill_rectangles,
_cairo_image_surface_composite_trapezoids,
_cairo_image_surface_copy_page,
_cairo_image_surface_show_page,
_cairo_image_abstract_surface_set_clip_region,
_cairo_image_abstract_surface_create_pattern,
NULL /* show_glyphs */
};

Просмотреть файл

@ -0,0 +1,483 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <math.h>
#include "cairoint.h"
static cairo_matrix_t const CAIRO_MATRIX_IDENTITY = {
{
{1, 0},
{0, 1},
{0, 0}
}
};
static void
_cairo_matrix_scalar_multiply (cairo_matrix_t *matrix, double scalar);
static void
_cairo_matrix_compute_adjoint (cairo_matrix_t *matrix);
cairo_matrix_t *
cairo_matrix_create (void)
{
cairo_matrix_t *matrix;
matrix = malloc (sizeof (cairo_matrix_t));
if (matrix == NULL)
return NULL;
_cairo_matrix_init (matrix);
return matrix;
}
void
_cairo_matrix_init (cairo_matrix_t *matrix)
{
cairo_matrix_set_identity (matrix);
}
void
_cairo_matrix_fini (cairo_matrix_t *matrix)
{
/* nothing to do here */
}
void
cairo_matrix_destroy (cairo_matrix_t *matrix)
{
_cairo_matrix_fini (matrix);
free (matrix);
}
cairo_status_t
cairo_matrix_copy (cairo_matrix_t *matrix, const cairo_matrix_t *other)
{
*matrix = *other;
return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def(cairo_matrix_copy);
cairo_status_t
cairo_matrix_set_identity (cairo_matrix_t *matrix)
{
*matrix = CAIRO_MATRIX_IDENTITY;
return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def(cairo_matrix_set_identity);
cairo_status_t
cairo_matrix_set_affine (cairo_matrix_t *matrix,
double a, double b,
double c, double d,
double tx, double ty)
{
matrix->m[0][0] = a; matrix->m[0][1] = b;
matrix->m[1][0] = c; matrix->m[1][1] = d;
matrix->m[2][0] = tx; matrix->m[2][1] = ty;
return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def(cairo_matrix_set_affine);
cairo_status_t
cairo_matrix_get_affine (cairo_matrix_t *matrix,
double *a, double *b,
double *c, double *d,
double *tx, double *ty)
{
if (a)
*a = matrix->m[0][0];
if (b)
*b = matrix->m[0][1];
if (c)
*c = matrix->m[1][0];
if (d)
*d = matrix->m[1][1];
if (tx)
*tx = matrix->m[2][0];
if (ty)
*ty = matrix->m[2][1];
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_matrix_set_translate (cairo_matrix_t *matrix,
double tx, double ty)
{
return cairo_matrix_set_affine (matrix,
1, 0,
0, 1,
tx, ty);
}
cairo_status_t
cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty)
{
cairo_matrix_t tmp;
_cairo_matrix_set_translate (&tmp, tx, ty);
return cairo_matrix_multiply (matrix, &tmp, matrix);
}
cairo_status_t
_cairo_matrix_set_scale (cairo_matrix_t *matrix,
double sx, double sy)
{
return cairo_matrix_set_affine (matrix,
sx, 0,
0, sy,
0, 0);
}
cairo_status_t
cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy)
{
cairo_matrix_t tmp;
_cairo_matrix_set_scale (&tmp, sx, sy);
return cairo_matrix_multiply (matrix, &tmp, matrix);
}
slim_hidden_def(cairo_matrix_scale);
cairo_status_t
_cairo_matrix_set_rotate (cairo_matrix_t *matrix,
double radians)
{
double s;
double c;
#if HAVE_SINCOS
sincos (radians, &s, &c);
#else
s = sin (radians);
c = cos (radians);
#endif
return cairo_matrix_set_affine (matrix,
c, s,
-s, c,
0, 0);
}
cairo_status_t
cairo_matrix_rotate (cairo_matrix_t *matrix, double radians)
{
cairo_matrix_t tmp;
_cairo_matrix_set_rotate (&tmp, radians);
return cairo_matrix_multiply (matrix, &tmp, matrix);
}
cairo_status_t
cairo_matrix_multiply (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b)
{
cairo_matrix_t r;
int row, col, n;
double t;
for (row = 0; row < 3; row++) {
for (col = 0; col < 2; col++) {
if (row == 2)
t = b->m[2][col];
else
t = 0;
for (n = 0; n < 2; n++) {
t += a->m[row][n] * b->m[n][col];
}
r.m[row][col] = t;
}
}
*result = r;
return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def(cairo_matrix_multiply);
cairo_status_t
cairo_matrix_transform_distance (cairo_matrix_t *matrix, double *dx, double *dy)
{
double new_x, new_y;
new_x = (matrix->m[0][0] * *dx
+ matrix->m[1][0] * *dy);
new_y = (matrix->m[0][1] * *dx
+ matrix->m[1][1] * *dy);
*dx = new_x;
*dy = new_y;
return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def(cairo_matrix_transform_distance);
cairo_status_t
cairo_matrix_transform_point (cairo_matrix_t *matrix, double *x, double *y)
{
cairo_matrix_transform_distance (matrix, x, y);
*x += matrix->m[2][0];
*y += matrix->m[2][1];
return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def(cairo_matrix_transform_point);
cairo_status_t
_cairo_matrix_transform_bounding_box (cairo_matrix_t *matrix,
double *x, double *y,
double *width, double *height)
{
int i;
double quad_x[4], quad_y[4];
double dx1, dy1;
double dx2, dy2;
double min_x, max_x;
double min_y, max_y;
quad_x[0] = *x;
quad_y[0] = *y;
cairo_matrix_transform_point (matrix, &quad_x[0], &quad_y[0]);
dx1 = *width;
dy1 = 0;
cairo_matrix_transform_distance (matrix, &dx1, &dy1);
quad_x[1] = quad_x[0] + dx1;
quad_y[1] = quad_y[0] + dy1;
dx2 = 0;
dy2 = *height;
cairo_matrix_transform_distance (matrix, &dx2, &dy2);
quad_x[2] = quad_x[0] + dx2;
quad_y[2] = quad_y[0] + dy2;
quad_x[3] = quad_x[0] + dx1 + dx2;
quad_y[3] = quad_y[0] + dy1 + dy2;
min_x = max_x = quad_x[0];
min_y = max_y = quad_y[0];
for (i=1; i < 4; i++) {
if (quad_x[i] < min_x)
min_x = quad_x[i];
if (quad_x[i] > max_x)
max_x = quad_x[i];
if (quad_y[i] < min_y)
min_y = quad_y[i];
if (quad_y[i] > max_y)
max_y = quad_y[i];
}
*x = min_x;
*y = min_y;
*width = max_x - min_x;
*height = max_y - min_y;
return CAIRO_STATUS_SUCCESS;
}
static void
_cairo_matrix_scalar_multiply (cairo_matrix_t *matrix, double scalar)
{
int row, col;
for (row = 0; row < 3; row++)
for (col = 0; col < 2; col++)
matrix->m[row][col] *= scalar;
}
/* This function isn't a correct adjoint in that the implicit 1 in the
homogeneous result should actually be ad-bc instead. But, since this
adjoint is only used in the computation of the inverse, which
divides by det (A)=ad-bc anyway, everything works out in the end. */
static void
_cairo_matrix_compute_adjoint (cairo_matrix_t *matrix)
{
/* adj (A) = transpose (C:cofactor (A,i,j)) */
double a, b, c, d, tx, ty;
a = matrix->m[0][0]; b = matrix->m[0][1];
c = matrix->m[1][0]; d = matrix->m[1][1];
tx = matrix->m[2][0]; ty = matrix->m[2][1];
cairo_matrix_set_affine (matrix,
d, -b,
-c, a,
c*ty - d*tx, b*tx - a*ty);
}
cairo_status_t
cairo_matrix_invert (cairo_matrix_t *matrix)
{
/* inv (A) = 1/det (A) * adj (A) */
double det;
_cairo_matrix_compute_determinant (matrix, &det);
if (det == 0)
return CAIRO_STATUS_INVALID_MATRIX;
_cairo_matrix_compute_adjoint (matrix);
_cairo_matrix_scalar_multiply (matrix, 1 / det);
return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def(cairo_matrix_invert);
cairo_status_t
_cairo_matrix_compute_determinant (cairo_matrix_t *matrix, double *det)
{
double a, b, c, d;
a = matrix->m[0][0]; b = matrix->m[0][1];
c = matrix->m[1][0]; d = matrix->m[1][1];
*det = a*d - b*c;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, double *lambda2)
{
/* The eigenvalues of an NxN matrix M are found by solving the polynomial:
det (M - lI) = 0
The zeros in our homogeneous 3x3 matrix make this equation equal
to that formed by the sub-matrix:
M = a b
c d
by which:
l^2 - (a+d)l + (ad - bc) = 0
l = (a+d +/- sqrt (a^2 + 2ad + d^2 - 4 (ad-bc))) / 2;
*/
double a, b, c, d, rad;
a = matrix->m[0][0];
b = matrix->m[0][1];
c = matrix->m[1][0];
d = matrix->m[1][1];
rad = sqrt (a*a + 2*a*d + d*d - 4*(a*d - b*c));
*lambda1 = (a + d + rad) / 2.0;
*lambda2 = (a + d - rad) / 2.0;
return CAIRO_STATUS_SUCCESS;
}
/* Compute the amount that each basis vector is scaled by. */
cairo_status_t
_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy, int x_major)
{
double det;
_cairo_matrix_compute_determinant (matrix, &det);
if (det == 0)
*sx = *sy = 0;
else
{
double x = x_major != 0;
double y = x == 0;
double major, minor;
cairo_matrix_transform_distance (matrix, &x, &y);
major = sqrt(x*x + y*y);
/*
* ignore mirroring
*/
if (det < 0)
det = -det;
if (major)
minor = det / major;
else
minor = 0.0;
if (x_major)
{
*sx = major;
*sy = minor;
}
else
{
*sx = minor;
*sy = major;
}
}
return CAIRO_STATUS_SUCCESS;
}
int
_cairo_matrix_is_integer_translation(cairo_matrix_t *mat,
int *itx, int *ity)
{
double a, b, c, d, tx, ty;
int ttx, tty;
int ok = 0;
cairo_matrix_get_affine (mat, &a, &b, &c, &d, &tx, &ty);
ttx = _cairo_fixed_from_double (tx);
tty = _cairo_fixed_from_double (ty);
ok = ((a == 1.0)
&& (b == 0.0)
&& (c == 0.0)
&& (d == 1.0)
&& (_cairo_fixed_is_integer(ttx))
&& (_cairo_fixed_is_integer(tty)));
if (ok) {
*itx = _cairo_fixed_integer_part(ttx);
*ity = _cairo_fixed_integer_part(tty);
return 1;
}
return 0;
}

Просмотреть файл

@ -0,0 +1,493 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <stdlib.h>
#include "cairoint.h"
/* private functions */
static cairo_status_t
_cairo_path_add (cairo_path_t *path, cairo_path_op_t op, cairo_point_t *points, int num_pts);
static void
_cairo_path_add_op_buf (cairo_path_t *path, cairo_path_op_buf_t *op);
static cairo_status_t
_cairo_path_new_op_buf (cairo_path_t *path);
static void
_cairo_path_add_arg_buf (cairo_path_t *path, cairo_path_arg_buf_t *arg);
static cairo_status_t
_cairo_path_new_arg_buf (cairo_path_t *path);
static cairo_path_op_buf_t *
_cairo_path_op_buf_create (void);
static void
_cairo_path_op_buf_destroy (cairo_path_op_buf_t *buf);
static void
_cairo_path_op_buf_add (cairo_path_op_buf_t *op_buf, cairo_path_op_t op);
static cairo_path_arg_buf_t *
_cairo_path_arg_buf_create (void);
static void
_cairo_path_arg_buf_destroy (cairo_path_arg_buf_t *buf);
static void
_cairo_path_arg_buf_add (cairo_path_arg_buf_t *arg, cairo_point_t *points, int num_points);
void
_cairo_path_init (cairo_path_t *path)
{
path->op_head = NULL;
path->op_tail = NULL;
path->arg_head = NULL;
path->arg_tail = NULL;
path->current_point.x = 0;
path->current_point.y = 0;
path->has_current_point = 0;
path->last_move_point = path->current_point;
}
cairo_status_t
_cairo_path_init_copy (cairo_path_t *path, cairo_path_t *other)
{
cairo_path_op_buf_t *op, *other_op;
cairo_path_arg_buf_t *arg, *other_arg;
_cairo_path_init (path);
path->current_point = other->current_point;
path->has_current_point = other->has_current_point;
path->last_move_point = other->last_move_point;
for (other_op = other->op_head; other_op; other_op = other_op->next) {
op = _cairo_path_op_buf_create ();
if (op == NULL) {
return CAIRO_STATUS_NO_MEMORY;
}
*op = *other_op;
_cairo_path_add_op_buf (path, op);
}
for (other_arg = other->arg_head; other_arg; other_arg = other_arg->next) {
arg = _cairo_path_arg_buf_create ();
if (arg == NULL) {
return CAIRO_STATUS_NO_MEMORY;
}
*arg = *other_arg;
_cairo_path_add_arg_buf (path, arg);
}
return CAIRO_STATUS_SUCCESS;
}
void
_cairo_path_fini (cairo_path_t *path)
{
cairo_path_op_buf_t *op;
cairo_path_arg_buf_t *arg;
while (path->op_head) {
op = path->op_head;
path->op_head = op->next;
_cairo_path_op_buf_destroy (op);
}
path->op_tail = NULL;
while (path->arg_head) {
arg = path->arg_head;
path->arg_head = arg->next;
_cairo_path_arg_buf_destroy (arg);
}
path->arg_tail = NULL;
path->has_current_point = 0;
}
cairo_status_t
_cairo_path_move_to (cairo_path_t *path, cairo_point_t *point)
{
cairo_status_t status;
status = _cairo_path_add (path, CAIRO_PATH_OP_MOVE_TO, point, 1);
if (status)
return status;
path->current_point = *point;
path->has_current_point = 1;
path->last_move_point = path->current_point;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_path_rel_move_to (cairo_path_t *path, cairo_distance_t *distance)
{
cairo_point_t point;
point.x = path->current_point.x + distance->dx;
point.y = path->current_point.y + distance->dy;
return _cairo_path_move_to (path, &point);
}
cairo_status_t
_cairo_path_line_to (cairo_path_t *path, cairo_point_t *point)
{
cairo_status_t status;
status = _cairo_path_add (path, CAIRO_PATH_OP_LINE_TO, point, 1);
if (status)
return status;
path->current_point = *point;
path->has_current_point = 1;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_path_rel_line_to (cairo_path_t *path, cairo_distance_t *distance)
{
cairo_point_t point;
point.x = path->current_point.x + distance->dx;
point.y = path->current_point.y + distance->dy;
return _cairo_path_line_to (path, &point);
}
cairo_status_t
_cairo_path_curve_to (cairo_path_t *path,
cairo_point_t *p0,
cairo_point_t *p1,
cairo_point_t *p2)
{
cairo_status_t status;
cairo_point_t point[3];
point[0] = *p0;
point[1] = *p1;
point[2] = *p2;
status = _cairo_path_add (path, CAIRO_PATH_OP_CURVE_TO, point, 3);
if (status)
return status;
path->current_point = *p2;
path->has_current_point = 1;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_path_rel_curve_to (cairo_path_t *path,
cairo_distance_t *d0,
cairo_distance_t *d1,
cairo_distance_t *d2)
{
cairo_point_t p0, p1, p2;
p0.x = path->current_point.x + d0->dx;
p0.y = path->current_point.y + d0->dy;
p1.x = path->current_point.x + d1->dx;
p1.y = path->current_point.y + d1->dy;
p2.x = path->current_point.x + d2->dx;
p2.y = path->current_point.y + d2->dy;
return _cairo_path_curve_to (path, &p0, &p1, &p2);
}
cairo_status_t
_cairo_path_close_path (cairo_path_t *path)
{
cairo_status_t status;
status = _cairo_path_add (path, CAIRO_PATH_OP_CLOSE_PATH, NULL, 0);
if (status)
return status;
path->current_point.x = path->last_move_point.x;
path->current_point.y = path->last_move_point.y;
path->has_current_point = 1;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_path_current_point (cairo_path_t *path, cairo_point_t *point)
{
if (! path->has_current_point)
return CAIRO_STATUS_NO_CURRENT_POINT;
*point = path->current_point;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_path_add (cairo_path_t *path, cairo_path_op_t op, cairo_point_t *points, int num_points)
{
cairo_status_t status;
if (path->op_tail == NULL || path->op_tail->num_ops + 1 > CAIRO_PATH_BUF_SZ) {
status = _cairo_path_new_op_buf (path);
if (status)
return status;
}
_cairo_path_op_buf_add (path->op_tail, op);
if (path->arg_tail == NULL || path->arg_tail->num_points + num_points > CAIRO_PATH_BUF_SZ) {
status = _cairo_path_new_arg_buf (path);
if (status)
return status;
}
_cairo_path_arg_buf_add (path->arg_tail, points, num_points);
return CAIRO_STATUS_SUCCESS;
}
static void
_cairo_path_add_op_buf (cairo_path_t *path, cairo_path_op_buf_t *op)
{
op->next = NULL;
op->prev = path->op_tail;
if (path->op_tail) {
path->op_tail->next = op;
} else {
path->op_head = op;
}
path->op_tail = op;
}
static cairo_status_t
_cairo_path_new_op_buf (cairo_path_t *path)
{
cairo_path_op_buf_t *op;
op = _cairo_path_op_buf_create ();
if (op == NULL)
return CAIRO_STATUS_NO_MEMORY;
_cairo_path_add_op_buf (path, op);
return CAIRO_STATUS_SUCCESS;
}
static void
_cairo_path_add_arg_buf (cairo_path_t *path, cairo_path_arg_buf_t *arg)
{
arg->next = NULL;
arg->prev = path->arg_tail;
if (path->arg_tail) {
path->arg_tail->next = arg;
} else {
path->arg_head = arg;
}
path->arg_tail = arg;
}
static cairo_status_t
_cairo_path_new_arg_buf (cairo_path_t *path)
{
cairo_path_arg_buf_t *arg;
arg = _cairo_path_arg_buf_create ();
if (arg == NULL)
return CAIRO_STATUS_NO_MEMORY;
_cairo_path_add_arg_buf (path, arg);
return CAIRO_STATUS_SUCCESS;
}
static cairo_path_op_buf_t *
_cairo_path_op_buf_create (void)
{
cairo_path_op_buf_t *op;
op = malloc (sizeof (cairo_path_op_buf_t));
if (op) {
op->num_ops = 0;
op->next = NULL;
}
return op;
}
static void
_cairo_path_op_buf_destroy (cairo_path_op_buf_t *op)
{
free (op);
}
static void
_cairo_path_op_buf_add (cairo_path_op_buf_t *op_buf, cairo_path_op_t op)
{
op_buf->op[op_buf->num_ops++] = op;
}
static cairo_path_arg_buf_t *
_cairo_path_arg_buf_create (void)
{
cairo_path_arg_buf_t *arg;
arg = malloc (sizeof (cairo_path_arg_buf_t));
if (arg) {
arg->num_points = 0;
arg->next = NULL;
}
return arg;
}
static void
_cairo_path_arg_buf_destroy (cairo_path_arg_buf_t *arg)
{
free (arg);
}
static void
_cairo_path_arg_buf_add (cairo_path_arg_buf_t *arg, cairo_point_t *points, int num_points)
{
int i;
for (i=0; i < num_points; i++) {
arg->points[arg->num_points++] = points[i];
}
}
#define CAIRO_PATH_OP_MAX_ARGS 3
static int const num_args[] =
{
1, /* cairo_path_move_to */
1, /* cairo_path_op_line_to */
3, /* cairo_path_op_curve_to */
0, /* cairo_path_op_close_path */
};
cairo_status_t
_cairo_path_interpret (cairo_path_t *path,
cairo_direction_t dir,
cairo_path_move_to_func_t *move_to,
cairo_path_line_to_func_t *line_to,
cairo_path_curve_to_func_t *curve_to,
cairo_path_close_path_func_t *close_path,
void *closure)
{
cairo_status_t status;
int i, arg;
cairo_path_op_buf_t *op_buf;
cairo_path_op_t op;
cairo_path_arg_buf_t *arg_buf = path->arg_head;
int buf_i = 0;
cairo_point_t point[CAIRO_PATH_OP_MAX_ARGS];
int step = (dir == CAIRO_DIRECTION_FORWARD) ? 1 : -1;
for (op_buf = (dir == CAIRO_DIRECTION_FORWARD) ? path->op_head : path->op_tail;
op_buf;
op_buf = (dir == CAIRO_DIRECTION_FORWARD) ? op_buf->next : op_buf->prev)
{
int start, stop;
if (dir == CAIRO_DIRECTION_FORWARD) {
start = 0;
stop = op_buf->num_ops;
} else {
start = op_buf->num_ops - 1;
stop = -1;
}
for (i=start; i != stop; i += step) {
op = op_buf->op[i];
if (dir == CAIRO_DIRECTION_REVERSE) {
if (buf_i == 0) {
arg_buf = arg_buf->prev;
buf_i = arg_buf->num_points;
}
buf_i -= num_args[op];
}
for (arg = 0; arg < num_args[op]; arg++) {
point[arg] = arg_buf->points[buf_i];
buf_i++;
if (buf_i >= arg_buf->num_points) {
arg_buf = arg_buf->next;
buf_i = 0;
}
}
if (dir == CAIRO_DIRECTION_REVERSE) {
buf_i -= num_args[op];
}
switch (op) {
case CAIRO_PATH_OP_MOVE_TO:
status = (*move_to) (closure, &point[0]);
break;
case CAIRO_PATH_OP_LINE_TO:
status = (*line_to) (closure, &point[0]);
break;
case CAIRO_PATH_OP_CURVE_TO:
status = (*curve_to) (closure, &point[0], &point[1], &point[2]);
break;
case CAIRO_PATH_OP_CLOSE_PATH:
default:
status = (*close_path) (closure);
break;
}
if (status)
return status;
}
}
return CAIRO_STATUS_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,182 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2003 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
typedef struct cairo_path_bounder {
int has_point;
cairo_fixed_t min_x;
cairo_fixed_t min_y;
cairo_fixed_t max_x;
cairo_fixed_t max_y;
} cairo_path_bounder_t;
static void
_cairo_path_bounder_init (cairo_path_bounder_t *bounder);
static void
_cairo_path_bounder_fini (cairo_path_bounder_t *bounder);
static cairo_status_t
_cairo_path_bounder_add_point (cairo_path_bounder_t *bounder, cairo_point_t *point);
static cairo_status_t
_cairo_path_bounder_move_to (void *closure, cairo_point_t *point);
static cairo_status_t
_cairo_path_bounder_line_to (void *closure, cairo_point_t *point);
static cairo_status_t
_cairo_path_bounder_curve_to (void *closure,
cairo_point_t *b,
cairo_point_t *c,
cairo_point_t *d);
static cairo_status_t
_cairo_path_bounder_close_path (void *closure);
static void
_cairo_path_bounder_init (cairo_path_bounder_t *bounder)
{
bounder->has_point = 0;
}
static void
_cairo_path_bounder_fini (cairo_path_bounder_t *bounder)
{
bounder->has_point = 0;
}
static cairo_status_t
_cairo_path_bounder_add_point (cairo_path_bounder_t *bounder, cairo_point_t *point)
{
if (bounder->has_point) {
if (point->x < bounder->min_x)
bounder->min_x = point->x;
if (point->y < bounder->min_y)
bounder->min_y = point->y;
if (point->x > bounder->max_x)
bounder->max_x = point->x;
if (point->y > bounder->max_y)
bounder->max_y = point->y;
} else {
bounder->min_x = point->x;
bounder->min_y = point->y;
bounder->max_x = point->x;
bounder->max_y = point->y;
bounder->has_point = 1;
}
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_path_bounder_move_to (void *closure, cairo_point_t *point)
{
cairo_path_bounder_t *bounder = closure;
_cairo_path_bounder_add_point (bounder, point);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_path_bounder_line_to (void *closure, cairo_point_t *point)
{
cairo_path_bounder_t *bounder = closure;
_cairo_path_bounder_add_point (bounder, point);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_path_bounder_curve_to (void *closure,
cairo_point_t *b,
cairo_point_t *c,
cairo_point_t *d)
{
cairo_path_bounder_t *bounder = closure;
_cairo_path_bounder_add_point (bounder, b);
_cairo_path_bounder_add_point (bounder, c);
_cairo_path_bounder_add_point (bounder, d);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_path_bounder_close_path (void *closure)
{
return CAIRO_STATUS_SUCCESS;
}
/* XXX: Perhaps this should compute a PixRegion rather than 4 doubles */
cairo_status_t
_cairo_path_bounds (cairo_path_t *path, double *x1, double *y1, double *x2, double *y2)
{
cairo_status_t status;
cairo_path_bounder_t bounder;
_cairo_path_bounder_init (&bounder);
status = _cairo_path_interpret (path, CAIRO_DIRECTION_FORWARD,
_cairo_path_bounder_move_to,
_cairo_path_bounder_line_to,
_cairo_path_bounder_curve_to,
_cairo_path_bounder_close_path,
&bounder);
if (status) {
*x1 = *y1 = *x2 = *y2 = 0.0;
_cairo_path_bounder_fini (&bounder);
return status;
}
*x1 = _cairo_fixed_to_double (bounder.min_x);
*y1 = _cairo_fixed_to_double (bounder.min_y);
*x2 = _cairo_fixed_to_double (bounder.max_x);
*y2 = _cairo_fixed_to_double (bounder.max_y);
_cairo_path_bounder_fini (&bounder);
return CAIRO_STATUS_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,206 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
typedef struct cairo_filler {
cairo_gstate_t *gstate;
cairo_traps_t *traps;
cairo_point_t current_point;
cairo_polygon_t polygon;
} cairo_filler_t;
static void
_cairo_filler_init (cairo_filler_t *filler, cairo_gstate_t *gstate, cairo_traps_t *traps);
static void
_cairo_filler_fini (cairo_filler_t *filler);
static cairo_status_t
_cairo_filler_move_to (void *closure, cairo_point_t *point);
static cairo_status_t
_cairo_filler_line_to (void *closure, cairo_point_t *point);
static cairo_status_t
_cairo_filler_curve_to (void *closure,
cairo_point_t *b,
cairo_point_t *c,
cairo_point_t *d);
static cairo_status_t
_cairo_filler_close_path (void *closure);
static void
_cairo_filler_init (cairo_filler_t *filler, cairo_gstate_t *gstate, cairo_traps_t *traps)
{
filler->gstate = gstate;
filler->traps = traps;
filler->current_point.x = 0;
filler->current_point.y = 0;
_cairo_polygon_init (&filler->polygon);
}
static void
_cairo_filler_fini (cairo_filler_t *filler)
{
_cairo_polygon_fini (&filler->polygon);
}
static cairo_status_t
_cairo_filler_move_to (void *closure, cairo_point_t *point)
{
cairo_status_t status;
cairo_filler_t *filler = closure;
cairo_polygon_t *polygon = &filler->polygon;
status = _cairo_polygon_close (polygon);
if (status)
return status;
status = _cairo_polygon_move_to (polygon, point);
if (status)
return status;
filler->current_point = *point;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_filler_line_to (void *closure, cairo_point_t *point)
{
cairo_status_t status;
cairo_filler_t *filler = closure;
cairo_polygon_t *polygon = &filler->polygon;
status = _cairo_polygon_line_to (polygon, point);
if (status)
return status;
filler->current_point = *point;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_filler_curve_to (void *closure,
cairo_point_t *b,
cairo_point_t *c,
cairo_point_t *d)
{
int i;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_filler_t *filler = closure;
cairo_polygon_t *polygon = &filler->polygon;
cairo_gstate_t *gstate = filler->gstate;
cairo_spline_t spline;
status = _cairo_spline_init (&spline, &filler->current_point, b, c, d);
if (status == CAIRO_INT_STATUS_DEGENERATE)
return CAIRO_STATUS_SUCCESS;
_cairo_spline_decompose (&spline, gstate->tolerance);
if (status)
goto CLEANUP_SPLINE;
for (i = 1; i < spline.num_points; i++) {
status = _cairo_polygon_line_to (polygon, &spline.points[i]);
if (status)
break;
}
CLEANUP_SPLINE:
_cairo_spline_fini (&spline);
filler->current_point = *d;
return status;
}
static cairo_status_t
_cairo_filler_close_path (void *closure)
{
cairo_status_t status;
cairo_filler_t *filler = closure;
cairo_polygon_t *polygon = &filler->polygon;
status = _cairo_polygon_close (polygon);
if (status)
return status;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_filler_t filler;
_cairo_filler_init (&filler, gstate, traps);
status = _cairo_path_interpret (path,
CAIRO_DIRECTION_FORWARD,
_cairo_filler_move_to,
_cairo_filler_line_to,
_cairo_filler_curve_to,
_cairo_filler_close_path,
&filler);
if (status)
goto BAIL;
status = _cairo_polygon_close (&filler.polygon);
if (status)
goto BAIL;
status = _cairo_traps_tessellate_polygon (filler.traps,
&filler.polygon,
filler.gstate->fill_rule);
if (status)
goto BAIL;
BAIL:
_cairo_filler_fini (&filler);
return status;
}

Просмотреть файл

@ -0,0 +1,848 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
typedef struct cairo_stroker {
cairo_gstate_t *gstate;
cairo_traps_t *traps;
int has_current_point;
cairo_point_t current_point;
cairo_point_t first_point;
int has_current_face;
cairo_stroke_face_t current_face;
int has_first_face;
cairo_stroke_face_t first_face;
int dashed;
int dash_index;
int dash_on;
double dash_remain;
} cairo_stroker_t;
/* private functions */
static void
_cairo_stroker_init (cairo_stroker_t *stroker, cairo_gstate_t *gstate, cairo_traps_t *traps);
static void
_cairo_stroker_fini (cairo_stroker_t *stroker);
static cairo_status_t
_cairo_stroker_move_to (void *closure, cairo_point_t *point);
static cairo_status_t
_cairo_stroker_line_to (void *closure, cairo_point_t *point);
static cairo_status_t
_cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point);
static cairo_status_t
_cairo_stroker_curve_to (void *closure,
cairo_point_t *b,
cairo_point_t *c,
cairo_point_t *d);
static cairo_status_t
_cairo_stroker_close_path (void *closure);
static void
_translate_point (cairo_point_t *point, cairo_point_t *offset);
static int
_cairo_stroker_face_clockwise (cairo_stroke_face_t *in, cairo_stroke_face_t *out);
static cairo_status_t
_cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in, cairo_stroke_face_t *out);
static void
_cairo_stroker_start_dash (cairo_stroker_t *stroker)
{
cairo_gstate_t *gstate = stroker->gstate;
double offset;
int on = 1;
int i = 0;
offset = gstate->dash_offset;
while (offset >= gstate->dash[i]) {
offset -= gstate->dash[i];
on = 1-on;
if (++i == gstate->num_dashes)
i = 0;
}
stroker->dashed = 1;
stroker->dash_index = i;
stroker->dash_on = on;
stroker->dash_remain = gstate->dash[i] - offset;
}
static void
_cairo_stroker_step_dash (cairo_stroker_t *stroker, double step)
{
cairo_gstate_t *gstate = stroker->gstate;
stroker->dash_remain -= step;
if (stroker->dash_remain <= 0) {
stroker->dash_index++;
if (stroker->dash_index == gstate->num_dashes)
stroker->dash_index = 0;
stroker->dash_on = 1-stroker->dash_on;
stroker->dash_remain = gstate->dash[stroker->dash_index];
}
}
static void
_cairo_stroker_init (cairo_stroker_t *stroker, cairo_gstate_t *gstate, cairo_traps_t *traps)
{
stroker->gstate = gstate;
stroker->traps = traps;
stroker->has_current_point = 0;
stroker->has_current_face = 0;
stroker->has_first_face = 0;
if (gstate->dash)
_cairo_stroker_start_dash (stroker);
else
stroker->dashed = 0;
}
static void
_cairo_stroker_fini (cairo_stroker_t *stroker)
{
/* nothing to do here */
}
static void
_translate_point (cairo_point_t *point, cairo_point_t *offset)
{
point->x += offset->x;
point->y += offset->y;
}
static int
_cairo_stroker_face_clockwise (cairo_stroke_face_t *in, cairo_stroke_face_t *out)
{
cairo_slope_t in_slope, out_slope;
_cairo_slope_init (&in_slope, &in->point, &in->cw);
_cairo_slope_init (&out_slope, &out->point, &out->cw);
return _cairo_slope_clockwise (&in_slope, &out_slope);
}
static cairo_status_t
_cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in, cairo_stroke_face_t *out)
{
cairo_status_t status;
cairo_gstate_t *gstate = stroker->gstate;
int clockwise = _cairo_stroker_face_clockwise (out, in);
cairo_point_t *inpt, *outpt;
if (in->cw.x == out->cw.x
&& in->cw.y == out->cw.y
&& in->ccw.x == out->ccw.x
&& in->ccw.y == out->ccw.y) {
return CAIRO_STATUS_SUCCESS;
}
if (clockwise) {
inpt = &in->ccw;
outpt = &out->ccw;
} else {
inpt = &in->cw;
outpt = &out->cw;
}
switch (gstate->line_join) {
case CAIRO_LINE_JOIN_ROUND: {
int i;
int start, step, stop;
cairo_point_t tri[3];
cairo_pen_t *pen = &gstate->pen_regular;
tri[0] = in->point;
if (clockwise) {
_cairo_pen_find_active_ccw_vertex_index (pen, &in->dev_vector, &start);
step = -1;
_cairo_pen_find_active_ccw_vertex_index (pen, &out->dev_vector, &stop);
} else {
_cairo_pen_find_active_cw_vertex_index (pen, &in->dev_vector, &start);
step = +1;
_cairo_pen_find_active_cw_vertex_index (pen, &out->dev_vector, &stop);
}
i = start;
tri[1] = *inpt;
while (i != stop) {
tri[2] = in->point;
_translate_point (&tri[2], &pen->vertices[i].point);
_cairo_traps_tessellate_triangle (stroker->traps, tri);
tri[1] = tri[2];
i += step;
if (i < 0)
i = pen->num_vertices - 1;
if (i >= pen->num_vertices)
i = 0;
}
tri[2] = *outpt;
return _cairo_traps_tessellate_triangle (stroker->traps, tri);
}
case CAIRO_LINE_JOIN_MITER:
default: {
/* dot product of incoming slope vector with outgoing slope vector */
double in_dot_out = ((-in->usr_vector.x * out->usr_vector.x)+
(-in->usr_vector.y * out->usr_vector.y));
double ml = gstate->miter_limit;
/*
* Check the miter limit -- lines meeting at an acute angle
* can generate long miters, the limit converts them to bevel
*
* We want to know when the miter is within the miter limit.
* That's straightforward to specify:
*
* secant (psi / 2) <= ml
*
* where psi is the angle between in and out
*
* secant(psi/2) = 1/sin(psi/2)
* 1/sin(psi/2) <= ml
* 1 <= ml sin(psi/2)
* 1 <= ml² sin²(psi/2)
* 2 <= ml² 2 sin²(psi/2)
* 2·sin²(psi/2) = 1-cos(psi)
* 2 <= ml² (1-cos(psi))
*
* in · out = |in| |out| cos (psi)
*
* in and out are both unit vectors, so:
*
* in · out = cos (psi)
*
* 2 <= ml² (1 - in · out)
*
*/
if (2 <= ml * ml * (1 - in_dot_out)) {
double x1, y1, x2, y2;
double mx, my;
double dx1, dx2, dy1, dy2;
cairo_polygon_t polygon;
cairo_point_t outer;
/*
* we've got the points already transformed to device
* space, but need to do some computation with them and
* also need to transform the slope from user space to
* device space
*/
/* outer point of incoming line face */
x1 = _cairo_fixed_to_double (inpt->x);
y1 = _cairo_fixed_to_double (inpt->y);
dx1 = in->usr_vector.x;
dy1 = in->usr_vector.y;
cairo_matrix_transform_distance (&gstate->ctm, &dx1, &dy1);
/* outer point of outgoing line face */
x2 = _cairo_fixed_to_double (outpt->x);
y2 = _cairo_fixed_to_double (outpt->y);
dx2 = out->usr_vector.x;
dy2 = out->usr_vector.y;
cairo_matrix_transform_distance (&gstate->ctm, &dx2, &dy2);
/*
* Compute the location of the outer corner of the miter.
* That's pretty easy -- just the intersection of the two
* outer edges. We've got slopes and points on each
* of those edges. Compute my directly, then compute
* mx by using the edge with the larger dy; that avoids
* dividing by values close to zero.
*/
my = (((x2 - x1) * dy1 * dy2 - y2 * dx2 * dy1 + y1 * dx1 * dy2) /
(dx1 * dy2 - dx2 * dy1));
if (fabs (dy1) >= fabs (dy2))
mx = (my - y1) * dx1 / dy1 + x1;
else
mx = (my - y2) * dx2 / dy2 + x2;
/*
* Draw the quadrilateral
*/
outer.x = _cairo_fixed_from_double (mx);
outer.y = _cairo_fixed_from_double (my);
_cairo_polygon_init (&polygon);
_cairo_polygon_move_to (&polygon, &in->point);
_cairo_polygon_line_to (&polygon, inpt);
_cairo_polygon_line_to (&polygon, &outer);
_cairo_polygon_line_to (&polygon, outpt);
_cairo_polygon_close (&polygon);
status = _cairo_traps_tessellate_polygon (stroker->traps,
&polygon,
CAIRO_FILL_RULE_WINDING);
_cairo_polygon_fini (&polygon);
return status;
}
/* fall through ... */
}
case CAIRO_LINE_JOIN_BEVEL: {
cairo_point_t tri[3];
tri[0] = in->point;
tri[1] = *inpt;
tri[2] = *outpt;
return _cairo_traps_tessellate_triangle (stroker->traps, tri);
}
}
}
static cairo_status_t
_cairo_stroker_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f)
{
cairo_status_t status;
cairo_gstate_t *gstate = stroker->gstate;
if (gstate->line_cap == CAIRO_LINE_CAP_BUTT)
return CAIRO_STATUS_SUCCESS;
switch (gstate->line_cap) {
case CAIRO_LINE_CAP_ROUND: {
int i;
int start, stop;
cairo_slope_t slope;
cairo_point_t tri[3];
cairo_pen_t *pen = &gstate->pen_regular;
slope = f->dev_vector;
_cairo_pen_find_active_cw_vertex_index (pen, &slope, &start);
slope.dx = -slope.dx;
slope.dy = -slope.dy;
_cairo_pen_find_active_cw_vertex_index (pen, &slope, &stop);
tri[0] = f->point;
tri[1] = f->cw;
for (i=start; i != stop; i = (i+1) % pen->num_vertices) {
tri[2] = f->point;
_translate_point (&tri[2], &pen->vertices[i].point);
_cairo_traps_tessellate_triangle (stroker->traps, tri);
tri[1] = tri[2];
}
tri[2] = f->ccw;
return _cairo_traps_tessellate_triangle (stroker->traps, tri);
}
case CAIRO_LINE_CAP_SQUARE: {
double dx, dy;
cairo_slope_t fvector;
cairo_point_t occw, ocw;
cairo_polygon_t polygon;
dx = f->usr_vector.x;
dy = f->usr_vector.y;
dx *= gstate->line_width / 2.0;
dy *= gstate->line_width / 2.0;
cairo_matrix_transform_distance (&gstate->ctm, &dx, &dy);
fvector.dx = _cairo_fixed_from_double (dx);
fvector.dy = _cairo_fixed_from_double (dy);
occw.x = f->ccw.x + fvector.dx;
occw.y = f->ccw.y + fvector.dy;
ocw.x = f->cw.x + fvector.dx;
ocw.y = f->cw.y + fvector.dy;
_cairo_polygon_init (&polygon);
_cairo_polygon_move_to (&polygon, &f->cw);
_cairo_polygon_line_to (&polygon, &ocw);
_cairo_polygon_line_to (&polygon, &occw);
_cairo_polygon_line_to (&polygon, &f->ccw);
_cairo_polygon_close (&polygon);
status = _cairo_traps_tessellate_polygon (stroker->traps, &polygon, CAIRO_FILL_RULE_WINDING);
_cairo_polygon_fini (&polygon);
return status;
}
case CAIRO_LINE_CAP_BUTT:
default:
return CAIRO_STATUS_SUCCESS;
}
}
static void
_compute_face (cairo_point_t *point, cairo_slope_t *slope, cairo_gstate_t *gstate, cairo_stroke_face_t *face)
{
double mag, det;
double line_dx, line_dy;
double face_dx, face_dy;
cairo_point_double_t usr_vector;
cairo_point_t offset_ccw, offset_cw;
line_dx = _cairo_fixed_to_double (slope->dx);
line_dy = _cairo_fixed_to_double (slope->dy);
/* faces are normal in user space, not device space */
cairo_matrix_transform_distance (&gstate->ctm_inverse, &line_dx, &line_dy);
mag = sqrt (line_dx * line_dx + line_dy * line_dy);
if (mag == 0) {
/* XXX: Can't compute other face points. Do we want a tag in the face for this case? */
return;
}
/* normalize to unit length */
line_dx /= mag;
line_dy /= mag;
usr_vector.x = line_dx;
usr_vector.y = line_dy;
/*
* rotate to get a line_width/2 vector along the face, note that
* the vector must be rotated the right direction in device space,
* but by 90° in user space. So, the rotation depends on
* whether the ctm reflects or not, and that can be determined
* by looking at the determinant of the matrix.
*/
_cairo_matrix_compute_determinant (&gstate->ctm, &det);
if (det >= 0)
{
face_dx = - line_dy * (gstate->line_width / 2.0);
face_dy = line_dx * (gstate->line_width / 2.0);
}
else
{
face_dx = line_dy * (gstate->line_width / 2.0);
face_dy = - line_dx * (gstate->line_width / 2.0);
}
/* back to device space */
cairo_matrix_transform_distance (&gstate->ctm, &face_dx, &face_dy);
offset_ccw.x = _cairo_fixed_from_double (face_dx);
offset_ccw.y = _cairo_fixed_from_double (face_dy);
offset_cw.x = -offset_ccw.x;
offset_cw.y = -offset_ccw.y;
face->ccw = *point;
_translate_point (&face->ccw, &offset_ccw);
face->point = *point;
face->cw = *point;
_translate_point (&face->cw, &offset_cw);
face->usr_vector.x = usr_vector.x;
face->usr_vector.y = usr_vector.y;
face->dev_vector = *slope;
}
static cairo_status_t
_cairo_stroker_add_sub_edge (cairo_stroker_t *stroker, cairo_point_t *p1, cairo_point_t *p2,
cairo_stroke_face_t *start, cairo_stroke_face_t *end)
{
cairo_status_t status;
cairo_gstate_t *gstate = stroker->gstate;
cairo_polygon_t polygon;
cairo_slope_t slope;
if (p1->x == p2->x && p1->y == p2->y) {
/* XXX: Need to rethink how this case should be handled, (both
here and in _compute_face). The key behavior is that
degenerate paths should draw as much as possible. */
return CAIRO_STATUS_SUCCESS;
}
_cairo_slope_init (&slope, p1, p2);
_compute_face (p1, &slope, gstate, start);
/* XXX: This could be optimized slightly by not calling
_compute_face again but rather translating the relevant
fields from start. */
_compute_face (p2, &slope, gstate, end);
/* XXX: I should really check the return value of the
move_to/line_to functions here to catch out of memory
conditions. But since that would be ugly, I'd prefer to add a
status flag to the polygon object that I could check only once
at then end of this sequence, (like we do with cairo_t
already). */
_cairo_polygon_init (&polygon);
_cairo_polygon_move_to (&polygon, &start->cw);
_cairo_polygon_line_to (&polygon, &start->ccw);
_cairo_polygon_line_to (&polygon, &end->ccw);
_cairo_polygon_line_to (&polygon, &end->cw);
_cairo_polygon_close (&polygon);
/* XXX: We can't use tessellate_rectangle as the matrix may have
skewed this into a non-rectangular shape. Perhaps it would be
worth checking the matrix for skew so that the common case
could use the faster tessellate_rectangle rather than
tessellate_polygon? */
status = _cairo_traps_tessellate_polygon (stroker->traps,
&polygon, CAIRO_FILL_RULE_WINDING);
_cairo_polygon_fini (&polygon);
return status;
}
static cairo_status_t
_cairo_stroker_move_to (void *closure, cairo_point_t *point)
{
cairo_stroker_t *stroker = closure;
stroker->first_point = *point;
stroker->current_point = *point;
stroker->has_current_point = 1;
stroker->has_first_face = 0;
stroker->has_current_face = 0;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_stroker_line_to (void *closure, cairo_point_t *point)
{
cairo_status_t status;
cairo_stroker_t *stroker = closure;
cairo_stroke_face_t start, end;
cairo_point_t *p1 = &stroker->current_point;
cairo_point_t *p2 = point;
if (!stroker->has_current_point)
return _cairo_stroker_move_to (stroker, point);
if (p1->x == p2->x && p1->y == p2->y) {
/* XXX: Need to rethink how this case should be handled, (both
here and in cairo_stroker_add_sub_edge and in _compute_face). The
key behavior is that degenerate paths should draw as much
as possible. */
return CAIRO_STATUS_SUCCESS;
}
status = _cairo_stroker_add_sub_edge (stroker, p1, p2, &start, &end);
if (status)
return status;
if (stroker->has_current_face) {
status = _cairo_stroker_join (stroker, &stroker->current_face, &start);
if (status)
return status;
} else {
if (!stroker->has_first_face) {
stroker->first_face = start;
stroker->has_first_face = 1;
}
}
stroker->current_face = end;
stroker->has_current_face = 1;
stroker->current_point = *point;
return CAIRO_STATUS_SUCCESS;
}
/*
* Dashed lines. Cap each dash end, join around turns when on
*/
static cairo_status_t
_cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_stroker_t *stroker = closure;
cairo_gstate_t *gstate = stroker->gstate;
double mag, remain, tmp;
double dx, dy;
double dx2, dy2;
cairo_point_t fd1, fd2;
int first = 1;
cairo_stroke_face_t sub_start, sub_end;
cairo_point_t *p1 = &stroker->current_point;
cairo_point_t *p2 = point;
if (!stroker->has_current_point)
return _cairo_stroker_move_to (stroker, point);
dx = _cairo_fixed_to_double (p2->x - p1->x);
dy = _cairo_fixed_to_double (p2->y - p1->y);
cairo_matrix_transform_distance (&gstate->ctm_inverse, &dx, &dy);
mag = sqrt (dx *dx + dy * dy);
remain = mag;
fd1 = *p1;
while (remain) {
tmp = stroker->dash_remain;
if (tmp > remain)
tmp = remain;
remain -= tmp;
dx2 = dx * (mag - remain)/mag;
dy2 = dy * (mag - remain)/mag;
cairo_matrix_transform_distance (&gstate->ctm, &dx2, &dy2);
fd2.x = _cairo_fixed_from_double (dx2);
fd2.y = _cairo_fixed_from_double (dy2);
fd2.x += p1->x;
fd2.y += p1->y;
/*
* XXX simplify this case analysis
*/
if (stroker->dash_on) {
status = _cairo_stroker_add_sub_edge (stroker, &fd1, &fd2, &sub_start, &sub_end);
if (status)
return status;
if (!first) {
/*
* Not first dash in this segment, cap start
*/
status = _cairo_stroker_cap (stroker, &sub_start);
if (status)
return status;
} else {
/*
* First in this segment, join to any current_face, else
* if at start of sub-path, mark position, else
* cap
*/
if (stroker->has_current_face) {
status = _cairo_stroker_join (stroker, &stroker->current_face, &sub_start);
if (status)
return status;
} else {
if (!stroker->has_first_face) {
stroker->first_face = sub_start;
stroker->has_first_face = 1;
} else {
status = _cairo_stroker_cap (stroker, &sub_start);
if (status)
return status;
}
}
}
if (remain) {
/*
* Cap if not at end of segment
*/
status = _cairo_stroker_cap (stroker, &sub_end);
if (status)
return status;
} else {
/*
* Mark previous line face and fix up next time
* through
*/
stroker->current_face = sub_end;
stroker->has_current_face = 1;
}
} else {
/*
* If starting with off dash, check previous face
* and cap if necessary
*/
if (first) {
if (stroker->has_current_face) {
status = _cairo_stroker_cap (stroker, &stroker->current_face);
if (status)
return status;
}
}
if (!remain)
stroker->has_current_face = 0;
}
_cairo_stroker_step_dash (stroker, tmp);
fd1 = fd2;
first = 0;
}
stroker->current_point = *point;
return status;
}
static cairo_status_t
_cairo_stroker_curve_to (void *closure,
cairo_point_t *b,
cairo_point_t *c,
cairo_point_t *d)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_stroker_t *stroker = closure;
cairo_gstate_t *gstate = stroker->gstate;
cairo_spline_t spline;
cairo_pen_t pen;
cairo_stroke_face_t start, end;
cairo_point_t extra_points[4];
cairo_point_t *a = &stroker->current_point;
status = _cairo_spline_init (&spline, a, b, c, d);
if (status == CAIRO_INT_STATUS_DEGENERATE)
return CAIRO_STATUS_SUCCESS;
status = _cairo_pen_init_copy (&pen, &gstate->pen_regular);
if (status)
goto CLEANUP_SPLINE;
_compute_face (a, &spline.initial_slope, gstate, &start);
_compute_face (d, &spline.final_slope, gstate, &end);
if (stroker->has_current_face) {
status = _cairo_stroker_join (stroker, &stroker->current_face, &start);
if (status)
return status;
} else {
if (!stroker->has_first_face) {
stroker->first_face = start;
stroker->has_first_face = 1;
}
}
stroker->current_face = end;
stroker->has_current_face = 1;
extra_points[0] = start.cw;
extra_points[0].x -= start.point.x;
extra_points[0].y -= start.point.y;
extra_points[1] = start.ccw;
extra_points[1].x -= start.point.x;
extra_points[1].y -= start.point.y;
extra_points[2] = end.cw;
extra_points[2].x -= end.point.x;
extra_points[2].y -= end.point.y;
extra_points[3] = end.ccw;
extra_points[3].x -= end.point.x;
extra_points[3].y -= end.point.y;
status = _cairo_pen_add_points (&pen, extra_points, 4);
if (status)
goto CLEANUP_PEN;
status = _cairo_pen_stroke_spline (&pen, &spline, gstate->tolerance, stroker->traps);
if (status)
goto CLEANUP_PEN;
CLEANUP_PEN:
_cairo_pen_fini (&pen);
CLEANUP_SPLINE:
_cairo_spline_fini (&spline);
stroker->current_point = *d;
return status;
}
static cairo_status_t
_cairo_stroker_close_path (void *closure)
{
cairo_status_t status;
cairo_stroker_t *stroker = closure;
if (stroker->has_current_point) {
if (stroker->dashed)
status = _cairo_stroker_line_to_dashed (stroker, &stroker->first_point);
else
status = _cairo_stroker_line_to (stroker, &stroker->first_point);
if (status)
return status;
}
if (stroker->has_first_face && stroker->has_current_face) {
status = _cairo_stroker_join (stroker, &stroker->current_face, &stroker->first_face);
if (status)
return status;
}
stroker->has_first_face = 0;
stroker->has_current_face = 0;
stroker->has_current_point = 0;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_stroker_t stroker;
_cairo_stroker_init (&stroker, gstate, traps);
if (gstate->dash)
status = _cairo_path_interpret (path,
CAIRO_DIRECTION_FORWARD,
_cairo_stroker_move_to,
_cairo_stroker_line_to_dashed,
_cairo_stroker_curve_to,
_cairo_stroker_close_path,
&stroker);
else
status = _cairo_path_interpret (path,
CAIRO_DIRECTION_FORWARD,
_cairo_stroker_move_to,
_cairo_stroker_line_to,
_cairo_stroker_curve_to,
_cairo_stroker_close_path,
&stroker);
if (status)
goto BAIL;
if (stroker.has_first_face) {
cairo_point_t t;
/* The initial cap needs an outward facing vector. Reverse everything */
stroker.first_face.usr_vector.x = -stroker.first_face.usr_vector.x;
stroker.first_face.usr_vector.y = -stroker.first_face.usr_vector.y;
stroker.first_face.dev_vector.dx = -stroker.first_face.dev_vector.dx;
stroker.first_face.dev_vector.dy = -stroker.first_face.dev_vector.dy;
t = stroker.first_face.cw;
stroker.first_face.cw = stroker.first_face.ccw;
stroker.first_face.ccw = t;
status = _cairo_stroker_cap (&stroker, &stroker.first_face);
if (status)
goto BAIL;
}
if (stroker.has_current_face) {
status = _cairo_stroker_cap (&stroker, &stroker.current_face);
if (status)
goto BAIL;
}
BAIL:
_cairo_stroker_fini (&stroker);
return status;
}

Просмотреть файл

@ -0,0 +1,751 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2004 David Reveman
*
* 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 David
* Reveman not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. David Reveman makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL DAVID REVEMAN 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: David Reveman <c99drn@cs.umu.se>
*/
#include "cairoint.h"
#define MULTIPLY_COLORCOMP(c1, c2) \
((unsigned char) \
((((unsigned char) (c1)) * (int) ((unsigned char) (c2))) / 0xff))
void
_cairo_pattern_init (cairo_pattern_t *pattern)
{
pattern->ref_count = 1;
pattern->extend = CAIRO_EXTEND_DEFAULT;
pattern->filter = CAIRO_FILTER_DEFAULT;
_cairo_color_init (&pattern->color);
_cairo_matrix_init (&pattern->matrix);
pattern->stops = NULL;
pattern->n_stops = 0;
pattern->type = CAIRO_PATTERN_SOLID;
pattern->source = NULL;
pattern->source_offset.x = 0.0;
pattern->source_offset.y = 0.0;
}
cairo_status_t
_cairo_pattern_init_copy (cairo_pattern_t *pattern, cairo_pattern_t *other)
{
*pattern = *other;
pattern->ref_count = 1;
if (pattern->n_stops) {
pattern->stops =
malloc (sizeof (cairo_color_stop_t) * pattern->n_stops);
if (pattern->stops == NULL)
return CAIRO_STATUS_NO_MEMORY;
memcpy (pattern->stops, other->stops,
sizeof (cairo_color_stop_t) * other->n_stops);
}
if (pattern->source)
cairo_surface_reference (other->source);
if (pattern->type == CAIRO_PATTERN_SURFACE)
cairo_surface_reference (other->u.surface.surface);
return CAIRO_STATUS_SUCCESS;
}
void
_cairo_pattern_fini (cairo_pattern_t *pattern)
{
if (pattern->n_stops)
free (pattern->stops);
if (pattern->type == CAIRO_PATTERN_SURFACE) {
/* show_surface require us to restore surface matrix, repeat
attribute, filter type */
if (pattern->source) {
cairo_surface_set_matrix (pattern->source,
&pattern->u.surface.save_matrix);
cairo_surface_set_repeat (pattern->source,
pattern->u.surface.save_repeat);
cairo_surface_set_filter (pattern->source,
pattern->u.surface.save_filter);
}
cairo_surface_destroy (pattern->u.surface.surface);
}
if (pattern->source)
cairo_surface_destroy (pattern->source);
}
void
_cairo_pattern_init_solid (cairo_pattern_t *pattern,
double red, double green, double blue)
{
_cairo_pattern_init (pattern);
pattern->type = CAIRO_PATTERN_SOLID;
_cairo_color_set_rgb (&pattern->color, red, green, blue);
}
cairo_pattern_t *
_cairo_pattern_create_solid (double red, double green, double blue)
{
cairo_pattern_t *pattern;
pattern = malloc (sizeof (cairo_pattern_t));
if (pattern == NULL)
return NULL;
_cairo_pattern_init_solid (pattern, red, green, blue);
return pattern;
}
cairo_pattern_t *
cairo_pattern_create_for_surface (cairo_surface_t *surface)
{
cairo_pattern_t *pattern;
pattern = malloc (sizeof (cairo_pattern_t));
if (pattern == NULL)
return NULL;
_cairo_pattern_init (pattern);
pattern->type = CAIRO_PATTERN_SURFACE;
pattern->u.surface.surface = surface;
cairo_surface_reference (surface);
return pattern;
}
cairo_pattern_t *
cairo_pattern_create_linear (double x0, double y0, double x1, double y1)
{
cairo_pattern_t *pattern;
pattern = malloc (sizeof (cairo_pattern_t));
if (pattern == NULL)
return NULL;
_cairo_pattern_init (pattern);
pattern->type = CAIRO_PATTERN_LINEAR;
pattern->u.linear.point0.x = x0;
pattern->u.linear.point0.y = y0;
pattern->u.linear.point1.x = x1;
pattern->u.linear.point1.y = y1;
return pattern;
}
cairo_pattern_t *
cairo_pattern_create_radial (double cx0, double cy0, double radius0,
double cx1, double cy1, double radius1)
{
cairo_pattern_t *pattern;
pattern = malloc (sizeof (cairo_pattern_t));
if (pattern == NULL)
return NULL;
_cairo_pattern_init (pattern);
pattern->type = CAIRO_PATTERN_RADIAL;
pattern->u.radial.center0.x = cx0;
pattern->u.radial.center0.y = cy0;
pattern->u.radial.radius0 = fabs (radius0);
pattern->u.radial.center1.x = cx1;
pattern->u.radial.center1.y = cy1;
pattern->u.radial.radius1 = fabs (radius1);
return pattern;
}
void
cairo_pattern_reference (cairo_pattern_t *pattern)
{
if (pattern == NULL)
return;
pattern->ref_count++;
}
void
cairo_pattern_destroy (cairo_pattern_t *pattern)
{
if (pattern == NULL)
return;
pattern->ref_count--;
if (pattern->ref_count)
return;
_cairo_pattern_fini (pattern);
free (pattern);
}
static int
_cairo_pattern_stop_compare (const void *elem1, const void *elem2)
{
return
(((cairo_color_stop_t *) elem1)->offset ==
((cairo_color_stop_t *) elem2)->offset) ?
/* equal offsets, sort on id */
((((cairo_color_stop_t *) elem1)->id <
((cairo_color_stop_t *) elem2)->id) ? -1 : 1) :
/* sort on offset */
((((cairo_color_stop_t *) elem1)->offset <
((cairo_color_stop_t *) elem2)->offset) ? -1 : 1);
}
cairo_status_t
cairo_pattern_add_color_stop (cairo_pattern_t *pattern,
double offset,
double red, double green, double blue,
double alpha)
{
cairo_color_stop_t *stop;
int i;
_cairo_restrict_value (&offset, 0.0, 1.0);
_cairo_restrict_value (&red, 0.0, 1.0);
_cairo_restrict_value (&green, 0.0, 1.0);
_cairo_restrict_value (&blue, 0.0, 1.0);
pattern->n_stops++;
pattern->stops = realloc (pattern->stops,
sizeof (cairo_color_stop_t) * pattern->n_stops);
if (pattern->stops == NULL) {
pattern->n_stops = 0;
return CAIRO_STATUS_NO_MEMORY;
}
stop = &pattern->stops[pattern->n_stops - 1];
stop->offset = _cairo_fixed_from_double (offset);
stop->id = pattern->n_stops;
stop->color_char[0] = red * 0xff;
stop->color_char[1] = green * 0xff;
stop->color_char[2] = blue * 0xff;
stop->color_char[3] = alpha * 0xff;
/* sort stops in ascending order */
qsort (pattern->stops, pattern->n_stops, sizeof (cairo_color_stop_t),
_cairo_pattern_stop_compare);
for (i = 0; i < pattern->n_stops - 1; i++) {
pattern->stops[i + 1].scale =
pattern->stops[i + 1].offset - pattern->stops[i].offset;
if (pattern->stops[i + 1].scale == 65536)
pattern->stops[i + 1].scale = 0;
}
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
cairo_pattern_set_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix)
{
cairo_matrix_copy (&pattern->matrix, matrix);
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix)
{
cairo_matrix_copy (matrix, &pattern->matrix);
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter)
{
pattern->filter = filter;
return CAIRO_STATUS_SUCCESS;
}
cairo_filter_t
cairo_pattern_get_filter (cairo_pattern_t *pattern)
{
return pattern->filter;
}
cairo_status_t
cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend)
{
pattern->extend = extend;
return CAIRO_STATUS_SUCCESS;
}
cairo_extend_t
cairo_pattern_get_extend (cairo_pattern_t *pattern)
{
return pattern->extend;
}
cairo_status_t
_cairo_pattern_get_rgb (cairo_pattern_t *pattern,
double *red, double *green, double *blue)
{
_cairo_color_get_rgb (&pattern->color, red, green, blue);
return CAIRO_STATUS_SUCCESS;
}
void
_cairo_pattern_set_alpha (cairo_pattern_t *pattern, double alpha)
{
int i;
_cairo_color_set_alpha (&pattern->color, alpha);
for (i = 0; i < pattern->n_stops; i++)
pattern->stops[i].color_char[3] =
MULTIPLY_COLORCOMP (pattern->stops[i].color_char[3], alpha * 0xff);
}
void
_cairo_pattern_set_source_offset (cairo_pattern_t *pattern,
double x, double y)
{
pattern->source_offset.x = x;
pattern->source_offset.y = y;
}
void
_cairo_pattern_transform (cairo_pattern_t *pattern,
cairo_matrix_t *ctm_inverse)
{
cairo_matrix_multiply (&pattern->matrix, ctm_inverse, &pattern->matrix);
}
void
_cairo_pattern_prepare_surface (cairo_pattern_t *pattern)
{
cairo_matrix_t device_to_source;
cairo_matrix_t user_to_source;
/* should the surface matrix interface be remove from the API?
for now we multiple the surface matrix with the pattern matrix */
cairo_surface_get_matrix (pattern->u.surface.surface, &user_to_source);
cairo_matrix_multiply (&device_to_source, &pattern->matrix,
&user_to_source);
cairo_surface_set_matrix (pattern->source, &device_to_source);
/* storing original surface matrix in pattern */
pattern->u.surface.save_matrix = user_to_source;
/* storing original surface repeat mode in pattern */
pattern->u.surface.save_repeat = pattern->source->repeat;
/* what do we do with extend types pad and reflect? */
if (pattern->extend == CAIRO_EXTEND_REPEAT
|| pattern->source->repeat == 1)
cairo_surface_set_repeat (pattern->source, 1);
else
cairo_surface_set_repeat (pattern->source, 0);
/* storing original surface filter in pattern */
pattern->u.surface.save_filter =
cairo_surface_get_filter (pattern->source);
cairo_surface_set_filter (pattern->source, pattern->filter);
}
#define INTERPOLATE_COLOR_NEAREST(c1, c2, factor) \
((factor < 32768)? c1: c2)
static void
_cairo_pattern_shader_nearest (unsigned char *color0,
unsigned char *color1,
cairo_fixed_t factor,
int *pixel)
{
*pixel =
((INTERPOLATE_COLOR_NEAREST (color0[3], color1[3], factor) << 24) |
(INTERPOLATE_COLOR_NEAREST (color0[0], color1[0], factor) << 16) |
(INTERPOLATE_COLOR_NEAREST (color0[1], color1[1], factor) << 8) |
(INTERPOLATE_COLOR_NEAREST (color0[2], color1[2], factor) << 0));
}
#undef INTERPOLATE_COLOR_NEAREST
#define INTERPOLATE_COLOR_LINEAR(c1, c2, factor) \
(((c2 * factor) + (c1 * (65536 - factor))) / 65536)
static void
_cairo_pattern_shader_linear (unsigned char *color0,
unsigned char *color1,
cairo_fixed_t factor,
int *pixel)
{
*pixel = ((INTERPOLATE_COLOR_LINEAR (color0[3], color1[3], factor) << 24) |
(INTERPOLATE_COLOR_LINEAR (color0[0], color1[0], factor) << 16) |
(INTERPOLATE_COLOR_LINEAR (color0[1], color1[1], factor) << 8) |
(INTERPOLATE_COLOR_LINEAR (color0[2], color1[2], factor) << 0));
}
#define E_MINUS_ONE 1.7182818284590452354
static void
_cairo_pattern_shader_gaussian (unsigned char *color0,
unsigned char *color1,
cairo_fixed_t factor,
int *pixel)
{
double f = ((double) factor) / 65536.0;
factor = (cairo_fixed_t) (((exp (f * f) - 1.0) / E_MINUS_ONE) * 65536);
*pixel = ((INTERPOLATE_COLOR_LINEAR (color0[3], color1[3], factor) << 24) |
(INTERPOLATE_COLOR_LINEAR (color0[0], color1[0], factor) << 16) |
(INTERPOLATE_COLOR_LINEAR (color0[1], color1[1], factor) << 8) |
(INTERPOLATE_COLOR_LINEAR (color0[2], color1[2], factor) << 0));
}
#undef INTERPOLATE_COLOR_LINEAR
void
_cairo_pattern_shader_init (cairo_pattern_t *pattern,
cairo_shader_op_t *op)
{
op->stops = pattern->stops;
op->n_stops = pattern->n_stops - 1;
op->min_offset = pattern->stops[0].offset;
op->max_offset = pattern->stops[op->n_stops].offset;
op->extend = pattern->extend;
switch (pattern->filter) {
case CAIRO_FILTER_FAST:
case CAIRO_FILTER_NEAREST:
op->shader_function = _cairo_pattern_shader_nearest;
break;
case CAIRO_FILTER_GAUSSIAN:
op->shader_function = _cairo_pattern_shader_gaussian;
break;
case CAIRO_FILTER_GOOD:
case CAIRO_FILTER_BEST:
case CAIRO_FILTER_BILINEAR:
op->shader_function = _cairo_pattern_shader_linear;
break;
}
}
void
_cairo_pattern_calc_color_at_pixel (cairo_shader_op_t *op,
cairo_fixed_t factor,
int *pixel)
{
int i;
switch (op->extend) {
case CAIRO_EXTEND_REPEAT:
factor -= factor & 0xffff0000;
break;
case CAIRO_EXTEND_REFLECT:
if (factor < 0 || factor > 65536) {
if ((factor >> 16) % 2)
factor = 65536 - (factor - (factor & 0xffff0000));
else
factor -= factor & 0xffff0000;
}
break;
case CAIRO_EXTEND_NONE:
break;
}
if (factor < op->min_offset)
factor = op->min_offset;
else if (factor > op->max_offset)
factor = op->max_offset;
for (i = 0; i < op->n_stops; i++) {
if (factor <= op->stops[i + 1].offset) {
/* take offset as new 0 of coordinate system */
factor -= op->stops[i].offset;
/* difference between two offsets == 0, abrubt change */
if (op->stops[i + 1].scale)
factor = ((cairo_fixed_48_16_t) factor << 16) /
op->stops[i + 1].scale;
op->shader_function (op->stops[i].color_char,
op->stops[i + 1].color_char,
factor, pixel);
/* multiply alpha */
if (((unsigned char) (*pixel >> 24)) != 0xff) {
*pixel = (*pixel & 0xff000000) |
(MULTIPLY_COLORCOMP (*pixel >> 16, *pixel >> 24) << 16) |
(MULTIPLY_COLORCOMP (*pixel >> 8, *pixel >> 24) << 8) |
(MULTIPLY_COLORCOMP (*pixel >> 0, *pixel >> 24) << 0);
}
break;
}
}
}
static void
_cairo_image_data_set_linear (cairo_pattern_t *pattern,
double offset_x,
double offset_y,
int *pixels,
int width,
int height)
{
int x, y;
cairo_point_double_t point0, point1;
double px, py, ex, ey;
double a, b, c, d, tx, ty;
double length, start, angle, fx, fy, factor;
cairo_shader_op_t op;
_cairo_pattern_shader_init (pattern, &op);
point0.x = pattern->u.linear.point0.x;
point0.y = pattern->u.linear.point0.y;
point1.x = pattern->u.linear.point1.x;
point1.y = pattern->u.linear.point1.y;
cairo_matrix_get_affine (&pattern->matrix, &a, &b, &c, &d, &tx, &ty);
length = sqrt ((point1.x - point0.x) * (point1.x - point0.x) +
(point1.y - point0.y) * (point1.y - point0.y));
length = (length) ? 1.0 / length : CAIRO_MAXSHORT;
angle = -atan2 (point1.y - point0.y, point1.x - point0.x);
fx = cos (angle);
fy = -sin (angle);
start = fx * point0.x;
start += fy * point0.y;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
px = x + offset_x;
py = y + offset_y;
/* transform fragment */
ex = a * px + c * py + tx;
ey = b * px + d * py + ty;
factor = ((fx * ex + fy * ey) - start) * length;
_cairo_pattern_calc_color_at_pixel (&op, factor * 65536, pixels++);
}
}
}
static void
_cairo_image_data_set_radial (cairo_pattern_t *pattern,
double offset_x,
double offset_y,
int *pixels,
int width,
int height)
{
int x, y, aligned_circles;
cairo_point_double_t c0, c1;
double px, py, ex, ey;
double a, b, c, d, tx, ty;
double r0, r1, c0_e_x, c0_e_y, c0_e, c1_e_x, c1_e_y, c1_e,
c0_c1_x, c0_c1_y, c0_c1, angle_c0, c1_y, y_x, c0_y, c0_x, r1_2,
denumerator, fraction, factor;
cairo_shader_op_t op;
_cairo_pattern_shader_init (pattern, &op);
c0.x = pattern->u.radial.center0.x;
c0.y = pattern->u.radial.center0.y;
r0 = pattern->u.radial.radius0;
c1.x = pattern->u.radial.center1.x;
c1.y = pattern->u.radial.center1.y;
r1 = pattern->u.radial.radius1;
if (c0.x != c1.x || c0.y != c1.y) {
aligned_circles = 0;
c0_c1_x = c1.x - c0.x;
c0_c1_y = c1.y - c0.y;
c0_c1 = sqrt (c0_c1_x * c0_c1_x + c0_c1_y * c0_c1_y);
r1_2 = r1 * r1;
} else {
aligned_circles = 1;
r1 = 1.0 / (r1 - r0);
r1_2 = c0_c1 = 0.0; /* shut up compiler */
}
cairo_matrix_get_affine (&pattern->matrix, &a, &b, &c, &d, &tx, &ty);
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
px = x + offset_x;
py = y + offset_y;
/* transform fragment */
ex = a * px + c * py + tx;
ey = b * px + d * py + ty;
if (aligned_circles) {
ex = ex - c1.x;
ey = ey - c1.y;
factor = (sqrt (ex * ex + ey * ey) - r0) * r1;
} else {
/*
y (ex, ey)
c0 -------------------+---------- x
\ | __--
\ | __--
\ | __--
\ | __-- r1
\ | __--
c1 --
We need to calulate distance c0->x; the distance from
the inner circle center c0, through fragment position
(ex, ey) to point x where it crosses the outer circle.
From points c0, c1 and (ex, ey) we get angle C0. With
angle C0 we calculate distance c1->y and c0->y and by
knowing c1->y and r1, we also know y->x. Adding y->x to
c0->y gives us c0->x. The gradient offset can then be
calculated as:
offset = (c0->e - r0) / (c0->x - r0)
*/
c0_e_x = ex - c0.x;
c0_e_y = ey - c0.y;
c0_e = sqrt (c0_e_x * c0_e_x + c0_e_y * c0_e_y);
c1_e_x = ex - c1.x;
c1_e_y = ey - c1.y;
c1_e = sqrt (c1_e_x * c1_e_x + c1_e_y * c1_e_y);
denumerator = -2.0 * c0_e * c0_c1;
if (denumerator != 0.0) {
fraction = (c1_e * c1_e - c0_e * c0_e - c0_c1 * c0_c1) /
denumerator;
if (fraction > 1.0)
fraction = 1.0;
else if (fraction < -1.0)
fraction = -1.0;
angle_c0 = acos (fraction);
c0_y = cos (angle_c0) * c0_c1;
c1_y = sin (angle_c0) * c0_c1;
y_x = sqrt (r1_2 - c1_y * c1_y);
c0_x = y_x + c0_y;
factor = (c0_e - r0) / (c0_x - r0);
} else
factor = -r0;
}
_cairo_pattern_calc_color_at_pixel (&op, factor * 65536, pixels++);
}
}
}
cairo_image_surface_t *
_cairo_pattern_get_image (cairo_pattern_t *pattern, cairo_box_t *box)
{
cairo_surface_t *surface;
switch (pattern->type) {
case CAIRO_PATTERN_LINEAR:
case CAIRO_PATTERN_RADIAL: {
char *data;
double x = box->p1.x >> 16;
double y = box->p1.y >> 16;
int width = ((box->p2.x + 65535) >> 16) - (box->p1.x >> 16);
int height = ((box->p2.y + 65535) >> 16) - (box->p1.y >> 16);
data = malloc (width * height * 4);
if (!data)
return NULL;
if (pattern->type == CAIRO_PATTERN_RADIAL)
_cairo_image_data_set_radial (pattern, x, y, (int *) data,
width, height);
else
_cairo_image_data_set_linear (pattern, x, y, (int *) data,
width, height);
_cairo_pattern_set_source_offset (pattern, x, y);
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
width, height,
width * 4);
if (surface)
_cairo_image_surface_assume_ownership_of_data (
(cairo_image_surface_t *) surface);
}
break;
case CAIRO_PATTERN_SOLID:
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
if (surface) {
_cairo_surface_fill_rectangle (surface,
CAIRO_OPERATOR_SRC,
&pattern->color, 0, 0, 1, 1);
cairo_surface_set_repeat (surface, 1);
}
break;
case CAIRO_PATTERN_SURFACE: {
cairo_image_surface_t *image;
image = _cairo_surface_get_image (pattern->u.surface.surface);
if (image)
surface = &image->base;
else
surface = NULL;
}
break;
default:
surface = NULL;
break;
}
return (cairo_image_surface_t *) surface;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,587 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
static int
_cairo_pen_vertices_needed (double tolerance, double radius, cairo_matrix_t *matrix);
static void
_cairo_pen_compute_slopes (cairo_pen_t *pen);
static cairo_status_t
_cairo_pen_stroke_spline_half (cairo_pen_t *pen, cairo_spline_t *spline, cairo_direction_t dir, cairo_polygon_t *polygon);
cairo_status_t
_cairo_pen_init_empty (cairo_pen_t *pen)
{
pen->radius = 0;
pen->tolerance = 0;
pen->vertices = NULL;
pen->num_vertices = 0;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_pen_init (cairo_pen_t *pen, double radius, cairo_gstate_t *gstate)
{
int i;
int reflect;
double det;
if (pen->num_vertices) {
/* XXX: It would be nice to notice that the pen is already properly constructed.
However, this test would also have to account for possible changes in the transformation
matrix.
if (pen->radius == radius && pen->tolerance == tolerance)
return CAIRO_STATUS_SUCCESS;
*/
_cairo_pen_fini (pen);
}
pen->radius = radius;
pen->tolerance = gstate->tolerance;
_cairo_matrix_compute_determinant (&gstate->ctm, &det);
if (det >= 0) {
reflect = 0;
} else {
reflect = 1;
}
pen->num_vertices = _cairo_pen_vertices_needed (gstate->tolerance,
radius,
&gstate->ctm);
pen->vertices = malloc (pen->num_vertices * sizeof (cairo_pen_vertex_t));
if (pen->vertices == NULL) {
return CAIRO_STATUS_NO_MEMORY;
}
/*
* Compute pen coordinates. To generate the right ellipse, compute points around
* a circle in user space and transform them to device space. To get a consistent
* orientation in device space, flip the pen if the transformation matrix
* is reflecting
*/
for (i=0; i < pen->num_vertices; i++) {
double theta = 2 * M_PI * i / (double) pen->num_vertices;
double dx = radius * cos (reflect ? -theta : theta);
double dy = radius * sin (reflect ? -theta : theta);
cairo_pen_vertex_t *v = &pen->vertices[i];
cairo_matrix_transform_distance (&gstate->ctm, &dx, &dy);
v->point.x = _cairo_fixed_from_double (dx);
v->point.y = _cairo_fixed_from_double (dy);
}
_cairo_pen_compute_slopes (pen);
return CAIRO_STATUS_SUCCESS;
}
void
_cairo_pen_fini (cairo_pen_t *pen)
{
free (pen->vertices);
pen->vertices = NULL;
_cairo_pen_init_empty (pen);
}
cairo_status_t
_cairo_pen_init_copy (cairo_pen_t *pen, cairo_pen_t *other)
{
*pen = *other;
if (pen->num_vertices) {
pen->vertices = malloc (pen->num_vertices * sizeof (cairo_pen_vertex_t));
if (pen->vertices == NULL) {
return CAIRO_STATUS_NO_MEMORY;
}
memcpy (pen->vertices, other->vertices, pen->num_vertices * sizeof (cairo_pen_vertex_t));
}
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_pen_add_points (cairo_pen_t *pen, cairo_point_t *point, int num_points)
{
cairo_pen_vertex_t *vertices;
int num_vertices;
int i;
num_vertices = pen->num_vertices + num_points;
vertices = realloc (pen->vertices, num_vertices * sizeof (cairo_pen_vertex_t));
if (vertices == NULL)
return CAIRO_STATUS_NO_MEMORY;
pen->vertices = vertices;
pen->num_vertices = num_vertices;
/* initialize new vertices */
for (i=0; i < num_points; i++)
pen->vertices[pen->num_vertices-num_points+i].point = point[i];
_cairo_hull_compute (pen->vertices, &pen->num_vertices);
_cairo_pen_compute_slopes (pen);
return CAIRO_STATUS_SUCCESS;
}
/*
The circular pen in user space is transformed into an ellipse in
device space.
We construct the pen by computing points along the circumference
using equally spaced angles.
We show below that this approximation to the ellipse has
maximum error at the major axis of the ellipse.
So, we need to compute the length of the major axis and then
use that to compute the number of sides needed in our pen.
Thanks to Walter Brisken <wbrisken@aoc.nrao.edu> for this
derivation:
1. First some notation:
All capital letters represent vectors in two dimensions. A prime '
represents a transformed coordinate. Matrices are written in underlined
form, ie _R_. Lowercase letters represent scalar real values.
The letter t is used to represent the greek letter theta.
2. The question has been posed: What is the maximum expansion factor
achieved by the linear transformation
X' = _R_ X
where _R_ is a real-valued 2x2 matrix with entries:
_R_ = [a b]
[c d] .
In other words, what is the maximum radius, MAX[ |X'| ], reached for any
X on the unit circle ( |X| = 1 ) ?
3. Some useful formulae
(A) through (C) below are standard double-angle formulae. (D) is a lesser
known result and is derived below:
(A) sin^2(t) = (1 - cos(2*t))/2
(B) cos^2(t) = (1 + cos(2*t))/2
(C) sin(t)*cos(t) = sin(2*t)/2
(D) MAX[a*cos(t) + b*sin(t)] = sqrt(a^2 + b^2)
Proof of (D):
find the maximum of the function by setting the derivative to zero:
-a*sin(t)+b*cos(t) = 0
From this it follows that
tan(t) = b/a
and hence
sin(t) = b/sqrt(a^2 + b^2)
and
cos(t) = a/sqrt(a^2 + b^2)
Thus the maximum value is
MAX[a*cos(t) + b*sin(t)] = (a^2 + b^2)/sqrt(a^2 + b^2)
= sqrt(a^2 + b^2)
4. Derivation of maximum expansion
To find MAX[ |X'| ] we search brute force method using calculus. The unit
circle on which X is constrained is to be parameterized by t:
X(t) = (cos(t), sin(t))
Thus
X'(t) = (a*cos(t) + b*sin(t), c*cos(t) + d*sin(t)) .
Define
r(t) = |X'(t)|
Thus
r^2(t) = (a*cos(t) + b*sin(t))^2 + (c*cos(t) + d*sin(t))^2
= (a^2 + c^2)*cos^2(t) + (b^2 + d^2)*sin^2(t)
+ 2*(a*b + c*d)*cos(t)*sin(t)
Now apply the double angle formulae (A) to (C) from above:
r^2(t) = (a^2 + b^2 + c^2 + d^2)/2
+ (a^2 - b^2 + c^2 - d^2)*cos(2*t)/2
+ (a*b + c*d)*sin(2*t)
= f + g*cos(u) + h*sin(u)
Where
f = (a^2 + b^2 + c^2 + d^2)/2
g = (a^2 - b^2 + c^2 - d^2)/2
h = (a*b + c*d)
u = 2*t
It is clear that MAX[ |X'| ] = sqrt(MAX[ r^2 ]). Here we determine MAX[ r^2 ]
using (D) from above:
MAX[ r^2 ] = f + sqrt(g^2 + h^2)
And finally
MAX[ |X'| ] = sqrt( f + sqrt(g^2 + h^2) )
Which is the solution to this problem.
Walter Brisken
2004/10/08
(Note that the minor axis length is at the minimum of the above solution,
which is just sqrt (f - sqrt (g^2 + h^2)) given the symmetry of (D)).
Now to compute how many sides to use for the pen formed by
a regular polygon.
Set
M = major axis length (computed by above formula)
m = minor axis length (computed by above formula)
Align 'M' along the X axis and 'm' along the Y axis and draw
an ellipse parameterized by angle 't':
x = M cos t y = m sin t
Perturb t by ± d and compute two new points (x+,y+), (x-,y-).
The distance from the average of these two points to (x,y) represents
the maximum error in approximating the ellipse with a polygon formed
from vertices 2 radians apart.
x+ = M cos (t+) y+ = m sin (t+)
x- = M cos (t-) y- = m sin (t-)
Now compute the approximation error, E:
Ex = (x - (x+ + x-) / 2)
Ex = (M cos(t) - (Mcos(t+) + Mcos(t-))/2)
= M (cos(t) - (cos(t)cos() + sin(t)sin() +
cos(t)cos() - sin(t)sin())/2)
= M(cos(t) - cos(t)cos())
= M cos(t) (1 - cos())
Ey = y - (y+ - y-) / 2
= m sin (t) - (m sin(t+) + m sin(t-)) / 2
= m (sin(t) - (sin(t)cos() + cos(t)sin() +
sin(t)cos() - cos(t)sin())/2)
= m (sin(t) - sin(t)cos())
= m sin(t) (1 - cos())
E² = Ex² + Ey²
= (M cos(t) (1 - cos ()))² + (m sin(t) (1-cos()))²
= (1 - cos())² (M² cos²(t) + m² sin²(t))
= (1 - cos())² ((m² + M² - m²) cos² (t) + m² sin²(t))
= (1 - cos())² (M² - m²) cos² (t) + (1 - cos())² m²
Find the extremum by differentiation wrt t and setting that to zero
(E²)/(t) = (1-cos())² (M² - m²) (-2 cos(t) sin(t))
0 = 2 cos (t) sin (t)
0 = sin (2t)
t =
Which is to say that the maximum and minimum errors occur on the
axes of the ellipse at 0 and π radians:
E²(0) = (1-cos())² (M² - m²) + (1-cos())² m²
= (1-cos())² M²
E²(π) = (1-cos())² m²
maximum error = M (1-cos())
minimum error = m (1-cos())
We must make maximum error tolerance, so compute the needed:
tolerance = M (1-cos())
tolerance / M = 1 - cos ()
cos() = 1 - tolerance/M
= acos (1 - tolerance / M);
Remembering that is half of our angle between vertices,
the number of vertices is then
vertices = ceil(2π/2).
= ceil(π/).
Note that this also equation works for M == m (a circle) as it
doesn't matter where on the circle the error is computed.
*/
static int
_cairo_pen_vertices_needed (double tolerance,
double radius,
cairo_matrix_t *matrix)
{
double a = matrix->m[0][0], c = matrix->m[0][1];
double b = matrix->m[1][0], d = matrix->m[1][1];
double i = a*a + c*c;
double j = b*b + d*d;
double f = 0.5 * (i + j);
double g = 0.5 * (i - j);
double h = a*b + c*d;
/*
* compute major and minor axes lengths for
* a pen with the specified radius
*/
double major_axis = radius * sqrt (f + sqrt (g*g+h*h));
/*
* we don't need the minor axis length, which is
* double min = radius * sqrt (f - sqrt (g*g+h*h));
*/
/*
* compute number of vertices needed
*/
int num_vertices;
/* Where tolerance / M is > 1, we use 4 points */
if (tolerance >= major_axis) {
num_vertices = 4;
} else {
double delta = acos (1 - tolerance / major_axis);
num_vertices = ceil (M_PI / delta);
/* number of vertices must be even */
if (num_vertices % 2)
num_vertices++;
}
return num_vertices;
}
static void
_cairo_pen_compute_slopes (cairo_pen_t *pen)
{
int i, i_prev;
cairo_pen_vertex_t *prev, *v, *next;
for (i=0, i_prev = pen->num_vertices - 1;
i < pen->num_vertices;
i_prev = i++) {
prev = &pen->vertices[i_prev];
v = &pen->vertices[i];
next = &pen->vertices[(i + 1) % pen->num_vertices];
_cairo_slope_init (&v->slope_cw, &prev->point, &v->point);
_cairo_slope_init (&v->slope_ccw, &v->point, &next->point);
}
}
/*
* Find active pen vertex for clockwise edge of stroke at the given slope.
*
* NOTE: The behavior of this function is sensitive to the sense of
* the inequality within _cairo_slope_clockwise/_cairo_slope_counter_clockwise.
*
* The issue is that the slope_ccw member of one pen vertex will be
* equivalent to the slope_cw member of the next pen vertex in a
* counterclockwise order. However, for this function, we care
* strongly about which vertex is returned.
*/
cairo_status_t
_cairo_pen_find_active_cw_vertex_index (cairo_pen_t *pen,
cairo_slope_t *slope,
int *active)
{
int i;
for (i=0; i < pen->num_vertices; i++) {
if (_cairo_slope_clockwise (slope, &pen->vertices[i].slope_ccw)
&& _cairo_slope_counter_clockwise (slope, &pen->vertices[i].slope_cw))
break;
}
*active = i;
return CAIRO_STATUS_SUCCESS;
}
/* Find active pen vertex for counterclockwise edge of stroke at the given slope.
*
* NOTE: The behavior of this function is sensitive to the sense of
* the inequality within _cairo_slope_clockwise/_cairo_slope_counter_clockwise.
*/
cairo_status_t
_cairo_pen_find_active_ccw_vertex_index (cairo_pen_t *pen,
cairo_slope_t *slope,
int *active)
{
int i;
cairo_slope_t slope_reverse;
slope_reverse = *slope;
slope_reverse.dx = -slope_reverse.dx;
slope_reverse.dy = -slope_reverse.dy;
for (i=pen->num_vertices-1; i >= 0; i--) {
if (_cairo_slope_counter_clockwise (&pen->vertices[i].slope_ccw, &slope_reverse)
&& _cairo_slope_clockwise (&pen->vertices[i].slope_cw, &slope_reverse))
break;
}
*active = i;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_pen_stroke_spline_half (cairo_pen_t *pen,
cairo_spline_t *spline,
cairo_direction_t dir,
cairo_polygon_t *polygon)
{
int i;
cairo_status_t status;
int start, stop, step;
int active = 0;
cairo_point_t hull_point;
cairo_slope_t slope, initial_slope, final_slope;
cairo_point_t *point = spline->points;
int num_points = spline->num_points;
if (dir == CAIRO_DIRECTION_FORWARD) {
start = 0;
stop = num_points;
step = 1;
initial_slope = spline->initial_slope;
final_slope = spline->final_slope;
} else {
start = num_points - 1;
stop = -1;
step = -1;
initial_slope = spline->final_slope;
initial_slope.dx = -initial_slope.dx;
initial_slope.dy = -initial_slope.dy;
final_slope = spline->initial_slope;
final_slope.dx = -final_slope.dx;
final_slope.dy = -final_slope.dy;
}
_cairo_pen_find_active_cw_vertex_index (pen, &initial_slope, &active);
i = start;
while (i != stop) {
hull_point.x = point[i].x + pen->vertices[active].point.x;
hull_point.y = point[i].y + pen->vertices[active].point.y;
status = _cairo_polygon_line_to (polygon, &hull_point);
if (status)
return status;
if (i + step == stop)
slope = final_slope;
else
_cairo_slope_init (&slope, &point[i], &point[i+step]);
if (_cairo_slope_counter_clockwise (&slope, &pen->vertices[active].slope_ccw)) {
if (++active == pen->num_vertices)
active = 0;
} else if (_cairo_slope_clockwise (&slope, &pen->vertices[active].slope_cw)) {
if (--active == -1)
active = pen->num_vertices - 1;
} else {
i += step;
}
}
return CAIRO_STATUS_SUCCESS;
}
/* Compute outline of a given spline using the pen.
The trapezoids needed to fill that outline will be added to traps
*/
cairo_status_t
_cairo_pen_stroke_spline (cairo_pen_t *pen,
cairo_spline_t *spline,
double tolerance,
cairo_traps_t *traps)
{
cairo_status_t status;
cairo_polygon_t polygon;
/* If the line width is so small that the pen is reduced to a
single point, then we have nothing to do. */
if (pen->num_vertices <= 1)
return CAIRO_STATUS_SUCCESS;
_cairo_polygon_init (&polygon);
status = _cairo_spline_decompose (spline, tolerance);
if (status)
return status;
status = _cairo_pen_stroke_spline_half (pen, spline, CAIRO_DIRECTION_FORWARD, &polygon);
if (status)
return status;
status = _cairo_pen_stroke_spline_half (pen, spline, CAIRO_DIRECTION_REVERSE, &polygon);
if (status)
return status;
_cairo_polygon_close (&polygon);
_cairo_traps_tessellate_polygon (traps, &polygon, CAIRO_FILL_RULE_WINDING);
_cairo_polygon_fini (&polygon);
return CAIRO_STATUS_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,425 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2004 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Olivier Andrieu <oliv__a@users.sourceforge.net>
* Carl D. Worth <cworth@isi.edu>
*/
#include <png.h>
#include "cairoint.h"
#include "cairo-png.h"
static const cairo_surface_backend_t cairo_png_surface_backend;
static cairo_int_status_t
_cairo_png_surface_copy_page (void *abstract_surface);
void
cairo_set_target_png (cairo_t *cr,
FILE *file,
cairo_format_t format,
int width,
int height)
{
cairo_surface_t *surface;
surface = cairo_png_surface_create (file, format,
width, height);
if (surface == NULL) {
cr->status = CAIRO_STATUS_NO_MEMORY;
return;
}
cairo_set_target_surface (cr, surface);
/* cairo_set_target_surface takes a reference, so we must destroy ours */
cairo_surface_destroy (surface);
}
typedef struct cairo_png_surface {
cairo_surface_t base;
/* PNG-specific fields */
cairo_image_surface_t *image;
FILE *file;
int copied;
cairo_format_t format;
} cairo_png_surface_t;
static void
_cairo_png_surface_erase (cairo_png_surface_t *surface);
cairo_surface_t *
cairo_png_surface_create (FILE *file,
cairo_format_t format,
int width,
int height)
{
cairo_png_surface_t *surface;
surface = malloc (sizeof (cairo_png_surface_t));
if (surface == NULL)
return NULL;
_cairo_surface_init (&surface->base, &cairo_png_surface_backend);
surface->image = (cairo_image_surface_t *)
cairo_image_surface_create (format, width, height);
if (surface->image == NULL) {
free (surface);
return NULL;
}
_cairo_png_surface_erase (surface);
surface->file = file;
surface->copied = 0;
surface->format = format;
return &surface->base;
}
static cairo_surface_t *
_cairo_png_surface_create_similar (void *abstract_src,
cairo_format_t format,
int drawable,
int width,
int height)
{
return NULL;
}
static void
unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data)
{
int i;
for (i = 0; i < row_info->rowbytes; i += 4) {
unsigned char *b = &data[i];
unsigned int pixel;
unsigned char alpha;
memcpy (&pixel, b, sizeof (unsigned int));
alpha = (pixel & 0xff000000) >> 24;
if (alpha == 0) {
b[0] = b[1] = b[2] = b[3] = 0;
} else {
b[0] = (((pixel & 0x0000ff) >> 0) * 255) / alpha;
b[1] = (((pixel & 0x00ff00) >> 8) * 255) / alpha;
b[2] = (((pixel & 0xff0000) >> 16) * 255) / alpha;
b[3] = alpha;
}
}
}
static void
_cairo_png_surface_destroy (void *abstract_surface)
{
cairo_png_surface_t *surface = abstract_surface;
if (! surface->copied)
_cairo_png_surface_copy_page (surface);
cairo_surface_destroy (&surface->image->base);
free (surface);
}
static void
_cairo_png_surface_erase (cairo_png_surface_t *surface)
{
cairo_color_t transparent;
_cairo_color_init (&transparent);
_cairo_color_set_rgb (&transparent, 0., 0., 0.);
_cairo_color_set_alpha (&transparent, 0.);
_cairo_surface_fill_rectangle (&surface->image->base,
CAIRO_OPERATOR_SRC,
&transparent,
0, 0,
surface->image->width,
surface->image->height);
}
static double
_cairo_png_surface_pixels_per_inch (void *abstract_surface)
{
return 96.0;
}
static cairo_image_surface_t *
_cairo_png_surface_get_image (void *abstract_surface)
{
cairo_png_surface_t *surface = abstract_surface;
cairo_surface_reference (&surface->image->base);
return surface->image;
}
static cairo_status_t
_cairo_png_surface_set_image (void *abstract_surface,
cairo_image_surface_t *image)
{
cairo_png_surface_t *surface = abstract_surface;
if (image == surface->image)
return CAIRO_STATUS_SUCCESS;
/* XXX: Need to call _cairo_image_surface_set_image here, but it's
not implemented yet. */
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_status_t
_cairo_png_surface_set_matrix (void *abstract_surface,
cairo_matrix_t *matrix)
{
cairo_png_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_matrix (surface->image, matrix);
}
static cairo_status_t
_cairo_png_surface_set_filter (void *abstract_surface,
cairo_filter_t filter)
{
cairo_png_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_filter (surface->image, filter);
}
static cairo_status_t
_cairo_png_surface_set_repeat (void *abstract_surface,
int repeat)
{
cairo_png_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_repeat (surface->image, repeat);
}
static cairo_int_status_t
_cairo_png_surface_composite (cairo_operator_t operator,
cairo_surface_t *generic_src,
cairo_surface_t *generic_mask,
void *abstract_dst,
int src_x,
int src_y,
int mask_x,
int mask_y,
int dst_x,
int dst_y,
unsigned int width,
unsigned int height)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_png_surface_fill_rectangles (void *abstract_surface,
cairo_operator_t operator,
const cairo_color_t *color,
cairo_rectangle_t *rects,
int num_rects)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_png_surface_composite_trapezoids (cairo_operator_t operator,
cairo_surface_t *generic_src,
void *abstract_dst,
int x_src,
int y_src,
cairo_trapezoid_t *traps,
int num_traps)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_png_surface_copy_page (void *abstract_surface)
{
int i;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_png_surface_t *surface = abstract_surface;
png_struct *png;
png_info *info;
png_byte **rows;
png_color_16 white;
int png_color_type;
int depth;
rows = malloc (surface->image->height * sizeof(png_byte*));
if (rows == NULL)
return CAIRO_STATUS_NO_MEMORY;
for (i = 0; i < surface->image->height; i++)
rows[i] = surface->image->data + i * surface->image->stride;
png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png == NULL)
return CAIRO_STATUS_NO_MEMORY;
info = png_create_info_struct (png);
if (info == NULL) {
png_destroy_write_struct (&png, NULL);
return CAIRO_STATUS_NO_MEMORY;
}
if (setjmp (png_jmpbuf (png))) {
status = CAIRO_STATUS_NO_MEMORY;
goto BAIL;
}
png_init_io (png, surface->file);
switch (surface->format) {
case CAIRO_FORMAT_ARGB32:
depth = 8;
png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
break;
case CAIRO_FORMAT_RGB24:
depth = 8;
png_color_type = PNG_COLOR_TYPE_RGB;
break;
case CAIRO_FORMAT_A8:
depth = 8;
png_color_type = PNG_COLOR_TYPE_GRAY;
break;
case CAIRO_FORMAT_A1:
depth = 1;
png_color_type = PNG_COLOR_TYPE_GRAY;
break;
default:
status = CAIRO_STATUS_NULL_POINTER;
goto BAIL;
}
png_set_IHDR (png, info,
surface->image->width,
surface->image->height, depth,
png_color_type,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT);
white.red = 0xff;
white.blue = 0xff;
white.green = 0xff;
png_set_bKGD (png, info, &white);
/* XXX: Setting the time is interfereing with the image comparison
png_convert_from_time_t (&png_time, time (NULL));
png_set_tIME (png, info, &png_time);
*/
png_set_write_user_transform_fn (png, unpremultiply_data);
if (surface->format == CAIRO_FORMAT_ARGB32 || surface->format == CAIRO_FORMAT_RGB24)
png_set_bgr (png);
if (surface->format == CAIRO_FORMAT_RGB24)
png_set_filler (png, 0, PNG_FILLER_AFTER);
png_write_info (png, info);
png_write_image (png, rows);
png_write_end (png, info);
surface->copied = 1;
BAIL:
png_destroy_write_struct (&png, &info);
free (rows);
return status;
}
static cairo_int_status_t
_cairo_png_surface_show_page (void *abstract_surface)
{
cairo_int_status_t status;
cairo_png_surface_t *surface = abstract_surface;
status = _cairo_png_surface_copy_page (surface);
if (status)
return status;
_cairo_png_surface_erase (surface);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_png_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
cairo_png_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_clip_region (surface->image, region);
}
static cairo_int_status_t
_cairo_png_surface_create_pattern (void *abstract_surface,
cairo_pattern_t *pattern,
cairo_box_t *extents)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static const cairo_surface_backend_t cairo_png_surface_backend = {
_cairo_png_surface_create_similar,
_cairo_png_surface_destroy,
_cairo_png_surface_pixels_per_inch,
_cairo_png_surface_get_image,
_cairo_png_surface_set_image,
_cairo_png_surface_set_matrix,
_cairo_png_surface_set_filter,
_cairo_png_surface_set_repeat,
_cairo_png_surface_composite,
_cairo_png_surface_fill_rectangles,
_cairo_png_surface_composite_trapezoids,
_cairo_png_surface_copy_page,
_cairo_png_surface_show_page,
_cairo_png_surface_set_clip_region,
_cairo_png_surface_create_pattern,
NULL /* show_glyphs */
};

Просмотреть файл

@ -0,0 +1,172 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <stdlib.h>
#include "cairoint.h"
/* private functions */
static cairo_status_t
_cairo_polygon_grow_by (cairo_polygon_t *polygon, int additional);
void
_cairo_polygon_init (cairo_polygon_t *polygon)
{
polygon->num_edges = 0;
polygon->edges_size = 0;
polygon->edges = NULL;
polygon->has_current_point = 0;
}
void
_cairo_polygon_fini (cairo_polygon_t *polygon)
{
if (polygon->edges_size) {
free (polygon->edges);
polygon->edges = NULL;
polygon->edges_size = 0;
polygon->num_edges = 0;
}
polygon->has_current_point = 0;
}
static cairo_status_t
_cairo_polygon_grow_by (cairo_polygon_t *polygon, int additional)
{
cairo_edge_t *new_edges;
int old_size = polygon->edges_size;
int new_size = polygon->num_edges + additional;
if (new_size <= polygon->edges_size) {
return CAIRO_STATUS_SUCCESS;
}
polygon->edges_size = new_size;
new_edges = realloc (polygon->edges, polygon->edges_size * sizeof (cairo_edge_t));
if (new_edges == NULL) {
polygon->edges_size = old_size;
return CAIRO_STATUS_NO_MEMORY;
}
polygon->edges = new_edges;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_polygon_add_edge (cairo_polygon_t *polygon, cairo_point_t *p1, cairo_point_t *p2)
{
cairo_status_t status;
cairo_edge_t *edge;
/* drop horizontal edges */
if (p1->y == p2->y) {
goto DONE;
}
if (polygon->num_edges >= polygon->edges_size) {
int additional = polygon->edges_size ? polygon->edges_size : 16;
status = _cairo_polygon_grow_by (polygon, additional);
if (status) {
return status;
}
}
edge = &polygon->edges[polygon->num_edges];
if (p1->y < p2->y) {
edge->edge.p1 = *p1;
edge->edge.p2 = *p2;
edge->clockWise = 1;
} else {
edge->edge.p1 = *p2;
edge->edge.p2 = *p1;
edge->clockWise = 0;
}
polygon->num_edges++;
DONE:
_cairo_polygon_move_to (polygon, p2);
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_polygon_move_to (cairo_polygon_t *polygon, cairo_point_t *point)
{
if (! polygon->has_current_point)
polygon->first_point = *point;
polygon->current_point = *point;
polygon->has_current_point = 1;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_polygon_line_to (cairo_polygon_t *polygon, cairo_point_t *point)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
if (polygon->has_current_point) {
status = _cairo_polygon_add_edge (polygon, &polygon->current_point, point);
} else {
_cairo_polygon_move_to (polygon, point);
}
return status;
}
cairo_status_t
_cairo_polygon_close (cairo_polygon_t *polygon)
{
cairo_status_t status;
if (polygon->has_current_point) {
status = _cairo_polygon_add_edge (polygon,
&polygon->current_point,
&polygon->first_point);
if (status)
return status;
polygon->has_current_point = 0;
}
return CAIRO_STATUS_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,440 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2003 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
#include "cairo-ps.h"
#include <time.h>
#include <zlib.h>
static const cairo_surface_backend_t cairo_ps_surface_backend;
void
cairo_set_target_ps (cairo_t *cr,
FILE *file,
double width_inches,
double height_inches,
double x_pixels_per_inch,
double y_pixels_per_inch)
{
cairo_surface_t *surface;
surface = cairo_ps_surface_create (file,
width_inches, height_inches,
x_pixels_per_inch, y_pixels_per_inch);
if (surface == NULL) {
cr->status = CAIRO_STATUS_NO_MEMORY;
return;
}
cairo_set_target_surface (cr, surface);
/* cairo_set_target_surface takes a reference, so we must destroy ours */
cairo_surface_destroy (surface);
}
typedef struct cairo_ps_surface {
cairo_surface_t base;
/* PS-specific fields */
FILE *file;
double width_inches;
double height_inches;
double x_ppi;
double y_ppi;
int pages;
cairo_image_surface_t *image;
} cairo_ps_surface_t;
static void
_cairo_ps_surface_erase (cairo_ps_surface_t *surface);
cairo_surface_t *
cairo_ps_surface_create (FILE *file,
double width_inches,
double height_inches,
double x_pixels_per_inch,
double y_pixels_per_inch)
{
cairo_ps_surface_t *surface;
int width, height;
time_t now = time (0);
surface = malloc (sizeof (cairo_ps_surface_t));
if (surface == NULL)
return NULL;
_cairo_surface_init (&surface->base, &cairo_ps_surface_backend);
surface->file = file;
surface->width_inches = width_inches;
surface->height_inches = height_inches;
surface->x_ppi = x_pixels_per_inch;
surface->y_ppi = x_pixels_per_inch;
surface->pages = 0;
width = (int) (x_pixels_per_inch * width_inches + 1.0);
height = (int) (y_pixels_per_inch * height_inches + 1.0);
surface->image = (cairo_image_surface_t *)
cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
if (surface->image == NULL) {
free (surface);
return NULL;
}
_cairo_ps_surface_erase (surface);
/* Document header */
fprintf (file,
"%%!PS-Adobe-3.0\n"
"%%%%Creator: Cairo (http://cairographics.org)\n");
fprintf (file,
"%%%%CreationDate: %s",
ctime (&now));
fprintf (file,
"%%%%BoundingBox: %d %d %d %d\n",
0, 0, (int) (surface->width_inches * 72.0), (int) (surface->height_inches * 72.0));
/* The "/FlateDecode filter" currently used is a feature of LanguageLevel 3 */
fprintf (file,
"%%%%DocumentData: Clean7Bit\n"
"%%%%LanguageLevel: 3\n");
fprintf (file,
"%%%%Orientation: Portrait\n"
"%%%%EndComments\n");
return &surface->base;
}
static cairo_surface_t *
_cairo_ps_surface_create_similar (void *abstract_src,
cairo_format_t format,
int drawable,
int width,
int height)
{
return NULL;
}
static void
_cairo_ps_surface_destroy (void *abstract_surface)
{
cairo_ps_surface_t *surface = abstract_surface;
/* Document footer */
fprintf (surface->file, "%%%%EOF\n");
cairo_surface_destroy (&surface->image->base);
free (surface);
}
static void
_cairo_ps_surface_erase (cairo_ps_surface_t *surface)
{
cairo_color_t transparent;
_cairo_color_init (&transparent);
_cairo_color_set_rgb (&transparent, 0., 0., 0.);
_cairo_color_set_alpha (&transparent, 0.);
_cairo_surface_fill_rectangle (&surface->image->base,
CAIRO_OPERATOR_SRC,
&transparent,
0, 0,
surface->image->width,
surface->image->height);
}
/* XXX: We should re-work this interface to return both X/Y ppi values. */
static double
_cairo_ps_surface_pixels_per_inch (void *abstract_surface)
{
cairo_ps_surface_t *surface = abstract_surface;
return surface->y_ppi;
}
static cairo_image_surface_t *
_cairo_ps_surface_get_image (void *abstract_surface)
{
cairo_ps_surface_t *surface = abstract_surface;
cairo_surface_reference (&surface->image->base);
return surface->image;
}
static cairo_status_t
_cairo_ps_surface_set_image (void *abstract_surface,
cairo_image_surface_t *image)
{
cairo_ps_surface_t *surface = abstract_surface;
if (image == surface->image)
return CAIRO_STATUS_SUCCESS;
/* XXX: Need to call _cairo_image_surface_set_image here, but it's
not implemented yet. */
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_status_t
_cairo_ps_surface_set_matrix (void *abstract_surface,
cairo_matrix_t *matrix)
{
cairo_ps_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_matrix (surface->image, matrix);
}
static cairo_status_t
_cairo_ps_surface_set_filter (void *abstract_surface,
cairo_filter_t filter)
{
cairo_ps_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_filter (surface->image, filter);
}
static cairo_status_t
_cairo_ps_surface_set_repeat (void *abstract_surface,
int repeat)
{
cairo_ps_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_repeat (surface->image, repeat);
}
static cairo_int_status_t
_cairo_ps_surface_composite (cairo_operator_t operator,
cairo_surface_t *generic_src,
cairo_surface_t *generic_mask,
void *abstract_dst,
int src_x,
int src_y,
int mask_x,
int mask_y,
int dst_x,
int dst_y,
unsigned int width,
unsigned int height)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_ps_surface_fill_rectangles (void *abstract_surface,
cairo_operator_t operator,
const cairo_color_t *color,
cairo_rectangle_t *rects,
int num_rects)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_ps_surface_composite_trapezoids (cairo_operator_t operator,
cairo_surface_t *generic_src,
void *abstract_dst,
int x_src,
int y_src,
cairo_trapezoid_t *traps,
int num_traps)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_ps_surface_copy_page (void *abstract_surface)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_ps_surface_t *surface = abstract_surface;
int width = surface->image->width;
int height = surface->image->height;
FILE *file = surface->file;
int i, x, y;
cairo_surface_t *white_surface;
char *rgb, *compressed;
long rgb_size, compressed_size;
cairo_color_t white;
rgb_size = 3 * width * height;
rgb = malloc (rgb_size);
if (rgb == NULL) {
status = CAIRO_STATUS_NO_MEMORY;
goto BAIL0;
}
compressed_size = (int) (1.0 + 1.1 * rgb_size);
compressed = malloc (compressed_size);
if (compressed == NULL) {
status = CAIRO_STATUS_NO_MEMORY;
goto BAIL1;
}
/* PostScript can not represent the alpha channel, so we blend the
current image over a white RGB surface to eliminate it. */
white_surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
if (white_surface == NULL) {
status = CAIRO_STATUS_NO_MEMORY;
goto BAIL2;
}
_cairo_color_init (&white);
_cairo_surface_fill_rectangle (white_surface,
CAIRO_OPERATOR_SRC,
&white,
0, 0, 1, 1);
cairo_surface_set_repeat (white_surface, 1);
_cairo_surface_composite (CAIRO_OPERATOR_OVER_REVERSE,
white_surface,
NULL,
&surface->image->base,
0, 0,
0, 0,
0, 0,
width, height);
i = 0;
for (y = 0; y < height; y++) {
pixman_bits_t *pixel = (pixman_bits_t *) (surface->image->data + y * surface->image->stride);
for (x = 0; x < width; x++, pixel++) {
rgb[i++] = (*pixel & 0x00ff0000) >> 16;
rgb[i++] = (*pixel & 0x0000ff00) >> 8;
rgb[i++] = (*pixel & 0x000000ff) >> 0;
}
}
compress (compressed, &compressed_size, rgb, rgb_size);
/* Page header */
fprintf (file, "%%%%Page: %d\n", ++surface->pages);
fprintf (file, "gsave\n");
/* Image header goop */
fprintf (file, "%g %g translate\n", 0.0, surface->height_inches * 72.0);
fprintf (file, "%g %g scale\n", 72.0 / surface->x_ppi, 72.0 / surface->y_ppi);
fprintf (file, "/DeviceRGB setcolorspace\n");
fprintf (file, "<<\n");
fprintf (file, " /ImageType 1\n");
fprintf (file, " /Width %d\n", width);
fprintf (file, " /Height %d\n", height);
fprintf (file, " /BitsPerComponent 8\n");
fprintf (file, " /Decode [ 0 1 0 1 0 1 ]\n");
fprintf (file, " /DataSource currentfile /FlateDecode filter\n");
fprintf (file, " /ImageMatrix [ 1 0 0 -1 0 1 ]\n");
fprintf (file, ">>\n");
fprintf (file, "image\n");
/* Compressed image data */
fwrite (compressed, 1, compressed_size, file);
fprintf (file, "showpage\n");
fprintf (file, "grestore\n");
/* Page footer */
fprintf (file, "%%%%EndPage\n");
cairo_surface_destroy (white_surface);
BAIL2:
free (compressed);
BAIL1:
free (rgb);
BAIL0:
return status;
}
static cairo_int_status_t
_cairo_ps_surface_show_page (void *abstract_surface)
{
cairo_int_status_t status;
cairo_ps_surface_t *surface = abstract_surface;
status = _cairo_ps_surface_copy_page (surface);
if (status)
return status;
_cairo_ps_surface_erase (surface);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_ps_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
cairo_ps_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_clip_region (surface->image, region);
}
static cairo_int_status_t
_cairo_ps_surface_create_pattern (void *abstract_surface,
cairo_pattern_t *pattern,
cairo_box_t *extents)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static const cairo_surface_backend_t cairo_ps_surface_backend = {
_cairo_ps_surface_create_similar,
_cairo_ps_surface_destroy,
_cairo_ps_surface_pixels_per_inch,
_cairo_ps_surface_get_image,
_cairo_ps_surface_set_image,
_cairo_ps_surface_set_matrix,
_cairo_ps_surface_set_filter,
_cairo_ps_surface_set_repeat,
_cairo_ps_surface_composite,
_cairo_ps_surface_fill_rectangles,
_cairo_ps_surface_composite_trapezoids,
_cairo_ps_surface_copy_page,
_cairo_ps_surface_show_page,
_cairo_ps_surface_set_clip_region,
_cairo_ps_surface_create_pattern,
NULL /* show_glyphs */
};

Просмотреть файл

@ -0,0 +1,392 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2004 Calum Robinson
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is Calum Robinson
*
* Contributor(s):
* Calum Robinson <calumr@mac.com>
*/
#include "cairoint.h"
#include "cairo-quartz.h"
#pragma mark Types
typedef struct cairo_quartz_surface {
cairo_surface_t base;
CGContextRef context;
int width;
int height;
cairo_image_surface_t *image;
CGImageRef cgImage;
} cairo_quartz_surface_t;
#pragma mark Private functions
void ImageDataReleaseFunc(void *info, const void *data, size_t size)
{
if (data != NULL)
{
free((void *)data);
}
}
#pragma mark Public functions
void
cairo_set_target_quartz_context( cairo_t *cr,
CGContextRef context,
int width,
int height)
{
cairo_surface_t *surface;
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
return;
surface = cairo_quartz_surface_create(context, width, height);
if (surface == NULL)
{
cr->status = CAIRO_STATUS_NO_MEMORY;
return;
}
cairo_set_target_surface(cr, surface);
/* cairo_set_target_surface takes a reference, so we must destroy ours */
cairo_surface_destroy(surface);
}
static cairo_surface_t *
_cairo_quartz_surface_create_similar( void *abstract_src,
cairo_format_t format,
int drawable,
int width,
int height)
{
return NULL;
}
static void
_cairo_quartz_surface_destroy(void *abstract_surface)
{
cairo_quartz_surface_t *surface = abstract_surface;
if (surface->cgImage)
{
CGImageRelease(surface->cgImage);
}
free(surface);
}
static double
_cairo_quartz_surface_pixels_per_inch(void *abstract_surface)
{
// TODO - get this from CGDirectDisplay somehow?
return 96.0;
}
static cairo_image_surface_t *
_cairo_quartz_surface_get_image(void *abstract_surface)
{
cairo_quartz_surface_t *surface = abstract_surface;
CGColorSpaceRef colorSpace;
void *imageData;
UInt32 imageDataSize, rowBytes;
CGDataProviderRef dataProvider;
// We keep a cached (cairo_image_surface_t *) in the cairo_quartz_surface_t
// struct. If the window is ever drawn to without going through Cairo, then
// we would need to refetch the pixel data from the window into the cached
// image surface.
if (surface->image)
{
cairo_surface_reference(&surface->image->base);
return surface->image;
}
colorSpace = CGColorSpaceCreateDeviceRGB();
rowBytes = surface->width * 4;
imageDataSize = rowBytes * surface->height;
imageData = malloc(imageDataSize);
dataProvider = CGDataProviderCreateWithData(NULL, imageData, imageDataSize, ImageDataReleaseFunc);
surface->cgImage = CGImageCreate( surface->width,
surface->height,
8,
32,
rowBytes,
colorSpace,
kCGImageAlphaPremultipliedFirst,
dataProvider,
NULL,
false,
kCGRenderingIntentDefault);
CGColorSpaceRelease(colorSpace);
CGDataProviderRelease(dataProvider);
surface->image = (cairo_image_surface_t *)
cairo_image_surface_create_for_data( imageData,
CAIRO_FORMAT_ARGB32,
surface->width,
surface->height,
rowBytes);
// Set the image surface Cairo state to match our own.
_cairo_image_surface_set_repeat(surface->image, surface->base.repeat);
_cairo_image_surface_set_matrix(surface->image, &(surface->base.matrix));
return surface->image;
}
static cairo_status_t
_cairo_quartz_surface_set_image( void *abstract_surface,
cairo_image_surface_t *image)
{
cairo_quartz_surface_t *surface = abstract_surface;
cairo_status_t status;
if (surface->image == image)
{
CGRect rect;
rect = CGRectMake(0, 0, surface->width, surface->height);
CGContextDrawImage(surface->context, rect, surface->cgImage);
status = CAIRO_STATUS_SUCCESS;
}
else
{
// TODO - set_image from something other than what we returned from get_image
status = CAIRO_STATUS_NO_TARGET_SURFACE;
}
return status;
}
static cairo_status_t
_cairo_quartz_surface_set_matrix(void *abstract_surface, cairo_matrix_t *matrix)
{
cairo_quartz_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_matrix(surface->image, matrix);
}
static cairo_status_t
_cairo_quartz_surface_set_filter(void *abstract_surface, cairo_filter_t filter)
{
cairo_quartz_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_filter(surface->image, filter);
}
static cairo_status_t
_cairo_quartz_surface_set_repeat(void *abstract_surface, int repeat)
{
cairo_quartz_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_repeat(surface->image, repeat);
}
static cairo_int_status_t
_cairo_quartz_surface_composite( cairo_operator_t operator,
cairo_surface_t *generic_src,
cairo_surface_t *generic_mask,
void *abstract_dst,
int src_x,
int src_y,
int mask_x,
int mask_y,
int dst_x,
int dst_y,
unsigned int width,
unsigned int height)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_quartz_surface_fill_rectangles( void *abstract_surface,
cairo_operator_t operator,
const cairo_color_t *color,
cairo_rectangle_t *rects,
int num_rects)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_quartz_surface_composite_trapezoids( cairo_operator_t operator,
cairo_surface_t *generic_src,
void *abstract_dst,
int xSrc,
int ySrc,
cairo_trapezoid_t *traps,
int num_traps)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_quartz_surface_copy_page(void *abstract_surface)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_quartz_surface_show_page(void *abstract_surface)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_quartz_surface_set_clip_region( void *abstract_surface,
pixman_region16_t *region)
{
cairo_quartz_surface_t *surface = abstract_surface;
return _cairo_image_surface_set_clip_region(surface->image, region);
}
static cairo_int_status_t
_cairo_quartz_surface_create_pattern( void *abstract_surface,
cairo_pattern_t *pattern,
cairo_box_t *extents)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
_cairo_quartz_surface_create_similar,
_cairo_quartz_surface_destroy,
_cairo_quartz_surface_pixels_per_inch,
_cairo_quartz_surface_get_image,
_cairo_quartz_surface_set_image,
_cairo_quartz_surface_set_matrix,
_cairo_quartz_surface_set_filter,
_cairo_quartz_surface_set_repeat,
_cairo_quartz_surface_composite,
_cairo_quartz_surface_fill_rectangles,
_cairo_quartz_surface_composite_trapezoids,
_cairo_quartz_surface_copy_page,
_cairo_quartz_surface_show_page,
_cairo_quartz_surface_set_clip_region,
_cairo_quartz_surface_create_pattern
};
cairo_surface_t *
cairo_quartz_surface_create( CGContextRef context,
int width,
int height)
{
cairo_quartz_surface_t *surface;
surface = malloc(sizeof(cairo_quartz_surface_t));
if (surface == NULL)
return NULL;
_cairo_surface_init(&surface->base, &cairo_quartz_surface_backend);
surface->context = context;
surface->width = width;
surface->height = height;
surface->image = NULL;
surface->cgImage = NULL;
// Set up the image surface which Cairo draws into and we blit to & from.
surface->image = _cairo_quartz_surface_get_image(surface);
return (cairo_surface_t *)surface;
}
DEPRECATE (cairo_surface_create_for_drawable, cairo_quartz_surface_create);

Просмотреть файл

@ -0,0 +1,103 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
void
_cairo_slope_init (cairo_slope_t *slope, cairo_point_t *a, cairo_point_t *b)
{
slope->dx = b->x - a->x;
slope->dy = b->y - a->y;
}
/* Compare two slopes. Slope angles begin at 0 in the direction of the
positive X axis and increase in the direction of the positive Y
axis.
WARNING: This function only gives correct results if the angular
difference between a and b is less than PI.
< 0 => a less positive than b
== 0 => a equal to be
> 0 => a more positive than b
*/
int
_cairo_slope_compare (cairo_slope_t *a, cairo_slope_t *b)
{
cairo_fixed_48_16_t diff;
diff = ((cairo_fixed_48_16_t) a->dy * (cairo_fixed_48_16_t) b->dx
- (cairo_fixed_48_16_t) b->dy * (cairo_fixed_48_16_t) a->dx);
if (diff > 0)
return 1;
if (diff < 0)
return -1;
if (a->dx == 0 && a->dy == 0)
return 1;
if (b->dx == 0 && b->dy ==0)
return -1;
return 0;
}
/* XXX: It might be cleaner to move away from usage of
_cairo_slope_clockwise/_cairo_slope_counter_clockwise in favor of
directly using _cairo_slope_compare.
*/
/* Is a clockwise of b?
*
* NOTE: The strict equality here is not significant in and of itself,
* but there are functions up above that are sensitive to it,
* (cf. _cairo_pen_find_active_cw_vertex_index).
*/
int
_cairo_slope_clockwise (cairo_slope_t *a, cairo_slope_t *b)
{
return _cairo_slope_compare (a, b) < 0;
}
int
_cairo_slope_counter_clockwise (cairo_slope_t *a, cairo_slope_t *b)
{
return ! _cairo_slope_clockwise (a, b);
}

Просмотреть файл

@ -0,0 +1,288 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
static cairo_status_t
_cairo_spline_grow_by (cairo_spline_t *spline, int additional);
static cairo_status_t
_cairo_spline_add_point (cairo_spline_t *spline, cairo_point_t *point);
static void
_lerp_half (cairo_point_t *a, cairo_point_t *b, cairo_point_t *result);
static void
_de_casteljau (cairo_spline_t *spline, cairo_spline_t *s1, cairo_spline_t *s2);
static double
_cairo_spline_error_squared (cairo_spline_t *spline);
static cairo_status_t
_cairo_spline_decompose_into (cairo_spline_t *spline, double tolerance_squared, cairo_spline_t *result);
cairo_int_status_t
_cairo_spline_init (cairo_spline_t *spline,
cairo_point_t *a, cairo_point_t *b,
cairo_point_t *c, cairo_point_t *d)
{
spline->a = *a;
spline->b = *b;
spline->c = *c;
spline->d = *d;
if (a->x != b->x || a->y != b->y) {
_cairo_slope_init (&spline->initial_slope, &spline->a, &spline->b);
} else if (a->x != c->x || a->y != c->y) {
_cairo_slope_init (&spline->initial_slope, &spline->a, &spline->c);
} else if (a->x != d->x || a->y != d->y) {
_cairo_slope_init (&spline->initial_slope, &spline->a, &spline->d);
} else {
return CAIRO_INT_STATUS_DEGENERATE;
}
if (c->x != d->x || c->y != d->y) {
_cairo_slope_init (&spline->final_slope, &spline->c, &spline->d);
} else if (b->x != d->x || b->y != d->y) {
_cairo_slope_init (&spline->final_slope, &spline->b, &spline->d);
} else {
_cairo_slope_init (&spline->final_slope, &spline->a, &spline->d);
}
spline->num_points = 0;
spline->points_size = 0;
spline->points = NULL;
return CAIRO_STATUS_SUCCESS;
}
void
_cairo_spline_fini (cairo_spline_t *spline)
{
spline->num_points = 0;
spline->points_size = 0;
free (spline->points);
spline->points = NULL;
}
static cairo_status_t
_cairo_spline_grow_by (cairo_spline_t *spline, int additional)
{
cairo_point_t *new_points;
int old_size = spline->points_size;
int new_size = spline->num_points + additional;
if (new_size <= spline->points_size)
return CAIRO_STATUS_SUCCESS;
spline->points_size = new_size;
new_points = realloc (spline->points, spline->points_size * sizeof (cairo_point_t));
if (new_points == NULL) {
spline->points_size = old_size;
return CAIRO_STATUS_NO_MEMORY;
}
spline->points = new_points;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_spline_add_point (cairo_spline_t *spline, cairo_point_t *point)
{
cairo_status_t status;
cairo_point_t *prev;
if (spline->num_points) {
prev = &spline->points[spline->num_points - 1];
if (prev->x == point->x && prev->y == point->y)
return CAIRO_STATUS_SUCCESS;
}
if (spline->num_points >= spline->points_size) {
int additional = spline->points_size ? spline->points_size : 32;
status = _cairo_spline_grow_by (spline, additional);
if (status)
return status;
}
spline->points[spline->num_points] = *point;
spline->num_points++;
return CAIRO_STATUS_SUCCESS;
}
static void
_lerp_half (cairo_point_t *a, cairo_point_t *b, cairo_point_t *result)
{
result->x = a->x + ((b->x - a->x) >> 1);
result->y = a->y + ((b->y - a->y) >> 1);
}
static void
_de_casteljau (cairo_spline_t *spline, cairo_spline_t *s1, cairo_spline_t *s2)
{
cairo_point_t ab, bc, cd;
cairo_point_t abbc, bccd;
cairo_point_t final;
_lerp_half (&spline->a, &spline->b, &ab);
_lerp_half (&spline->b, &spline->c, &bc);
_lerp_half (&spline->c, &spline->d, &cd);
_lerp_half (&ab, &bc, &abbc);
_lerp_half (&bc, &cd, &bccd);
_lerp_half (&abbc, &bccd, &final);
s1->a = spline->a;
s1->b = ab;
s1->c = abbc;
s1->d = final;
s2->a = final;
s2->b = bccd;
s2->c = cd;
s2->d = spline->d;
}
static double
_PointDistanceSquaredToPoint (cairo_point_t *a, cairo_point_t *b)
{
double dx = _cairo_fixed_to_double (b->x - a->x);
double dy = _cairo_fixed_to_double (b->y - a->y);
return dx*dx + dy*dy;
}
static double
_PointDistanceSquaredToSegment (cairo_point_t *p, cairo_point_t *p1, cairo_point_t *p2)
{
double u;
double dx, dy;
double pdx, pdy;
cairo_point_t px;
/* intersection point (px):
px = p1 + u(p2 - p1)
(p - px) . (p2 - p1) = 0
Thus:
u = ((p - p1) . (p2 - p1)) / (||(p2 - p1)|| ^ 2);
*/
dx = _cairo_fixed_to_double (p2->x - p1->x);
dy = _cairo_fixed_to_double (p2->y - p1->y);
if (dx == 0 && dy == 0)
return _PointDistanceSquaredToPoint (p, p1);
pdx = _cairo_fixed_to_double (p->x - p1->x);
pdy = _cairo_fixed_to_double (p->y - p1->y);
u = (pdx * dx + pdy * dy) / (dx*dx + dy*dy);
if (u <= 0)
return _PointDistanceSquaredToPoint (p, p1);
else if (u >= 1)
return _PointDistanceSquaredToPoint (p, p2);
px.x = p1->x + u * (p2->x - p1->x);
px.y = p1->y + u * (p2->y - p1->y);
return _PointDistanceSquaredToPoint (p, &px);
}
/* Return an upper bound on the error (squared) that could result from approximating
a spline as a line segment connecting the two endpoints */
static double
_cairo_spline_error_squared (cairo_spline_t *spline)
{
double berr, cerr;
berr = _PointDistanceSquaredToSegment (&spline->b, &spline->a, &spline->d);
cerr = _PointDistanceSquaredToSegment (&spline->c, &spline->a, &spline->d);
if (berr > cerr)
return berr;
else
return cerr;
}
static cairo_status_t
_cairo_spline_decompose_into (cairo_spline_t *spline, double tolerance_squared, cairo_spline_t *result)
{
cairo_status_t status;
cairo_spline_t s1, s2;
if (_cairo_spline_error_squared (spline) < tolerance_squared) {
return _cairo_spline_add_point (result, &spline->a);
}
_de_casteljau (spline, &s1, &s2);
status = _cairo_spline_decompose_into (&s1, tolerance_squared, result);
if (status)
return status;
status = _cairo_spline_decompose_into (&s2, tolerance_squared, result);
if (status)
return status;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_spline_decompose (cairo_spline_t *spline, double tolerance)
{
cairo_status_t status;
if (spline->points_size) {
_cairo_spline_fini (spline);
}
status = _cairo_spline_decompose_into (spline, tolerance * tolerance, spline);
if (status)
return status;
status = _cairo_spline_add_point (spline, &spline->d);
if (status)
return status;
return CAIRO_STATUS_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,510 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include <stdlib.h>
#include "cairoint.h"
void
_cairo_surface_init (cairo_surface_t *surface,
const cairo_surface_backend_t *backend)
{
surface->backend = backend;
surface->ref_count = 1;
_cairo_matrix_init (&surface->matrix);
surface->filter = CAIRO_FILTER_NEAREST;
surface->repeat = 0;
}
cairo_surface_t *
cairo_surface_create_for_image (char *data,
cairo_format_t format,
int width,
int height,
int stride)
{
return cairo_image_surface_create_for_data (data, format, width, height, stride);
}
slim_hidden_def(cairo_surface_create_for_image);
cairo_surface_t *
_cairo_surface_create_similar_scratch (cairo_surface_t *other,
cairo_format_t format,
int drawable,
int width,
int height)
{
if (other == NULL)
return NULL;
return other->backend->create_similar (other, format, drawable,
width, height);
}
cairo_surface_t *
cairo_surface_create_similar (cairo_surface_t *other,
cairo_format_t format,
int width,
int height)
{
cairo_color_t empty;
if (other == NULL)
return NULL;
_cairo_color_init (&empty);
_cairo_color_set_rgb (&empty, 0., 0., 0.);
_cairo_color_set_alpha (&empty, 0.);
return _cairo_surface_create_similar_solid (other, format, width, height, &empty);
}
cairo_surface_t *
_cairo_surface_create_similar_solid (cairo_surface_t *other,
cairo_format_t format,
int width,
int height,
cairo_color_t *color)
{
cairo_status_t status;
cairo_surface_t *surface;
surface = _cairo_surface_create_similar_scratch (other, format, 1,
width, height);
if (surface == NULL)
surface = cairo_image_surface_create (format, width, height);
status = _cairo_surface_fill_rectangle (surface,
CAIRO_OPERATOR_SRC, color,
0, 0, width, height);
if (status) {
cairo_surface_destroy (surface);
return NULL;
}
return surface;
}
void
cairo_surface_reference (cairo_surface_t *surface)
{
if (surface == NULL)
return;
surface->ref_count++;
}
void
cairo_surface_destroy (cairo_surface_t *surface)
{
if (surface == NULL)
return;
surface->ref_count--;
if (surface->ref_count)
return;
if (surface->backend->destroy)
surface->backend->destroy (surface);
}
slim_hidden_def(cairo_surface_destroy);
double
_cairo_surface_pixels_per_inch (cairo_surface_t *surface)
{
return surface->backend->pixels_per_inch (surface);
}
cairo_image_surface_t *
_cairo_surface_get_image (cairo_surface_t *surface)
{
return surface->backend->get_image (surface);
}
cairo_status_t
_cairo_surface_set_image (cairo_surface_t *surface, cairo_image_surface_t *image)
{
return surface->backend->set_image (surface, image);
}
cairo_status_t
cairo_surface_set_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix)
{
if (surface == NULL)
return CAIRO_STATUS_NULL_POINTER;
cairo_matrix_copy (&surface->matrix, matrix);
return surface->backend->set_matrix (surface, matrix);
}
slim_hidden_def(cairo_surface_set_matrix);
cairo_status_t
cairo_surface_get_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix)
{
if (surface == NULL)
return CAIRO_STATUS_NULL_POINTER;
return cairo_matrix_copy (matrix, &surface->matrix);
}
slim_hidden_def(cairo_surface_get_matrix);
cairo_status_t
cairo_surface_set_filter (cairo_surface_t *surface, cairo_filter_t filter)
{
if (surface == NULL)
return CAIRO_STATUS_NULL_POINTER;
surface->filter = filter;
return surface->backend->set_filter (surface, filter);
}
cairo_filter_t
cairo_surface_get_filter (cairo_surface_t *surface)
{
return surface->filter;
}
/* XXX: NYI
cairo_status_t
cairo_surface_clip_rectangle (cairo_surface_t *surface,
int x, int y,
int width, int height)
{
}
*/
/* XXX: NYI
cairo_status_t
cairo_surface_clip_restore (cairo_surface_t *surface);
*/
cairo_status_t
cairo_surface_set_repeat (cairo_surface_t *surface, int repeat)
{
if (surface == NULL)
return CAIRO_STATUS_NULL_POINTER;
surface->repeat = repeat;
return surface->backend->set_repeat (surface, repeat);
}
slim_hidden_def(cairo_surface_set_repeat);
cairo_status_t
_cairo_surface_composite (cairo_operator_t operator,
cairo_surface_t *src,
cairo_surface_t *mask,
cairo_surface_t *dst,
int src_x,
int src_y,
int mask_x,
int mask_y,
int dst_x,
int dst_y,
unsigned int width,
unsigned int height)
{
cairo_int_status_t status;
cairo_image_surface_t *src_image, *mask_image = 0, *dst_image;
status = dst->backend->composite (operator,
src, mask, dst,
src_x, src_y,
mask_x, mask_y,
dst_x, dst_y,
width, height);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
src_image = _cairo_surface_get_image (src);
if (mask)
mask_image = _cairo_surface_get_image (mask);
dst_image = _cairo_surface_get_image (dst);
dst_image->base.backend->composite (operator,
&src_image->base,
mask ? &mask_image->base : NULL,
dst_image,
src_x, src_y,
mask_x, mask_y,
dst_x, dst_y,
width, height);
status = _cairo_surface_set_image (dst, dst_image);
cairo_surface_destroy (&src_image->base);
if (mask)
cairo_surface_destroy (&mask_image->base);
cairo_surface_destroy (&dst_image->base);
return status;
}
cairo_status_t
_cairo_surface_fill_rectangle (cairo_surface_t *surface,
cairo_operator_t operator,
cairo_color_t *color,
int x,
int y,
int width,
int height)
{
cairo_rectangle_t rect;
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
return _cairo_surface_fill_rectangles (surface, operator, color, &rect, 1);
}
cairo_status_t
_cairo_surface_fill_rectangles (cairo_surface_t *surface,
cairo_operator_t operator,
const cairo_color_t *color,
cairo_rectangle_t *rects,
int num_rects)
{
cairo_int_status_t status;
cairo_image_surface_t *surface_image;
if (num_rects == 0)
return CAIRO_STATUS_SUCCESS;
status = surface->backend->fill_rectangles (surface,
operator,
color,
rects, num_rects);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
surface_image = _cairo_surface_get_image (surface);
surface_image->base.backend->fill_rectangles (surface_image,
operator,
color,
rects, num_rects);
status = _cairo_surface_set_image (surface, surface_image);
cairo_surface_destroy (&surface_image->base);
return status;
}
cairo_status_t
_cairo_surface_composite_trapezoids (cairo_operator_t operator,
cairo_surface_t *src,
cairo_surface_t *dst,
int x_src,
int y_src,
cairo_trapezoid_t *traps,
int num_traps)
{
cairo_int_status_t status;
cairo_image_surface_t *src_image, *dst_image;
status = dst->backend->composite_trapezoids (operator,
src, dst,
x_src, y_src,
traps, num_traps);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
src_image = _cairo_surface_get_image (src);
dst_image = _cairo_surface_get_image (dst);
dst_image->base.backend->composite_trapezoids (operator,
&src_image->base,
dst_image,
x_src, y_src,
traps, num_traps);
status = _cairo_surface_set_image (dst, dst_image);
cairo_surface_destroy (&src_image->base);
cairo_surface_destroy (&dst_image->base);
return status;
}
cairo_status_t
_cairo_surface_copy_page (cairo_surface_t *surface)
{
cairo_int_status_t status;
status = surface->backend->copy_page (surface);
/* It's fine if some backends just don't support this. */
if (status == CAIRO_INT_STATUS_UNSUPPORTED)
return CAIRO_STATUS_SUCCESS;
if (status)
return status;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_surface_show_page (cairo_surface_t *surface)
{
cairo_int_status_t status;
status = surface->backend->show_page (surface);
/* It's fine if some backends just don't support this. */
if (status == CAIRO_INT_STATUS_UNSUPPORTED)
return CAIRO_STATUS_SUCCESS;
if (status)
return status;
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
_cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region)
{
return surface->backend->set_clip_region (surface, region);
}
cairo_status_t
_cairo_surface_create_pattern (cairo_surface_t *surface,
cairo_pattern_t *pattern,
cairo_box_t *box)
{
cairo_int_status_t status;
status = surface->backend->create_pattern (surface, pattern, box);
/* The backend cannot accelerate this pattern, lets create an
unaccelerated source instead. */
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
status = CAIRO_STATUS_SUCCESS;
switch (pattern->type) {
case CAIRO_PATTERN_LINEAR:
case CAIRO_PATTERN_RADIAL: {
cairo_image_surface_t *image;
image = _cairo_pattern_get_image (pattern, box);
if (image) {
pattern->source = &image->base;
return CAIRO_STATUS_SUCCESS;
} else
return CAIRO_STATUS_NO_MEMORY;
} break;
case CAIRO_PATTERN_SOLID:
pattern->source =
_cairo_surface_create_similar_solid (surface,
CAIRO_FORMAT_ARGB32,
1, 1,
&pattern->color);
if (pattern->source) {
cairo_surface_set_repeat (pattern->source, 1);
return CAIRO_STATUS_SUCCESS;
} else
return CAIRO_STATUS_NO_MEMORY;
break;
case CAIRO_PATTERN_SURFACE:
status = CAIRO_INT_STATUS_UNSUPPORTED;
/* handle pattern opacity */
if (pattern->color.alpha != 1.0) {
double x = box->p1.x >> 16;
double y = box->p1.y >> 16;
int width = ((box->p2.x + 65535) >> 16) - (box->p1.x >> 16);
int height = ((box->p2.y + 65535) >> 16) - (box->p1.y >> 16);
cairo_pattern_t alpha;
pattern->source =
cairo_surface_create_similar (surface,
CAIRO_FORMAT_ARGB32,
width, height);
if (pattern->source) {
_cairo_pattern_init_solid (&alpha, 1.0, 1.0, 1.0);
_cairo_pattern_set_alpha (&alpha, pattern->color.alpha);
status = _cairo_surface_create_pattern (pattern->source,
&alpha, box);
if (status == CAIRO_STATUS_SUCCESS) {
int save_repeat = pattern->u.surface.surface->repeat;
if (pattern->extend == CAIRO_EXTEND_REPEAT ||
pattern->u.surface.surface->repeat == 1)
cairo_surface_set_repeat (pattern->u.surface.surface, 1);
else
cairo_surface_set_repeat (pattern->u.surface.surface, 0);
status =
_cairo_surface_composite (CAIRO_OPERATOR_OVER,
pattern->u.surface.surface,
alpha.source,
pattern->source,
0, 0, 0, 0, 0, 0,
width, height);
cairo_surface_set_repeat (pattern->u.surface.surface,
save_repeat);
if (status == CAIRO_STATUS_SUCCESS)
_cairo_pattern_set_source_offset (pattern, x, y);
else
cairo_surface_destroy (pattern->source);
}
_cairo_pattern_fini (&alpha);
}
}
if (status != CAIRO_STATUS_SUCCESS) {
pattern->source = pattern->u.surface.surface;
cairo_surface_reference (pattern->u.surface.surface);
return CAIRO_STATUS_SUCCESS;
}
break;
}
}
return status;
}

Просмотреть файл

@ -0,0 +1,647 @@
/*
* Copyright © 2002 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.
*
* 2002-07-15: Converted from XRenderCompositeDoublePoly to cairo_trap. Carl D. Worth
*/
#include "cairoint.h"
#define CAIRO_TRAPS_GROWTH_INC 10
/* private functions */
static cairo_status_t
_cairo_traps_grow_by (cairo_traps_t *traps, int additional);
static cairo_status_t
_cairo_traps_add_trap (cairo_traps_t *traps, cairo_fixed_t top, cairo_fixed_t bottom,
cairo_line_t *left, cairo_line_t *right);
static cairo_status_t
_cairo_traps_add_trap_from_points (cairo_traps_t *traps, cairo_fixed_t top, cairo_fixed_t bottom,
cairo_point_t left_p1, cairo_point_t left_p2,
cairo_point_t right_p1, cairo_point_t right_p2);
static int
_compare_point_fixed_by_y (const void *av, const void *bv);
static int
_compare_cairo_edge_by_top (const void *av, const void *bv);
static int
_compare_cairo_edge_by_slope (const void *av, const void *bv);
static cairo_fixed_16_16_t
_compute_x (cairo_line_t *line, cairo_fixed_t y);
static double
_compute_inverse_slope (cairo_line_t *l);
static double
_compute_x_intercept (cairo_line_t *l, double inverse_slope);
static int
_line_segs_intersect_ceil (cairo_line_t *left, cairo_line_t *right, cairo_fixed_t *y_ret);
void
_cairo_traps_init (cairo_traps_t *traps)
{
traps->num_traps = 0;
traps->traps_size = 0;
traps->traps = NULL;
}
void
_cairo_traps_fini (cairo_traps_t *traps)
{
if (traps->traps_size) {
free (traps->traps);
traps->traps = NULL;
traps->traps_size = 0;
traps->num_traps = 0;
}
}
static cairo_status_t
_cairo_traps_add_trap (cairo_traps_t *traps, cairo_fixed_t top, cairo_fixed_t bottom,
cairo_line_t *left, cairo_line_t *right)
{
cairo_status_t status;
cairo_trapezoid_t *trap;
if (top == bottom) {
return CAIRO_STATUS_SUCCESS;
}
if (traps->num_traps >= traps->traps_size) {
status = _cairo_traps_grow_by (traps, CAIRO_TRAPS_GROWTH_INC);
if (status)
return status;
}
trap = &traps->traps[traps->num_traps];
trap->top = top;
trap->bottom = bottom;
trap->left = *left;
trap->right = *right;
traps->num_traps++;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_traps_add_trap_from_points (cairo_traps_t *traps, cairo_fixed_t top, cairo_fixed_t bottom,
cairo_point_t left_p1, cairo_point_t left_p2,
cairo_point_t right_p1, cairo_point_t right_p2)
{
cairo_line_t left;
cairo_line_t right;
left.p1 = left_p1;
left.p2 = left_p2;
right.p1 = right_p1;
right.p2 = right_p2;
return _cairo_traps_add_trap (traps, top, bottom, &left, &right);
}
static cairo_status_t
_cairo_traps_grow_by (cairo_traps_t *traps, int additional)
{
cairo_trapezoid_t *new_traps;
int old_size = traps->traps_size;
int new_size = traps->num_traps + additional;
if (new_size <= traps->traps_size) {
return CAIRO_STATUS_SUCCESS;
}
traps->traps_size = new_size;
new_traps = realloc (traps->traps, traps->traps_size * sizeof (cairo_trapezoid_t));
if (new_traps == NULL) {
traps->traps_size = old_size;
return CAIRO_STATUS_NO_MEMORY;
}
traps->traps = new_traps;
return CAIRO_STATUS_SUCCESS;
}
static int
_compare_point_fixed_by_y (const void *av, const void *bv)
{
const cairo_point_t *a = av, *b = bv;
int ret = a->y - b->y;
if (ret == 0) {
ret = a->x - b->x;
}
return ret;
}
cairo_status_t
_cairo_traps_tessellate_triangle (cairo_traps_t *traps, cairo_point_t t[3])
{
cairo_status_t status;
cairo_line_t line;
cairo_fixed_16_16_t intersect;
cairo_point_t tsort[3];
memcpy (tsort, t, 3 * sizeof (cairo_point_t));
qsort (tsort, 3, sizeof (cairo_point_t), _compare_point_fixed_by_y);
/* horizontal top edge requires special handling */
if (tsort[0].y == tsort[1].y) {
if (tsort[0].x < tsort[1].x)
status = _cairo_traps_add_trap_from_points (traps,
tsort[1].y, tsort[2].y,
tsort[0], tsort[2],
tsort[1], tsort[2]);
else
status = _cairo_traps_add_trap_from_points (traps,
tsort[1].y, tsort[2].y,
tsort[1], tsort[2],
tsort[0], tsort[2]);
return status;
}
line.p1 = tsort[0];
line.p2 = tsort[1];
intersect = _compute_x (&line, tsort[2].y);
if (intersect < tsort[2].x) {
status = _cairo_traps_add_trap_from_points (traps,
tsort[0].y, tsort[1].y,
tsort[0], tsort[1],
tsort[0], tsort[2]);
if (status)
return status;
status = _cairo_traps_add_trap_from_points (traps,
tsort[1].y, tsort[2].y,
tsort[1], tsort[2],
tsort[0], tsort[2]);
if (status)
return status;
} else {
status = _cairo_traps_add_trap_from_points (traps,
tsort[0].y, tsort[1].y,
tsort[0], tsort[2],
tsort[0], tsort[1]);
if (status)
return status;
status = _cairo_traps_add_trap_from_points (traps,
tsort[1].y, tsort[2].y,
tsort[0], tsort[2],
tsort[1], tsort[2]);
if (status)
return status;
}
return CAIRO_STATUS_SUCCESS;
}
/* Warning: This function reorders the elements of the array provided. */
cairo_status_t
_cairo_traps_tessellate_rectangle (cairo_traps_t *traps, cairo_point_t q[4])
{
cairo_status_t status;
qsort (q, 4, sizeof (cairo_point_t), _compare_point_fixed_by_y);
if (q[1].x > q[2].x) {
status = _cairo_traps_add_trap_from_points (traps,
q[0].y, q[1].y, q[0], q[2], q[0], q[1]);
if (status)
return status;
status = _cairo_traps_add_trap_from_points (traps,
q[1].y, q[2].y, q[0], q[2], q[1], q[3]);
if (status)
return status;
status = _cairo_traps_add_trap_from_points (traps,
q[2].y, q[3].y, q[2], q[3], q[1], q[3]);
if (status)
return status;
} else {
status = _cairo_traps_add_trap_from_points (traps,
q[0].y, q[1].y, q[0], q[1], q[0], q[2]);
if (status)
return status;
status = _cairo_traps_add_trap_from_points (traps,
q[1].y, q[2].y, q[1], q[3], q[0], q[2]);
if (status)
return status;
status = _cairo_traps_add_trap_from_points (traps,
q[2].y, q[3].y, q[1], q[3], q[2], q[3]);
if (status)
return status;
}
return CAIRO_STATUS_SUCCESS;
}
static int
_compare_cairo_edge_by_top (const void *av, const void *bv)
{
const cairo_edge_t *a = av, *b = bv;
return a->edge.p1.y - b->edge.p1.y;
}
/* Return value is:
> 0 if a is "clockwise" from b, (in a mathematical, not a graphical sense)
== 0 if slope (a) == slope (b)
< 0 if a is "counter-clockwise" from b
*/
static int
_compare_cairo_edge_by_slope (const void *av, const void *bv)
{
const cairo_edge_t *a = av, *b = bv;
cairo_fixed_32_32_t d;
cairo_fixed_48_16_t a_dx = a->edge.p2.x - a->edge.p1.x;
cairo_fixed_48_16_t a_dy = a->edge.p2.y - a->edge.p1.y;
cairo_fixed_48_16_t b_dx = b->edge.p2.x - b->edge.p1.x;
cairo_fixed_48_16_t b_dy = b->edge.p2.y - b->edge.p1.y;
d = b_dy * a_dx - a_dy * b_dx;
if (d > 0)
return 1;
else if (d == 0)
return 0;
else
return -1;
}
static int
_compare_cairo_edge_by_current_x_slope (const void *av, const void *bv)
{
const cairo_edge_t *a = av, *b = bv;
int ret;
ret = a->current_x - b->current_x;
if (ret == 0)
ret = _compare_cairo_edge_by_slope (a, b);
return ret;
}
/* XXX: Both _compute_x and _compute_inverse_slope will divide by zero
for horizontal lines. Now, we "know" that when we are tessellating
polygons that the polygon data structure discards all horizontal
edges, but there's nothing here to guarantee that. I suggest the
following:
A) Move all of the polygon tessellation code out of xrtraps.c and
into xrpoly.c, (in order to be in the same module as the code
discarding horizontal lines).
OR
B) Re-implement the line intersection in a way that avoids all
division by zero. Here's one approach. The only disadvantage
might be that that there are not meaningful names for all of the
sub-computations -- just a bunch of determinants. I haven't
looked at complexity, (both are probably similar and it probably
doesn't matter much anyway).
static double
_det (double a, double b, double c, double d)
{
return a * d - b * c;
}
static int
_lines_intersect (cairo_line_t *l1, cairo_line_t *l2, cairo_fixed_t *y_intersection)
{
double dx1 = cairo_fixed_to_double (l1->p1.x - l1->p2.x);
double dy1 = cairo_fixed_to_double (l1->p1.y - l1->p2.y);
double dx2 = cairo_fixed_to_double (l2->p1.x - l2->p2.x);
double dy2 = cairo_fixed_to_double (l2->p1.y - l2->p2.y);
double l1_det, l2_det;
double den_det = _det (dx1, dy1, dx2, dy2);
if (den_det == 0)
return 0;
l1_det = _det (l1->p1.x, l1->p1.y,
l1->p2.x, l1->p2.y);
l2_det = _det (l2->p1.x, l2->p1.y,
l2->p2.x, l2->p2.y);
*y_intersection = _det (l1_det, dy1,
l2_det, dy2) / den_det;
return 1;
}
*/
static cairo_fixed_16_16_t
_compute_x (cairo_line_t *line, cairo_fixed_t y)
{
cairo_fixed_16_16_t dx = line->p2.x - line->p1.x;
cairo_fixed_32_32_t ex = (cairo_fixed_48_16_t) (y - line->p1.y) * (cairo_fixed_48_16_t) dx;
cairo_fixed_16_16_t dy = line->p2.y - line->p1.y;
return line->p1.x + (ex / dy);
}
static double
_compute_inverse_slope (cairo_line_t *l)
{
return (_cairo_fixed_to_double (l->p2.x - l->p1.x) /
_cairo_fixed_to_double (l->p2.y - l->p1.y));
}
static double
_compute_x_intercept (cairo_line_t *l, double inverse_slope)
{
return _cairo_fixed_to_double (l->p1.x) - inverse_slope * _cairo_fixed_to_double (l->p1.y);
}
static int
_line_segs_intersect_ceil (cairo_line_t *l1, cairo_line_t *l2, cairo_fixed_t *y_ret)
{
/*
* x = m1y + b1
* x = m2y + b2
* m1y + b1 = m2y + b2
* y * (m1 - m2) = b2 - b1
* y = (b2 - b1) / (m1 - m2)
*/
cairo_fixed_16_16_t y_intersect;
double m1 = _compute_inverse_slope (l1);
double b1 = _compute_x_intercept (l1, m1);
double m2 = _compute_inverse_slope (l2);
double b2 = _compute_x_intercept (l2, m2);
if (m1 == m2)
return 0;
y_intersect = _cairo_fixed_from_double ((b2 - b1) / (m1 - m2));
if (m1 < m2) {
cairo_line_t *t;
t = l1;
l1 = l2;
l2 = t;
}
/* Assuming 56 bits of floating point precision, the intersection
is accurate within one sub-pixel coordinate. We must ensure
that we return a value that is at or after the intersection. At
most, we must increment once. */
if (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
y_intersect++;
/* XXX: Hmm... Keith's error calculations said we'd at most be off
by one sub-pixel. But, I found that the paint-fill-BE-01.svg
test from the W3C SVG conformance suite definitely requires two
increments.
It could be that we need one to overcome the error, and another
to round up.
It would be nice to be sure this code is correct, (but we can't
do the while loop as it will work for way to long on
exceedingly distant intersections with large errors that we
really don't care about anyway as they will be ignored by the
calling function.
*/
if (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
y_intersect++;
/* XXX: hmm... now I found "intersection_killer" inside xrspline.c
that requires 3 increments. Clearly, we haven't characterized
this completely yet. */
if (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
y_intersect++;
/* I think I've found the answer to our problems. The insight is
that everytime we round we are changing the slopes of the
relevant lines, so we may be introducing new intersections that
we miss, so everything breaks apart. John Hobby wrote a paper
on how to fix this:
[Hobby93c] John D. Hobby, Practical Segment Intersection with
Finite Precision Output, Computation Geometry Theory and
Applications, 13(4), 1999.
Available online (2003-08017):
http://cm.bell-labs.com/cm/cs/doc/93/2-27.ps.gz
Now we just need to go off and implement that.
*/
*y_ret = y_intersect;
return 1;
}
/* The algorithm here is pretty simple:
inactive = [edges]
y = min_p1_y (inactive)
while (num_active || num_inactive) {
active = all edges containing y
next_y = min ( min_p2_y (active), min_p1_y (inactive), min_intersection (active) )
fill_traps (active, y, next_y, fill_rule)
y = next_y
}
The invariants that hold during fill_traps are:
All edges in active contain both y and next_y
No edges in active intersect within y and next_y
These invariants mean that fill_traps is as simple as sorting the
active edges, forming a trapezoid between each adjacent pair. Then,
either the even-odd or winding rule is used to determine whether to
emit each of these trapezoids.
Warning: This function obliterates the edges of the polygon provided.
*/
cairo_status_t
_cairo_traps_tessellate_polygon (cairo_traps_t *traps,
cairo_polygon_t *poly,
cairo_fill_rule_t fill_rule)
{
cairo_status_t status;
int i, active, inactive;
cairo_fixed_t y, y_next, intersect;
int in_out, num_edges = poly->num_edges;
cairo_edge_t *edges = poly->edges;
if (num_edges == 0)
return CAIRO_STATUS_SUCCESS;
qsort (edges, num_edges, sizeof (cairo_edge_t), _compare_cairo_edge_by_top);
y = edges[0].edge.p1.y;
active = 0;
inactive = 0;
while (active < num_edges) {
while (inactive < num_edges && edges[inactive].edge.p1.y <= y)
inactive++;
for (i = active; i < inactive; i++)
edges[i].current_x = _compute_x (&edges[i].edge, y);
qsort (&edges[active], inactive - active,
sizeof (cairo_edge_t), _compare_cairo_edge_by_current_x_slope);
/* find next inflection point */
y_next = edges[active].edge.p2.y;
for (i = active; i < inactive; i++) {
if (edges[i].edge.p2.y < y_next)
y_next = edges[i].edge.p2.y;
/* check intersect */
if (i != inactive - 1 && edges[i].current_x != edges[i+1].current_x)
if (_line_segs_intersect_ceil (&edges[i].edge, &edges[i+1].edge,
&intersect))
if (intersect > y && intersect < y_next)
y_next = intersect;
}
/* check next inactive point */
if (inactive < num_edges && edges[inactive].edge.p1.y < y_next)
y_next = edges[inactive].edge.p1.y;
/* walk the active edges generating trapezoids */
in_out = 0;
for (i = active; i < inactive - 1; i++) {
if (fill_rule == CAIRO_FILL_RULE_WINDING) {
if (edges[i].clockWise)
in_out++;
else
in_out--;
if (in_out == 0)
continue;
} else {
in_out++;
if ((in_out & 1) == 0)
continue;
}
status = _cairo_traps_add_trap (traps, y, y_next, &edges[i].edge, &edges[i+1].edge);
if (status)
return status;
}
/* delete inactive edges */
for (i = active; i < inactive; i++) {
if (edges[i].edge.p2.y <= y_next) {
memmove (&edges[active+1], &edges[active], (i - active) * sizeof (cairo_edge_t));
active++;
}
}
y = y_next;
}
return CAIRO_STATUS_SUCCESS;
}
static int
_cairo_trap_contains (cairo_trapezoid_t *t, cairo_point_t *pt)
{
cairo_slope_t slope_left, slope_pt, slope_right;
if (t->top > pt->y)
return 0;
if (t->bottom < pt->y)
return 0;
_cairo_slope_init (&slope_left, &t->left.p1, &t->left.p2);
_cairo_slope_init (&slope_pt, &t->left.p1, pt);
if (_cairo_slope_compare (&slope_left, &slope_pt) < 0)
return 0;
_cairo_slope_init (&slope_right, &t->right.p1, &t->right.p2);
_cairo_slope_init (&slope_pt, &t->right.p1, pt);
if (_cairo_slope_compare (&slope_pt, &slope_right) < 0)
return 0;
return 1;
}
int
_cairo_traps_contain (cairo_traps_t *traps, double x, double y)
{
int i;
cairo_point_t point;
point.x = _cairo_fixed_from_double (x);
point.y = _cairo_fixed_from_double (y);
for (i = 0; i < traps->num_traps; i++) {
if (_cairo_trap_contains (&traps->traps[i], &point))
return 1;
}
return 0;
}
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
static void
_cairo_trap_extents (cairo_trapezoid_t *t, cairo_box_t *extents)
{
cairo_fixed_t x;
if (t->top < extents->p1.y)
extents->p1.y = t->top;
if (t->bottom > extents->p2.y)
extents->p2.y = t->bottom;
x = MIN (_compute_x (&t->left, t->top),
_compute_x (&t->left, t->bottom));
if (x < extents->p1.x)
extents->p1.x = x;
x = MAX (_compute_x (&t->right, t->top),
_compute_x (&t->right, t->bottom));
if (x > extents->p2.x)
extents->p2.x = x;
}
void
_cairo_traps_extents (cairo_traps_t *traps, cairo_box_t *extents)
{
int i;
extents->p1.x = extents->p1.y = CAIRO_MAXSHORT << 16;
extents->p2.x = extents->p2.y = CAIRO_MINSHORT << 16;
for (i = 0; i < traps->num_traps; i++)
_cairo_trap_extents (&traps->traps[i], extents);
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,810 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Carl D. Worth <cworth@isi.edu>
*/
#include "cairoint.h"
cairo_surface_t *
cairo_xcb_surface_create (XCBConnection *dpy,
XCBDRAWABLE drawable,
XCBVISUALTYPE *visual,
cairo_format_t format);
#define AllPlanes ((unsigned long)~0L)
static XCBRenderPICTFORMAT
format_from_visual(XCBConnection *c, XCBVISUALID visual)
{
static const XCBRenderPICTFORMAT nil = { 0 };
XCBRenderQueryPictFormatsRep *r;
XCBRenderPICTSCREENIter si;
XCBRenderPICTDEPTHIter di;
XCBRenderPICTVISUALIter vi;
r = XCBRenderQueryPictFormatsReply(c, XCBRenderQueryPictFormats(c), 0);
if(!r)
return nil;
for(si = XCBRenderQueryPictFormatsScreensIter(r); si.rem; XCBRenderPICTSCREENNext(&si))
for(di = XCBRenderPICTSCREENDepthsIter(si.data); di.rem; XCBRenderPICTDEPTHNext(&di))
for(vi = XCBRenderPICTDEPTHVisualsIter(di.data); vi.rem; XCBRenderPICTVISUALNext(&vi))
if(vi.data->visual.id == visual.id)
{
XCBRenderPICTFORMAT ret = vi.data->format;
free(r);
return ret;
}
return nil;
}
static XCBRenderPICTFORMAT
format_from_cairo(XCBConnection *c, cairo_format_t fmt)
{
XCBRenderPICTFORMAT ret = { 0 };
struct tmpl_t {
XCBRenderDIRECTFORMAT direct;
CARD8 depth;
};
static const struct tmpl_t templates[] = {
/* CAIRO_FORMAT_ARGB32 */
{
{
16, 0xff,
8, 0xff,
0, 0xff,
24, 0xff
},
32
},
/* CAIRO_FORMAT_RGB24 */
{
{
16, 0xff,
8, 0xff,
0, 0xff,
0, 0x00
},
24
},
/* CAIRO_FORMAT_A8 */
{
{
0, 0x00,
0, 0x00,
0, 0x00,
0, 0xff
},
8
},
/* CAIRO_FORMAT_A1 */
{
{
0, 0x00,
0, 0x00,
0, 0x00,
0, 0x01
},
1
},
};
const struct tmpl_t *tmpl;
XCBRenderQueryPictFormatsRep *r;
XCBRenderPICTFORMINFOIter fi;
if(fmt < 0 || fmt >= (sizeof(templates) / sizeof(*templates)))
return ret;
tmpl = templates + fmt;
r = XCBRenderQueryPictFormatsReply(c, XCBRenderQueryPictFormats(c), 0);
if(!r)
return ret;
for(fi = XCBRenderQueryPictFormatsFormatsIter(r); fi.rem; XCBRenderPICTFORMINFONext(&fi))
{
const XCBRenderDIRECTFORMAT *t, *f;
if(fi.data->type != XCBRenderPictTypeDirect)
continue;
if(fi.data->depth != tmpl->depth)
continue;
t = &tmpl->direct;
f = &fi.data->direct;
if(t->red_mask && (t->red_mask != f->red_mask || t->red_shift != f->red_shift))
continue;
if(t->green_mask && (t->green_mask != f->green_mask || t->green_shift != f->green_shift))
continue;
if(t->blue_mask && (t->blue_mask != f->blue_mask || t->blue_shift != f->blue_shift))
continue;
if(t->alpha_mask && (t->alpha_mask != f->alpha_mask || t->alpha_shift != f->alpha_shift))
continue;
ret = fi.data->id;
}
free(r);
return ret;
}
void
cairo_set_target_xcb (cairo_t *cr,
XCBConnection *dpy,
XCBDRAWABLE drawable,
XCBVISUALTYPE *visual,
cairo_format_t format)
{
cairo_surface_t *surface;
if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
return;
surface = cairo_xcb_surface_create (dpy, drawable, visual, format);
if (surface == NULL) {
cr->status = CAIRO_STATUS_NO_MEMORY;
return;
}
cairo_set_target_surface (cr, surface);
/* cairo_set_target_surface takes a reference, so we must destroy ours */
cairo_surface_destroy (surface);
}
typedef struct cairo_xcb_surface {
cairo_surface_t base;
XCBConnection *dpy;
XCBGCONTEXT gc;
XCBDRAWABLE drawable;
int owns_pixmap;
XCBVISUALTYPE *visual;
cairo_format_t format;
int render_major;
int render_minor;
int width;
int height;
XCBRenderPICTURE picture;
} cairo_xcb_surface_t;
#define CAIRO_SURFACE_RENDER_AT_LEAST(surface, major, minor) \
(((surface)->render_major > major) || \
(((surface)->render_major == major) && ((surface)->render_minor >= minor)))
#define CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 0)
#define CAIRO_SURFACE_RENDER_HAS_COMPOSITE(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 0)
#define CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLE(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 1)
#define CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLES(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 1)
#define CAIRO_SURFACE_RENDER_HAS_DISJOINT(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 2)
#define CAIRO_SURFACE_RENDER_HAS_CONJOINT(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 2)
#define CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
#define CAIRO_SURFACE_RENDER_HAS_TRIANGLES(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
#define CAIRO_SURFACE_RENDER_HAS_TRISTRIP(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
#define CAIRO_SURFACE_RENDER_HAS_TRIFAN(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 4)
#define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
#define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
static int
_CAIRO_FORMAT_DEPTH (cairo_format_t format)
{
switch (format) {
case CAIRO_FORMAT_A1:
return 1;
case CAIRO_FORMAT_A8:
return 8;
case CAIRO_FORMAT_RGB24:
return 24;
case CAIRO_FORMAT_ARGB32:
default:
return 32;
}
}
static cairo_surface_t *
_cairo_xcb_surface_create_similar (void *abstract_src,
cairo_format_t format,
int drawable,
int width,
int height)
{
cairo_xcb_surface_t *src = abstract_src;
XCBConnection *dpy = src->dpy;
XCBDRAWABLE d;
cairo_xcb_surface_t *surface;
/* XXX: There's a pretty lame heuristic here. This assumes that
* all non-Render X servers do not support depth-32 pixmaps, (and
* that they do support depths 1, 8, and 24). Obviously, it would
* be much better to check the depths that are actually
* supported. */
if (!dpy
|| (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (src)
&& format == CAIRO_FORMAT_ARGB32))
{
return NULL;
}
d.pixmap = XCBPIXMAPNew (dpy);
XCBCreatePixmap (dpy, _CAIRO_FORMAT_DEPTH (format),
d.pixmap, src->drawable,
width, height);
surface = (cairo_xcb_surface_t *)
cairo_xcb_surface_create (dpy, d, NULL, format);
surface->owns_pixmap = 1;
surface->width = width;
surface->height = height;
return &surface->base;
}
static void
_cairo_xcb_surface_destroy (void *abstract_surface)
{
cairo_xcb_surface_t *surface = abstract_surface;
if (surface->picture.xid)
XCBRenderFreePicture (surface->dpy, surface->picture);
if (surface->owns_pixmap)
XCBFreePixmap (surface->dpy, surface->drawable.pixmap);
if (surface->gc.xid)
XCBFreeGC (surface->dpy, surface->gc);
surface->dpy = 0;
free (surface);
}
static double
_cairo_xcb_surface_pixels_per_inch (void *abstract_surface)
{
/* XXX: We should really get this value from somewhere like Xft.dpy */
return 96.0;
}
static int
bits_per_pixel(XCBConnection *c, int depth)
{
XCBFORMAT *fmt = XCBConnSetupSuccessRepPixmapFormats(XCBGetSetup(c));
XCBFORMAT *fmtend = fmt + XCBConnSetupSuccessRepPixmapFormatsLength(XCBGetSetup(c));
for(; fmt != fmtend; ++fmt)
if(fmt->depth == depth)
return fmt->bits_per_pixel;
if(depth <= 4)
return 4;
if(depth <= 8)
return 8;
if(depth <= 16)
return 16;
return 32;
}
static int
bytes_per_line(XCBConnection *c, int width, int bpp)
{
int bitmap_pad = XCBGetSetup(c)->bitmap_format_scanline_pad;
return ((bpp * width + bitmap_pad - 1) & -bitmap_pad) >> 3;
}
static cairo_image_surface_t *
_cairo_xcb_surface_get_image (void *abstract_surface)
{
cairo_xcb_surface_t *surface = abstract_surface;
cairo_image_surface_t *image;
XCBGetGeometryRep *geomrep;
XCBGetImageRep *imagerep;
int bpp;
geomrep = XCBGetGeometryReply(surface->dpy, XCBGetGeometry(surface->dpy, surface->drawable), 0);
if(!geomrep)
return 0;
surface->width = geomrep->width;
surface->height = geomrep->height;
free(geomrep);
imagerep = XCBGetImageReply(surface->dpy,
XCBGetImage(surface->dpy, ZPixmap,
surface->drawable,
0, 0,
surface->width, surface->height,
AllPlanes), 0);
if(!imagerep)
return 0;
bpp = bits_per_pixel(surface->dpy, imagerep->depth);
if (surface->visual) {
cairo_format_masks_t masks;
/* XXX: Add support here for pictures with external alpha? */
masks.bpp = bpp;
masks.alpha_mask = 0;
masks.red_mask = surface->visual->red_mask;
masks.green_mask = surface->visual->green_mask;
masks.blue_mask = surface->visual->blue_mask;
image = _cairo_image_surface_create_with_masks (XCBGetImageData(imagerep),
&masks,
surface->width,
surface->height,
bytes_per_line(surface->dpy, surface->width, bpp));
} else {
image = (cairo_image_surface_t *)
cairo_image_surface_create_for_data (XCBGetImageData(imagerep),
surface->format,
surface->width,
surface->height,
bytes_per_line(surface->dpy, surface->width, bpp));
}
/* Let the surface take ownership of the data */
/* XXX: Can probably come up with a cleaner API here. */
_cairo_image_surface_assume_ownership_of_data (image);
/* FIXME: imagerep can't be freed correctly, I think. must copy. :-( */
_cairo_image_surface_set_repeat (image, surface->base.repeat);
_cairo_image_surface_set_matrix (image, &(surface->base.matrix));
return image;
}
static void
_cairo_xcb_surface_ensure_gc (cairo_xcb_surface_t *surface)
{
if (surface->gc.xid)
return;
surface->gc = XCBGCONTEXTNew(surface->dpy);
XCBCreateGC (surface->dpy, surface->gc, surface->drawable, 0, 0);
}
static cairo_status_t
_cairo_xcb_surface_set_image (void *abstract_surface,
cairo_image_surface_t *image)
{
cairo_xcb_surface_t *surface = abstract_surface;
int bpp, data_len;
_cairo_xcb_surface_ensure_gc (surface);
bpp = bits_per_pixel(surface->dpy, image->depth);
data_len = bytes_per_line(surface->dpy, image->width, bpp) * image->height;
XCBPutImage(surface->dpy, ZPixmap, surface->drawable, surface->gc,
image->width,
image->height,
/* dst_x */ 0, /* dst_y */ 0,
/* left_pad */ 0, image->depth,
data_len, image->data);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_xcb_surface_set_matrix (void *abstract_surface, cairo_matrix_t *matrix)
{
cairo_xcb_surface_t *surface = abstract_surface;
XCBRenderTRANSFORM xtransform;
if (!surface->picture.xid)
return CAIRO_STATUS_SUCCESS;
xtransform.matrix11 = _cairo_fixed_from_double (matrix->m[0][0]);
xtransform.matrix12 = _cairo_fixed_from_double (matrix->m[1][0]);
xtransform.matrix13 = _cairo_fixed_from_double (matrix->m[2][0]);
xtransform.matrix21 = _cairo_fixed_from_double (matrix->m[0][1]);
xtransform.matrix22 = _cairo_fixed_from_double (matrix->m[1][1]);
xtransform.matrix23 = _cairo_fixed_from_double (matrix->m[2][1]);
xtransform.matrix31 = 0;
xtransform.matrix32 = 0;
xtransform.matrix33 = _cairo_fixed_from_double (1);
if (CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM (surface))
{
XCBRenderSetPictureTransform (surface->dpy, surface->picture, xtransform);
} else {
/* XXX: Need support here if using an old RENDER without support
for SetPictureTransform */
}
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_xcb_surface_set_filter (void *abstract_surface, cairo_filter_t filter)
{
cairo_xcb_surface_t *surface = abstract_surface;
char *render_filter;
if (!(surface->picture.xid
&& CAIRO_SURFACE_RENDER_HAS_FILTERS(surface)))
return CAIRO_STATUS_SUCCESS;
switch (filter) {
case CAIRO_FILTER_FAST:
render_filter = "fast";
break;
case CAIRO_FILTER_GOOD:
render_filter = "good";
break;
case CAIRO_FILTER_BEST:
render_filter = "best";
break;
case CAIRO_FILTER_NEAREST:
render_filter = "nearest";
break;
case CAIRO_FILTER_BILINEAR:
render_filter = "bilinear";
break;
default:
render_filter = "best";
break;
}
XCBRenderSetPictureFilter(surface->dpy, surface->picture,
strlen(render_filter), render_filter, 0, NULL);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_xcb_surface_set_repeat (void *abstract_surface, int repeat)
{
cairo_xcb_surface_t *surface = abstract_surface;
CARD32 mask = XCBRenderCPRepeat;
CARD32 pa[] = { repeat };
if (!surface->picture.xid)
return CAIRO_STATUS_SUCCESS;
XCBRenderChangePicture (surface->dpy, surface->picture, mask, pa);
return CAIRO_STATUS_SUCCESS;
}
static cairo_xcb_surface_t *
_cairo_xcb_surface_clone_similar (cairo_surface_t *src,
cairo_xcb_surface_t *template,
cairo_format_t format,
int depth)
{
cairo_xcb_surface_t *clone;
cairo_image_surface_t *src_image;
src_image = _cairo_surface_get_image (src);
clone = (cairo_xcb_surface_t *)
_cairo_xcb_surface_create_similar (template, format, 0,
src_image->width,
src_image->height);
if (clone == NULL)
return NULL;
_cairo_xcb_surface_set_filter (clone, cairo_surface_get_filter(src));
_cairo_xcb_surface_set_image (clone, src_image);
_cairo_xcb_surface_set_matrix (clone, &(src_image->base.matrix));
cairo_surface_destroy (&src_image->base);
return clone;
}
static int
_render_operator (cairo_operator_t operator)
{
switch (operator) {
case CAIRO_OPERATOR_CLEAR:
return XCBRenderPictOpClear;
case CAIRO_OPERATOR_SRC:
return XCBRenderPictOpSrc;
case CAIRO_OPERATOR_DST:
return XCBRenderPictOpDst;
case CAIRO_OPERATOR_OVER:
return XCBRenderPictOpOver;
case CAIRO_OPERATOR_OVER_REVERSE:
return XCBRenderPictOpOverReverse;
case CAIRO_OPERATOR_IN:
return XCBRenderPictOpIn;
case CAIRO_OPERATOR_IN_REVERSE:
return XCBRenderPictOpInReverse;
case CAIRO_OPERATOR_OUT:
return XCBRenderPictOpOut;
case CAIRO_OPERATOR_OUT_REVERSE:
return XCBRenderPictOpOutReverse;
case CAIRO_OPERATOR_ATOP:
return XCBRenderPictOpAtop;
case CAIRO_OPERATOR_ATOP_REVERSE:
return XCBRenderPictOpAtopReverse;
case CAIRO_OPERATOR_XOR:
return XCBRenderPictOpXor;
case CAIRO_OPERATOR_ADD:
return XCBRenderPictOpAdd;
case CAIRO_OPERATOR_SATURATE:
return XCBRenderPictOpSaturate;
default:
return XCBRenderPictOpOver;
}
}
static cairo_int_status_t
_cairo_xcb_surface_composite (cairo_operator_t operator,
cairo_surface_t *generic_src,
cairo_surface_t *generic_mask,
void *abstract_dst,
int src_x,
int src_y,
int mask_x,
int mask_y,
int dst_x,
int dst_y,
unsigned int width,
unsigned int height)
{
cairo_xcb_surface_t *dst = abstract_dst;
cairo_xcb_surface_t *src = (cairo_xcb_surface_t *) generic_src;
cairo_xcb_surface_t *mask = (cairo_xcb_surface_t *) generic_mask;
cairo_xcb_surface_t *src_clone = NULL;
cairo_xcb_surface_t *mask_clone = NULL;
XCBRenderPICTURE maskpict = { 0 };
if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst))
return CAIRO_INT_STATUS_UNSUPPORTED;
if (generic_src->backend != dst->base.backend || src->dpy != dst->dpy) {
src_clone = _cairo_xcb_surface_clone_similar (generic_src, dst,
CAIRO_FORMAT_ARGB32, 32);
if (!src_clone)
return CAIRO_INT_STATUS_UNSUPPORTED;
src = src_clone;
}
if (generic_mask && (generic_mask->backend != dst->base.backend || mask->dpy != dst->dpy)) {
mask_clone = _cairo_xcb_surface_clone_similar (generic_mask, dst,
CAIRO_FORMAT_A8, 8);
if (!mask_clone)
return CAIRO_INT_STATUS_UNSUPPORTED;
mask = mask_clone;
}
if(mask)
maskpict = mask->picture;
XCBRenderComposite (dst->dpy,
_render_operator (operator),
src->picture,
maskpict,
dst->picture,
src_x, src_y,
mask_x, mask_y,
dst_x, dst_y,
width, height);
/* XXX: This is messed up. If I can xcb_surface_create, then I
should be able to xcb_surface_destroy. */
if (src_clone)
cairo_surface_destroy (&src_clone->base);
if (mask_clone)
cairo_surface_destroy (&mask_clone->base);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_xcb_surface_fill_rectangles (void *abstract_surface,
cairo_operator_t operator,
const cairo_color_t *color,
cairo_rectangle_t *rects,
int num_rects)
{
cairo_xcb_surface_t *surface = abstract_surface;
XCBRenderCOLOR render_color;
if (!CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLE (surface))
return CAIRO_INT_STATUS_UNSUPPORTED;
render_color.red = color->red_short;
render_color.green = color->green_short;
render_color.blue = color->blue_short;
render_color.alpha = color->alpha_short;
/* XXX: This XCBRECTANGLE cast is evil... it needs to go away somehow. */
XCBRenderFillRectangles (surface->dpy,
_render_operator (operator),
surface->picture,
render_color, num_rects, (XCBRECTANGLE *) rects);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_xcb_surface_composite_trapezoids (cairo_operator_t operator,
cairo_surface_t *generic_src,
void *abstract_dst,
int xSrc,
int ySrc,
cairo_trapezoid_t *traps,
int num_traps)
{
cairo_xcb_surface_t *dst = abstract_dst;
cairo_xcb_surface_t *src = (cairo_xcb_surface_t *) generic_src;
cairo_xcb_surface_t *src_clone = NULL;
if (!CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS (dst))
return CAIRO_INT_STATUS_UNSUPPORTED;
if (generic_src->backend != dst->base.backend || src->dpy != dst->dpy) {
src_clone = _cairo_xcb_surface_clone_similar (generic_src, dst,
CAIRO_FORMAT_ARGB32, 32);
if (!src_clone)
return CAIRO_INT_STATUS_UNSUPPORTED;
src = src_clone;
}
/* XXX: The XCBRenderTRAP cast is evil and needs to go away somehow. */
/* XXX: format_from_cairo is slow. should cache something. */
XCBRenderTrapezoids (dst->dpy,
_render_operator (operator),
src->picture, dst->picture,
format_from_cairo (dst->dpy, CAIRO_FORMAT_A8),
xSrc, ySrc, num_traps, (XCBRenderTRAP *) traps);
/* XXX: This is messed up. If I can xcb_surface_create, then I
should be able to xcb_surface_destroy. */
if (src_clone)
cairo_surface_destroy (&src_clone->base);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_xcb_surface_copy_page (void *abstract_surface)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_xcb_surface_show_page (void *abstract_surface)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_xcb_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
/* FIXME */
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_xcb_surface_create_pattern (void *abstract_surface,
cairo_pattern_t *pattern,
cairo_box_t *extents)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static const cairo_surface_backend_t cairo_xcb_surface_backend = {
_cairo_xcb_surface_create_similar,
_cairo_xcb_surface_destroy,
_cairo_xcb_surface_pixels_per_inch,
_cairo_xcb_surface_get_image,
_cairo_xcb_surface_set_image,
_cairo_xcb_surface_set_matrix,
_cairo_xcb_surface_set_filter,
_cairo_xcb_surface_set_repeat,
_cairo_xcb_surface_composite,
_cairo_xcb_surface_fill_rectangles,
_cairo_xcb_surface_composite_trapezoids,
_cairo_xcb_surface_copy_page,
_cairo_xcb_surface_show_page,
_cairo_xcb_surface_set_clip_region,
_cairo_xcb_surface_create_pattern,
NULL /* show_glyphs */
};
static void
query_render_version (XCBConnection *c, cairo_xcb_surface_t *surface)
{
XCBRenderQueryVersionRep *r;
surface->render_major = -1;
surface->render_minor = -1;
if (!XCBRenderInit(c))
return;
r = XCBRenderQueryVersionReply(c, XCBRenderQueryVersion(c, 0, 6), 0);
if (!r)
return;
surface->render_major = r->major_version;
surface->render_minor = r->minor_version;
free(r);
}
cairo_surface_t *
cairo_xcb_surface_create (XCBConnection *dpy,
XCBDRAWABLE drawable,
XCBVISUALTYPE *visual,
cairo_format_t format)
{
cairo_xcb_surface_t *surface;
surface = malloc (sizeof (cairo_xcb_surface_t));
if (surface == NULL)
return NULL;
_cairo_surface_init (&surface->base, &cairo_xcb_surface_backend);
surface->dpy = dpy;
surface->gc.xid = 0;
surface->drawable = drawable;
surface->owns_pixmap = 0;
surface->visual = visual;
surface->format = format;
query_render_version(dpy, surface);
if (CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE (surface))
{
XCBRenderPICTFORMAT fmt;
if(visual)
fmt = format_from_visual (dpy, visual->visual_id);
else
fmt = format_from_cairo (dpy, format);
surface->picture = XCBRenderPICTURENew(dpy);
XCBRenderCreatePicture (dpy, surface->picture, drawable,
fmt, 0, NULL);
}
else
surface->picture.xid = 0;
return (cairo_surface_t *) surface;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,64 @@
# All new test cases go here
TESTS = \
fill_rule \
leaky_polygon \
line_width \
move_to_show_surface \
text_cache_crash \
text_rotate
# And all new test go here too. I really don't like having to repeat
# this list. Anyone know a good way to avoid it? Can I use a wildcard
# here?
EXTRA_DIST = \
fill_rule-ref.png \
leaky_polygon-ref.png \
line_width-ref.png \
move_to_show_surface-ref.png
# Once we can draw the text_rotate.c test case correctly, we should
# create and add text_rotate-ref.png to the list of reference PNGs.
# This list is only for known bugs (not regressions). We do need to
# fix these before the next release, but they are expected to fail for
# now, so they don't need to hold up any new code commit.
#
# When new bugs are found in committed code they can be listed
# here. New failures due to local, uncommitted code changes are
# regression bugs that should not be listed here. Instead they should
# be fixed before the code is committed.
XFAIL_TESTS = \
move_to_show_surface \
text_rotate
check_PROGRAMS = $(TESTS)
# We're using _GNU_SOURCE to get the prototype for asprintf. This may
# not be the most portable approach, but it is pragmatic and I'm
# willing to do something cleaner as soon as it causes someone a
# problem.
INCLUDES = -D_GNU_SOURCE -I$(srcdir) $(CAIRO_CFLAGS) -I$(srcdir)/../src
AM_LDFLAGS = $(CAIRO_LIBS) ../src/libcairo.la
cairo_test_lib =\
cairo_test.c \
cairo_test.h \
read_png.c \
read_png.h \
write_png.c \
write_png.h \
xmalloc.c \
xmalloc.h
# ARGH! I have to repeat the list of tests a third time. Maybe it's
# time to break down and auto-generate the Makefile.am or something
# from autogen.sh. My, but this is painful...
fill_rule_SOURCES = fill_rule.c $(cairo_test_lib)
leaky_polygon_SOURCES = leaky_polygon.c $(cairo_test_lib)
line_width_SOURCES = line_width.c $(cairo_test_lib)
move_to_show_surface_SOURCES = move_to_show_surface.c $(cairo_test_lib)
text_cache_crash_SOURCES = text_cache_crash.c $(cairo_test_lib)
text_rotate_SOURCES = text_rotate.c $(cairo_test_lib)
CLEANFILES = *-out.png *-diff.png

Просмотреть файл

@ -0,0 +1,665 @@
# Makefile.in generated by automake 1.9.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = $(fill_rule_SOURCES) $(leaky_polygon_SOURCES) $(line_width_SOURCES) $(move_to_show_surface_SOURCES) $(text_cache_crash_SOURCES) $(text_rotate_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = $(am__EXEEXT_1)
subdir = test
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__EXEEXT_1 = fill_rule$(EXEEXT) leaky_polygon$(EXEEXT) \
line_width$(EXEEXT) move_to_show_surface$(EXEEXT) \
text_cache_crash$(EXEEXT) text_rotate$(EXEEXT)
am__objects_1 = cairo_test.$(OBJEXT) read_png.$(OBJEXT) \
write_png.$(OBJEXT) xmalloc.$(OBJEXT)
am_fill_rule_OBJECTS = fill_rule.$(OBJEXT) $(am__objects_1)
fill_rule_OBJECTS = $(am_fill_rule_OBJECTS)
fill_rule_LDADD = $(LDADD)
am_leaky_polygon_OBJECTS = leaky_polygon.$(OBJEXT) $(am__objects_1)
leaky_polygon_OBJECTS = $(am_leaky_polygon_OBJECTS)
leaky_polygon_LDADD = $(LDADD)
am_line_width_OBJECTS = line_width.$(OBJEXT) $(am__objects_1)
line_width_OBJECTS = $(am_line_width_OBJECTS)
line_width_LDADD = $(LDADD)
am_move_to_show_surface_OBJECTS = move_to_show_surface.$(OBJEXT) \
$(am__objects_1)
move_to_show_surface_OBJECTS = $(am_move_to_show_surface_OBJECTS)
move_to_show_surface_LDADD = $(LDADD)
am_text_cache_crash_OBJECTS = text_cache_crash.$(OBJEXT) \
$(am__objects_1)
text_cache_crash_OBJECTS = $(am_text_cache_crash_OBJECTS)
text_cache_crash_LDADD = $(LDADD)
am_text_rotate_OBJECTS = text_rotate.$(OBJEXT) $(am__objects_1)
text_rotate_OBJECTS = $(am_text_rotate_OBJECTS)
text_rotate_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(fill_rule_SOURCES) $(leaky_polygon_SOURCES) \
$(line_width_SOURCES) $(move_to_show_surface_SOURCES) \
$(text_cache_crash_SOURCES) $(text_rotate_SOURCES)
DIST_SOURCES = $(fill_rule_SOURCES) $(leaky_polygon_SOURCES) \
$(line_width_SOURCES) $(move_to_show_surface_SOURCES) \
$(text_cache_crash_SOURCES) $(text_rotate_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ATSUI_FONT_FEATURE = @ATSUI_FONT_FEATURE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_HAS_ATSUI_FONT_FALSE = @CAIRO_HAS_ATSUI_FONT_FALSE@
CAIRO_HAS_ATSUI_FONT_TRUE = @CAIRO_HAS_ATSUI_FONT_TRUE@
CAIRO_HAS_FT_FONT_FALSE = @CAIRO_HAS_FT_FONT_FALSE@
CAIRO_HAS_FT_FONT_TRUE = @CAIRO_HAS_FT_FONT_TRUE@
CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@
CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@
CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@
CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@
CAIRO_HAS_PNG_SURFACE_FALSE = @CAIRO_HAS_PNG_SURFACE_FALSE@
CAIRO_HAS_PNG_SURFACE_TRUE = @CAIRO_HAS_PNG_SURFACE_TRUE@
CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@
CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@
CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@
CAIRO_HAS_QUARTZ_SURFACE_TRUE = @CAIRO_HAS_QUARTZ_SURFACE_TRUE@
CAIRO_HAS_XCB_SURFACE_FALSE = @CAIRO_HAS_XCB_SURFACE_FALSE@
CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@
CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@
CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
FREETYPE_CONFIG = @FREETYPE_CONFIG@
FREETYPE_LIBS = @FREETYPE_LIBS@
FT_FONT_FEATURE = @FT_FONT_FEATURE@
GLITZ_CFLAGS = @GLITZ_CFLAGS@
GLITZ_LIBS = @GLITZ_LIBS@
GLITZ_REQUIRES = @GLITZ_REQUIRES@
GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PDF_LIBS = @PDF_LIBS@
PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@
PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES = @PNG_REQUIRES@
PNG_SURFACE_FEATURE = @PNG_SURFACE_FEATURE@
PS_LIBS = @PS_LIBS@
PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@
QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@
RANLIB = @RANLIB@
SANITY_CHECKING_FEATURE = @SANITY_CHECKING_FEATURE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_INFO = @VERSION_INFO@
XCB_CFLAGS = @XCB_CFLAGS@
XCB_LIBS = @XCB_LIBS@
XCB_SURFACE_FEATURE = @XCB_SURFACE_FEATURE@
XLIB_SURFACE_FEATURE = @XLIB_SURFACE_FEATURE@
XRENDER_CFLAGS = @XRENDER_CFLAGS@
XRENDER_LIBS = @XRENDER_LIBS@
XRENDER_REQUIRES = @XRENDER_REQUIRES@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
# All new test cases go here
TESTS = \
fill_rule \
leaky_polygon \
line_width \
move_to_show_surface \
text_cache_crash \
text_rotate
# And all new test go here too. I really don't like having to repeat
# this list. Anyone know a good way to avoid it? Can I use a wildcard
# here?
EXTRA_DIST = \
fill_rule-ref.png \
leaky_polygon-ref.png \
line_width-ref.png \
move_to_show_surface-ref.png
# Once we can draw the text_rotate.c test case correctly, we should
# create and add text_rotate-ref.png to the list of reference PNGs.
# This list is only for known bugs (not regressions). We do need to
# fix these before the next release, but they are expected to fail for
# now, so they don't need to hold up any new code commit.
#
# When new bugs are found in committed code they can be listed
# here. New failures due to local, uncommitted code changes are
# regression bugs that should not be listed here. Instead they should
# be fixed before the code is committed.
XFAIL_TESTS = \
move_to_show_surface \
text_rotate
# We're using _GNU_SOURCE to get the prototype for asprintf. This may
# not be the most portable approach, but it is pragmatic and I'm
# willing to do something cleaner as soon as it causes someone a
# problem.
INCLUDES = -D_GNU_SOURCE -I$(srcdir) $(CAIRO_CFLAGS) -I$(srcdir)/../src
AM_LDFLAGS = $(CAIRO_LIBS) ../src/libcairo.la
cairo_test_lib = \
cairo_test.c \
cairo_test.h \
read_png.c \
read_png.h \
write_png.c \
write_png.h \
xmalloc.c \
xmalloc.h
# ARGH! I have to repeat the list of tests a third time. Maybe it's
# time to break down and auto-generate the Makefile.am or something
# from autogen.sh. My, but this is painful...
fill_rule_SOURCES = fill_rule.c $(cairo_test_lib)
leaky_polygon_SOURCES = leaky_polygon.c $(cairo_test_lib)
line_width_SOURCES = line_width.c $(cairo_test_lib)
move_to_show_surface_SOURCES = move_to_show_surface.c $(cairo_test_lib)
text_cache_crash_SOURCES = text_cache_crash.c $(cairo_test_lib)
text_rotate_SOURCES = text_rotate.c $(cairo_test_lib)
CLEANFILES = *-out.png *-diff.png
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu test/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
fill_rule$(EXEEXT): $(fill_rule_OBJECTS) $(fill_rule_DEPENDENCIES)
@rm -f fill_rule$(EXEEXT)
$(LINK) $(fill_rule_LDFLAGS) $(fill_rule_OBJECTS) $(fill_rule_LDADD) $(LIBS)
leaky_polygon$(EXEEXT): $(leaky_polygon_OBJECTS) $(leaky_polygon_DEPENDENCIES)
@rm -f leaky_polygon$(EXEEXT)
$(LINK) $(leaky_polygon_LDFLAGS) $(leaky_polygon_OBJECTS) $(leaky_polygon_LDADD) $(LIBS)
line_width$(EXEEXT): $(line_width_OBJECTS) $(line_width_DEPENDENCIES)
@rm -f line_width$(EXEEXT)
$(LINK) $(line_width_LDFLAGS) $(line_width_OBJECTS) $(line_width_LDADD) $(LIBS)
move_to_show_surface$(EXEEXT): $(move_to_show_surface_OBJECTS) $(move_to_show_surface_DEPENDENCIES)
@rm -f move_to_show_surface$(EXEEXT)
$(LINK) $(move_to_show_surface_LDFLAGS) $(move_to_show_surface_OBJECTS) $(move_to_show_surface_LDADD) $(LIBS)
text_cache_crash$(EXEEXT): $(text_cache_crash_OBJECTS) $(text_cache_crash_DEPENDENCIES)
@rm -f text_cache_crash$(EXEEXT)
$(LINK) $(text_cache_crash_LDFLAGS) $(text_cache_crash_OBJECTS) $(text_cache_crash_LDADD) $(LIBS)
text_rotate$(EXEEXT): $(text_rotate_OBJECTS) $(text_rotate_DEPENDENCIES)
@rm -f text_rotate$(EXEEXT)
$(LINK) $(text_rotate_LDFLAGS) $(text_rotate_OBJECTS) $(text_rotate_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fill_rule.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/leaky_polygon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_width.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move_to_show_surface.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_png.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text_cache_crash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text_rotate.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write_png.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

Просмотреть файл

@ -0,0 +1,64 @@
Regression test suite for cairo.
Using this test should be as simple as running:
make check
assuming that the cairo distribution in the directory above has been
configured and built. The test suite here goes through some effort to
run against the locally compiled library rather than any installed
version.
The test suite needs to be run before any code is committed and before
any release. Here are the rules governing the use of the suite:
Before committing
-----------------
All tests should return a result of PASS or XFAIL. The XFAIL results
indicate known bugs. The final message should be one of the following:
All XX tests behaved as expected (YY expected failures)
All XX tests passed
If any tests have a status of FAIL, then the new code has caused a
regression error which should be fixed before the code is committed.
When a new bug is found
-----------------------
A new test case should be added by imitating the style of an existing
test. This means adding the following files:
new_bug.c
new_bug-ref.png
Where new_bug.c is a minimal program to demonstrate the bug, following
the style of existing tests. The new_bug-ref.png image should contain
the desired result of new_bug.c if the bug were fixed.
Makefile.am should be edited, adding new_bug.c to both the TESTS and
XFAIL_TESTS lists.
When a new feature is added
---------------------------
It's important for the regression suite to keep pace with development
of the library. So a new test should be added for each new
feature. The work involved is similar the work described above for new
bugs. The only distinction is that the test is expected to pass so it
should not be added to the XFAIL_TESTS list.
When a bug is fixed
-------------------
The fix should be verified by running the test suite which should
result in an "unexpected pass" for the test of interest. Rejoice as
appropriate, then remove the relevant file name from the XFAIL_TESTS
variable in Makefile.am.
Before releasing
----------------
All tests should return a result of PASS meaning all known bugs are
fixed, resulting in the happy message:
All XX tests passed

Просмотреть файл

@ -0,0 +1,209 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "cairo_test.h"
#include "read_png.h"
#include "write_png.h"
#include "xmalloc.h"
#define CAIRO_TEST_PNG_SUFFIX "-out.png"
#define CAIRO_TEST_REF_SUFFIX "-ref.png"
#define CAIRO_TEST_DIFF_SUFFIX "-diff.png"
static void
xasprintf (char **strp, const char *fmt, ...)
{
va_list va;
int ret;
va_start (va, fmt);
ret = vasprintf (strp, fmt, va);
va_end (va);
if (ret < 0) {
fprintf (stderr, "Out of memory\n");
exit (1);
}
}
/* Image comparison code courttesy of Richard Worth.
* Returns number of pixels changed.
* Also fills out a "diff" image intended to visually show where the
* images differ.
*/
static int
image_diff (char *buf_a, char *buf_b, char *buf_diff,
int width, int height, int stride)
{
int x, y;
int total_pixels_changed = 0;
unsigned char *row_a, *row_b, *row;
for (y = 0; y < height; y++)
{
row_a = buf_a + y * stride;
row_b = buf_b + y * stride;
row = buf_diff + y * stride;
for (x = 0; x < width; x++)
{
int channel;
unsigned char value_a, value_b;
int pixel_changed = 0;
for (channel = 0; channel < 4; channel++)
{
double diff;
value_a = row_a[x * 4 + channel];
value_b = row_b[x * 4 + channel];
if (value_a != value_b)
pixel_changed = 1;
diff = value_a - value_b;
row[x * 4 + channel] = 128 + diff / 3.0;
}
if (pixel_changed) {
total_pixels_changed++;
} else {
row[x*4+0] = 0;
row[x*4+1] = 0;
row[x*4+2] = 0;
}
row[x * 4 + 3] = 0xff; /* Set ALPHA to 100% (opaque) */
}
}
return total_pixels_changed;
}
cairo_test_status_t
cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw)
{
cairo_t *cr;
int stride;
unsigned char *png_buf, *ref_buf, *diff_buf;
char *png_name, *ref_name, *diff_name;
char *srcdir;
int pixels_changed;
int ref_width, ref_height, ref_stride;
read_png_status_t png_status;
cairo_test_status_t ret;
/* The cairo part of the test is the easiest part */
cr = cairo_create ();
stride = 4 * test->width;
png_buf = xcalloc (stride * test->height, 1);
diff_buf = xcalloc (stride * test->height, 1);
cairo_set_target_image (cr, png_buf, CAIRO_FORMAT_ARGB32,
test->width, test->height, stride);
(draw) (cr, test->width, test->height);
cairo_destroy (cr);
/* Skip image check for tests with no image (width,height == 0,0) */
if (test->width == 0 || test->height == 0) {
free (png_buf);
free (diff_buf);
return CAIRO_TEST_SUCCESS;
}
/* Then we've got a bunch of string manipulation and file I/O for the check */
srcdir = getenv ("srcdir");
if (!srcdir)
srcdir = ".";
xasprintf (&png_name, "%s%s", test->name, CAIRO_TEST_PNG_SUFFIX);
xasprintf (&ref_name, "%s/%s%s", srcdir, test->name, CAIRO_TEST_REF_SUFFIX);
xasprintf (&diff_name, "%s%s", test->name, CAIRO_TEST_DIFF_SUFFIX);
write_png_argb32 (png_buf, png_name, test->width, test->height, stride);
ref_buf = NULL;
png_status = (read_png_argb32 (ref_name, &ref_buf, &ref_width, &ref_height, &ref_stride));
if (png_status) {
switch (png_status)
{
case READ_PNG_FILE_NOT_FOUND:
fprintf (stderr, " Error: No reference image found: %s\n", ref_name);
break;
case READ_PNG_FILE_NOT_PNG:
fprintf (stderr, " Error: %s is not a png image\n", ref_name);
break;
default:
fprintf (stderr, " Error: Failed to read %s\n", ref_name);
}
ret = CAIRO_TEST_FAILURE;
goto BAIL;
}
if (test->width != ref_width || test->height != ref_height) {
fprintf (stderr,
" Error: Image size mismatch: (%dx%d) vs. (%dx%d)\n"
" for %s vs %s\n",
test->width, test->height,
ref_width, ref_height,
png_name, ref_name);
ret = CAIRO_TEST_FAILURE;
goto BAIL;
}
pixels_changed = image_diff (png_buf, ref_buf, diff_buf,
test->width, test->height, stride);
if (pixels_changed) {
fprintf (stderr, " Error: %d pixels differ from reference image %s\n",
pixels_changed, ref_name);
write_png_argb32 (diff_buf, diff_name, test->width, test->height, stride);
ret = CAIRO_TEST_FAILURE;
goto BAIL;
} else {
if (unlink (diff_name) < 0 && errno != ENOENT) {
fprintf (stderr, " Error: Cannot remove %s: %s\n",
diff_name, strerror (errno));
ret = CAIRO_TEST_FAILURE;
goto BAIL;
}
}
ret = CAIRO_TEST_SUCCESS;
BAIL:
free (png_buf);
free (ref_buf);
free (diff_buf);
free (png_name);
free (ref_name);
free (diff_name);
return ret;
}

Просмотреть файл

@ -0,0 +1,51 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
#ifndef _CAIRO_TEST_H_
#define _CAIRO_TEST_H_
#include <math.h>
#include <cairo.h>
typedef enum cairo_test_status {
CAIRO_TEST_SUCCESS = 0,
CAIRO_TEST_FAILURE
} cairo_test_status_t;
typedef struct cairo_test {
char *name;
char *description;
int width;
int height;
} cairo_test_t;
typedef void (*cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
/* cairo_test.c */
cairo_test_status_t
cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw);
#endif

Двоичные данные
gfx/cairo/cairo/test/fill_rule-ref.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.9 KiB

Просмотреть файл

@ -0,0 +1,130 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
/* Bug history
*
* 2004-10-27 Carl Worth <cworth@cworth.org>
*
* There's currently a regression bug in the tessellation code. This
* causes each of these simple star shapes to be filled incorrectly.
*
* It looks like right now we can get this test to pass by doing:
*
* cvs update -r 1.16 src/cairo_traps.c
*
* But we don't want to revert that change permanently since it
* really does correct some bugs. It must be that the old version of
* the code is masking some other bugs in the tessellation code. My
* current plan is to back this revision up for the next snapshot,
* but not to list the test as an expected failure since I'm
* planning on doing the new tessellator which should fix this
* problem.
*
* 2005-01-11 Carl Worth <cworth@cworth.org>
*
* Keith committed some fixes that fix the original size-20
* star_path:
*
* * src/cairo_wideint.c: (_cairo_int32x32_64_mul),
* (_cairo_int64x64_128_mul):
* * src/cairo_wideint.h:
* int32x32_64_mul and int64x64_128_mul are different from their
* unsigned compatriots
*
* 2005-01-12 Carl Worth <cworth@cworth.org>
*
* Going back to the SVG test suite, however, the original star
* shape is still broken. Adding both shapes now as little_star_path
* and big_star_path.
*
*/
#include "cairo_test.h"
#define LITTLE_STAR_SIZE 20
#define BIG_STAR_SIZE 80
cairo_test_t test = {
"fill_rule",
"Tests cairo_set_full_rule with some star shapes",
BIG_STAR_SIZE * 2 + 3, BIG_STAR_SIZE + LITTLE_STAR_SIZE + 3
};
/* The SVG start trimmed down, but still showing the bug (originally) */
static void
little_star_path (cairo_t *cr)
{
cairo_move_to (cr, 10, 0);
cairo_rel_line_to (cr, 6, 20);
cairo_rel_line_to (cr, -16, -12);
cairo_rel_line_to (cr, 20, 0);
cairo_rel_line_to (cr, -16, 12);
}
/* The star shape from the SVG test suite. This was is still buggy even after
we got little_star_path working. */
static void
big_star_path (cairo_t *cr)
{
cairo_move_to (cr, 40, 0);
cairo_rel_line_to (cr, 25, 80);
cairo_rel_line_to (cr, -65, -50);
cairo_rel_line_to (cr, 80, 0);
cairo_rel_line_to (cr, -65, 50);
cairo_close_path (cr);
}
/* Fill the same path twice, once with each fill rule */
static void
draw (cairo_t *cr, int width, int height)
{
cairo_set_rgb_color (cr, 1, 0, 0);
cairo_translate (cr, 1, 1);
little_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
cairo_fill (cr);
cairo_translate (cr, LITTLE_STAR_SIZE + 1, 0);
little_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill (cr);
cairo_translate (cr, -(LITTLE_STAR_SIZE + 1), LITTLE_STAR_SIZE + 1);
big_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
cairo_fill (cr);
cairo_translate (cr, BIG_STAR_SIZE + 1, 0);
big_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill (cr);
}
int
main (void)
{
return cairo_test (&test, draw);
}

Двоичные данные
gfx/cairo/cairo/test/leaky_polygon-ref.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 255 B

Просмотреть файл

@ -0,0 +1,82 @@
/*
* Copyright © 2005 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
/* Bug history
*
* 2005-01-07 Carl Worth <cworth@cworth.org>
*
* Bug reported:
*
* From: Chris <fltk@functionalfuture.com>
* Subject: [cairo] Render to image buffer artifacts
* To: cairo@cairographics.org
* Date: Fri, 07 Jan 2005 02:22:28 -0500
*
* I've attached the code and image that shows this off. Scaling at
* different levels seems to change the corruption.
*
* For some reason there are artifacts in the alpha channel. I don't know
* if that's the only place, but the alpha channel looks bad.
*
* If you run the code and parse the attached image, directing stdout to a
* file, you can see in the lower left corner there are alpha values where
* it should be transparent.
* [...]
*
* 2005-01-11 Carl Worth <cworth@cworth.org>
*
* I trimmed the original test case down to the code that appears here.
*
*/
#include "cairo_test.h"
#define WIDTH 21
#define HEIGHT 21
cairo_test_t test = {
"leaky_polygon",
"Exercises a corner case in the trapezoid rasterization in which pixels outside the trapezoids received a non-zero alpha",
WIDTH, HEIGHT
};
static void
draw (cairo_t *cr, int width, int height)
{
cairo_scale (cr, 1.0/(1<<16), 1.0/(1<<16));
cairo_move_to (cr, 131072,39321);
cairo_line_to (cr, 1103072,1288088);
cairo_line_to (cr, 1179648,1294990);
cairo_close_path (cr);
cairo_fill (cr);
}
int
main (void)
{
return cairo_test (&test, draw);
}

Двоичные данные
gfx/cairo/cairo/test/line_width-ref.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 171 B

Просмотреть файл

@ -0,0 +1,63 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
#include "cairo_test.h"
#define LINES 5
#define LINE_LENGTH 10
#define IMAGE_WIDTH 2 * LINE_LENGTH + 6
#define IMAGE_HEIGHT ((LINES+4)*LINES)/2 + 2
cairo_test_t test = {
"line_width",
"Tests cairo_set_line_width",
IMAGE_WIDTH, IMAGE_HEIGHT
};
static void
draw (cairo_t *cr, int width, int height)
{
int i;
cairo_set_rgb_color (cr, 0, 0, 0);
cairo_translate (cr, 2, 2);
for (i=0; i < LINES; i++) {
cairo_set_line_width (cr, i+1);
cairo_move_to (cr, 0, 0);
cairo_rel_line_to (cr, LINE_LENGTH, 0);
cairo_stroke (cr);
cairo_move_to (cr, LINE_LENGTH + 2, 0.5);
cairo_rel_line_to (cr, LINE_LENGTH, 0);
cairo_stroke (cr);
cairo_translate (cr, 0, i+3);
}
}
int
main (void)
{
return cairo_test (&test, draw);
}

Двоичные данные
gfx/cairo/cairo/test/move_to_show_surface-ref.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 100 B

Просмотреть файл

@ -0,0 +1,69 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
/* Bug history
*
* 2004-10-25 Carl Worth <cworth@cworth.org>
*
* It looks like cairo_show_surface has no effect if it follows a
* call to cairo_move_to to any coordinate other than 0,0. A little
* bit of poking around suggests this isn't a regression, (at least
* not since the last pixman snapshot).
*
*/
#include "cairo_test.h"
cairo_test_t test = {
"move_to_show_surface",
"Tests calls to cairo_show_surface after cairo_move_to",
2, 2
};
static void
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
uint32_t colors[4] = {
0xffffffff, 0xffff0000,
0xff00ff00, 0xff0000ff
};
int i;
for (i=0; i < 4; i++) {
surface = cairo_surface_create_for_image ((char *) &colors[i],
CAIRO_FORMAT_ARGB32, 1, 1, 4);
cairo_move_to (cr, i % 2, i / 2);
cairo_show_surface (cr, surface, 1, 1);
cairo_surface_destroy (surface);
}
}
int
main (void)
{
return cairo_test (&test, draw);
}

Просмотреть файл

@ -0,0 +1,166 @@
/*
* Copyright © 2003 USC, Information Sciences Institute
*
* 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 the
* University of Southern California not be used in advertising or
* publicity pertaining to distribution of the software without
* specific, written prior permission. The University of Southern
* California makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF
* SOUTHERN CALIFORNIA 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: Carl D. Worth <cworth@isi.edu>
*/
#include <stdio.h>
#include <stdlib.h>
#include <png.h>
#include "read_png.h"
#include "xmalloc.h"
static void
premultiply_data (png_structp png,
png_row_infop row_info,
png_bytep data)
{
int i;
for (i = 0; i < row_info->rowbytes; i += 4) {
unsigned char *base = &data[i];
unsigned char blue = base[0];
unsigned char green = base[1];
unsigned char red = base[2];
unsigned char alpha = base[3];
unsigned long p;
red = (unsigned) red * (unsigned) alpha / 255;
green = (unsigned) green * (unsigned) alpha / 255;
blue = (unsigned) blue * (unsigned) alpha / 255;
p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
memcpy (base, &p, sizeof (unsigned long));
}
}
read_png_status_t
read_png_argb32 (const char *filename,
unsigned char **data,
unsigned int *width,
unsigned int *height,
unsigned int *stride)
{
int i;
FILE *file;
static const int PNG_SIG_SIZE = 8;
unsigned char png_sig[PNG_SIG_SIZE];
int sig_bytes;
png_struct *png;
png_info *info;
png_uint_32 png_width, png_height;
int depth, color_type, interlace;
unsigned int pixel_size;
png_byte **row_pointers;
file = fopen (filename, "rb");
if (file == NULL) {
return READ_PNG_FILE_NOT_FOUND;
}
sig_bytes = fread (png_sig, 1, PNG_SIG_SIZE, file);
if (png_check_sig (png_sig, sig_bytes) == 0) {
fclose (file);
return READ_PNG_FILE_NOT_PNG;
}
/* XXX: Perhaps we'll want some other error handlers? */
png = png_create_read_struct (PNG_LIBPNG_VER_STRING,
NULL,
NULL,
NULL);
if (png == NULL) {
fclose (file);
return READ_PNG_NO_MEMORY;
}
info = png_create_info_struct (png);
if (info == NULL) {
fclose (file);
png_destroy_read_struct (&png, NULL, NULL);
return READ_PNG_NO_MEMORY;
}
png_init_io (png, file);
png_set_sig_bytes (png, sig_bytes);
png_read_info (png, info);
png_get_IHDR (png, info,
&png_width, &png_height, &depth,
&color_type, &interlace, NULL, NULL);
*width = png_width;
*height = png_height;
*stride = 4 * png_width;
/* convert palette/gray image to rgb */
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb (png);
/* expand gray bit depth if needed */
if (color_type == PNG_COLOR_TYPE_GRAY && depth < 8)
png_set_gray_1_2_4_to_8 (png);
/* transform transparency to alpha */
if (png_get_valid(png, info, PNG_INFO_tRNS))
png_set_tRNS_to_alpha (png);
if (depth == 16)
png_set_strip_16 (png);
if (depth < 8)
png_set_packing (png);
/* convert grayscale to RGB */
if (color_type == PNG_COLOR_TYPE_GRAY
|| color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb (png);
if (interlace != PNG_INTERLACE_NONE)
png_set_interlace_handling (png);
png_set_bgr (png);
png_set_filler (png, 0xff, PNG_FILLER_AFTER);
png_set_read_user_transform_fn (png, premultiply_data);
png_read_update_info (png, info);
pixel_size = 4;
*data = xmalloc (png_width * png_height * pixel_size);
row_pointers = malloc (png_height * sizeof(char *));
for (i=0; i < png_height; i++)
row_pointers[i] = (png_byte *) (*data + i * png_width * pixel_size);
png_read_image (png, row_pointers);
png_read_end (png, info);
free (row_pointers);
fclose (file);
png_destroy_read_struct (&png, &info, NULL);
return READ_PNG_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,45 @@
/*
* Copyright © 2003 USC, Information Sciences Institute
*
* 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 the
* University of Southern California not be used in advertising or
* publicity pertaining to distribution of the software without
* specific, written prior permission. The University of Southern
* California makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF
* SOUTHERN CALIFORNIA 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: Carl D. Worth <cworth@isi.edu>
*/
#ifndef READ_PNG_H
#define READ_PNG_H
typedef enum {
READ_PNG_SUCCESS = 0,
READ_PNG_FILE_NOT_FOUND,
READ_PNG_FILE_NOT_PNG,
READ_PNG_NO_MEMORY
} read_png_status_t;
read_png_status_t
read_png_argb32 (const char *filename,
unsigned char **data,
unsigned int *width,
unsigned int *height,
unsigned int *stride);
#endif

Просмотреть файл

@ -0,0 +1,133 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
/* Bug history
*
* 2004-11-04 Ned Konz <ned@squeakland.org>
*
* Reported bug on mailing list:
*
* From: Ned Konz <ned@squeakland.org>
* To: cairo@cairographics.org
* Date: Thu, 4 Nov 2004 09:49:38 -0800
* Subject: [cairo] getting assertions [cairo_cache.c:143: _entry_destroy:
* Assertion `cache->used_memory > entry->memory' failed]
*
* The attached program dies on me with the assert
*
* $ ./testCairo
* testCairo: cairo_cache.c:143: _entry_destroy: Assertion `cache->used_memory > entry->memory' failed.
*
* 2004-11-04 Carl Worth <cworth@cworth.org>
*
* I trimmed down Ned's example to the folllowing test while still
* maintaining the assertion.
*
* Oh, actually, it looks like I may have triggered something
* slightly different:
*
* text_cache_crash: cairo_cache.c:422: _cairo_cache_lookup: Assertion `cache->max_memory >= (cache->used_memory + new_entry->memory)' failed.
*
* I'll have to go back and try the original test after I fix this.
*
* 2004-11-13 Carl Worth <cworth@cworth.org>
*
* Found the bug. cairo_gstate_select_font was noticing when the
* same font was selected twice in a row and was erroneously failing
* to free the old reference. Committed a fix and verified it also
* fixed the orginal test case.
*/
#include "cairo_test.h"
cairo_test_t test = {
"text_cache_crash",
"Test case for bug causing an assertion failure in _cairo_cache_lookup",
0, 0,
};
#include <cairo.h>
static void
draw (cairo_t *cr, int width, int height)
{
/* Once there was a bug that choked when selecting the same font twice. */
cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_scale_font(cr, 40.0);
cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_scale_font(cr, 40.0);
cairo_move_to(cr, 10, 50);
cairo_show_text(cr, "hello");
/* Then there was a bug that choked when selecting a font too big
* for the cache. */
/* XXX: Sometimes this leads to an assertion:
_cairo_cache_lookup: Assertion `cache->max_memory >= (cache->used_memory + new_entry->memory)' failed.
Aborted
But other times my machine hangs completely only to return to life
several minutes later with some programs missing. This seems like
the out-of-memory killer to me.
It seems like I usually get the assertion when I run
./text_cache_crash directly and I usually get the machine hang when
I run "make check" but I don't know if there's a perfect
correlation there.
So there's a bad bug here somewhere that really needs to be fixed.
But in the meantime, I need "make check" not to destory work, so
I'm commenting this test out for now.
cairo_scale_font (cr, 500);
cairo_show_text (cr, "hello");
*/
}
int
main (void)
{
int ret;
ret = cairo_test (&test, draw);
/* It's convenient to be able to free all memory (including
* statically allocated memory). This makes it quite easy to use
* tools such as valgrind to verify that there are no memory leaks
* whatsoever.
*
* But I'm not sure what would be a sensible cairo API function
* for this. The cairo_destroy_caches call below is just something
* I made as a local modification to cairo.
*/
/*
cairo_destroy_caches ();
FcFini ();
*/
return ret;
}

Просмотреть файл

@ -0,0 +1,117 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
/* Bug history
*
* 2004-11-03 Steve Chaplin <stevech1097@yahoo.com.au>
*
* Reported bug on mailing list:
*
* From: Steve Chaplin <stevech1097@yahoo.com.au>
* To: cairo@cairographics.org
* Date: Thu, 04 Nov 2004 00:00:17 +0800
* Subject: [cairo] Rotated text bug on drawable target
*
* The attached file draws text rotated 90 degrees first to a PNG file and
* then to a drawable. The PNG file looks fine, the text on the drawable is
* unreadable.
*
* Steve
*
* 2004-11-03 Carl Worth <cworth@cworth.org>
*
* Looks like the major problems with this bg appeared in the great
* font rework between 0.1.23 and 0.2.0. And it looks like we need
* to fix the regression test suite to test the xlib target (since
* the bug does not show up in the png backend).
*
* Hmm... Actually, things don't look perfect even in the PNG
* output. Look at how that 'o' moves around. It's particularly off
* in the case where it's rotated by PI.
*
* And I'm still not sure about what to do for test cases with
* text--a new version of freetype will change everything. We may
* need to add a simple backend for stroked fonts and add a simple
* builtin font to cairo for pixel-perfect tests with text.
*/
#include "cairo_test.h"
#define WIDTH 150
#define HEIGHT 150
#define NUM_TEXT 20
#define TEXT_SIZE 12
cairo_test_t test = {
"text_rotate",
"Tests show_text under various rotations",
WIDTH, HEIGHT
};
/* Draw the word cairo at NUM_TEXT different angles */
static void
draw (cairo_t *cr, int width, int height)
{
int i, x_off, y_off;
cairo_text_extents_t extents;
static char text[] = "cairo";
cairo_select_font (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_scale_font (cr, TEXT_SIZE);
cairo_set_rgb_color (cr, 0,0,0);
cairo_translate (cr, WIDTH/2.0, HEIGHT/2.0);
cairo_text_extents (cr, text, &extents);
if (NUM_TEXT == 1) {
x_off = y_off = 0;
} else {
y_off = - round (extents.height / 2.0);
x_off = round ((extents.height+1) / (2 * tan (M_PI/NUM_TEXT)));
}
for (i=0; i < NUM_TEXT; i++) {
cairo_save (cr);
cairo_rotate (cr, 2*M_PI*i/NUM_TEXT);
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr, x_off - 0.5, y_off - 0.5, extents.width + 1, extents.height + 1);
cairo_set_rgb_color (cr, 1, 0, 0);
cairo_stroke (cr);
cairo_move_to (cr, x_off - extents.x_bearing, y_off - extents.y_bearing);
cairo_set_rgb_color (cr, 0, 0, 0);
cairo_show_text (cr, "cairo");
cairo_restore (cr);
}
}
int
main (void)
{
return cairo_test (&test, draw);
}

Просмотреть файл

@ -0,0 +1,102 @@
/*
* Copyright © 2003 USC, Information Sciences Institute
*
* 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 the
* University of Southern California not be used in advertising or
* publicity pertaining to distribution of the software without
* specific, written prior permission. The University of Southern
* California makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF
* SOUTHERN CALIFORNIA 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: Carl D. Worth <cworth@isi.edu>
*/
#include <stdio.h>
#include <stdlib.h>
#include <png.h>
#include "write_png.h"
static void
unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data)
{
int i;
for (i = 0; i < row_info->rowbytes; i += 4) {
unsigned char *b = &data[i];
unsigned int pixel;
unsigned char alpha;
memcpy (&pixel, b, sizeof (unsigned int));
alpha = (pixel & 0xff000000) >> 24;
if (alpha == 0) {
b[0] = b[1] = b[2] = b[3] = 0;
} else {
b[0] = (((pixel & 0x0000ff) >> 0) * 255) / alpha;
b[1] = (((pixel & 0x00ff00) >> 8) * 255) / alpha;
b[2] = (((pixel & 0xff0000) >> 16) * 255) / alpha;
b[3] = alpha;
}
}
}
void
write_png_argb32 (char *buffer, char *filename,
int width, int height, int stride)
{
FILE *f;
int i;
png_struct *png;
png_info *info;
png_byte **rows;
png_color_16 white;
f = fopen (filename, "w");
rows = malloc (height * sizeof(png_byte*));
for (i = 0; i < height; i++) {
rows[i] = buffer + i * stride;
}
png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
info = png_create_info_struct (png);
png_init_io (png, f);
png_set_IHDR (png, info,
width, height, 8,
PNG_COLOR_TYPE_RGB_ALPHA,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT);
white.red = 0xff;
white.blue = 0xff;
white.green = 0xff;
png_set_bKGD (png, info, &white);
png_set_write_user_transform_fn (png, unpremultiply_data);
png_set_bgr (png);
png_write_info (png, info);
png_write_image (png, rows);
png_write_end (png, info);
png_destroy_write_struct (&png, &info);
free (rows);
fclose (f);
}

Просмотреть файл

@ -0,0 +1,35 @@
/*
* Copyright © 2003 USC, Information Sciences Institute
*
* 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 the
* University of Southern California not be used in advertising or
* publicity pertaining to distribution of the software without
* specific, written prior permission. The University of Southern
* California makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THE UNIVERSITY OF SOUTHERN CALIFORNIA DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF
* SOUTHERN CALIFORNIA 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: Carl D. Worth <cworth@isi.edu>
*/
#ifndef WRITE_PNG_H
#define WRITE_PNG_H
void
write_png_argb32 (char *buffer, char *filename,
int width, int height, int stride);
#endif

Просмотреть файл

@ -0,0 +1,58 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
#include <stdio.h>
#include <stdlib.h>
#include "xmalloc.h"
void *
xmalloc (size_t size)
{
void *buf;
buf = malloc (size);
if (!buf) {
fprintf (stderr, "Error: Out of memory. Exiting.\n");
exit (1);
}
return buf;
}
void *
xcalloc (size_t nmemb, size_t size)
{
void *buf;
buf = calloc (nmemb, size);
if (!buf) {
fprintf (stderr, "Error: Out of memory. Exiting\n");
exit (1);
}
return buf;
}

Просмотреть файл

@ -0,0 +1,35 @@
/*
* Copyright © 2004 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Red Hat, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. Red Hat, Inc. makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Carl D. Worth <cworth@cworth.org>
*/
#ifndef _XMALLOC_H_
#define _XMALLOC_H_
void *
xmalloc (size_t size);
void *
xcalloc (size_t nmemb, size_t size);
#endif

Просмотреть файл

@ -0,0 +1,19 @@
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.)

Просмотреть файл

@ -0,0 +1,92 @@
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.

Просмотреть файл

@ -0,0 +1,614 @@
2005-01-21 Carl Worth <cworth@cworth.org>
* NEWS: Add notes for snapshot 0.1.3.
* configure.in: Increment version to 0.1.3
* RELEASING: Add reminder to diff pixman.h to look for API changes
since the last snapshot.
* src/Makefile.am (libpixman_la_SOURCES): Add missing files to
satisfy make distcheck.
* Makefile.am (RELEASE_UPLOAD_DIR): Update for changed www
directory on server.
* src/pixman-xserver-compat.h): Add pixman-xserver-compat.h, (that
was supposed to go in a couple of commits ago).
* src/fbedgeimp.h (rasterizeEdges): Avoid buffer ovverrun when
trapezoid's right edge is on a pixel boundary.
* src/ictri.c (IcRasterizeTriangle):
* src/ictrap.c (pixman_composite_trapezoids): Switch to use new
fbRasterizeTrapezoid. Gut old IcRasterizeTrapezoid
implementation. Remove lots of code, (and all the bugs with it).
* src/icint.h: Replace IcRasterizeTrapezoid with
fbRasterizeTrapezoid. Add a couple of missing typedefs.
* src/renderedge.h:
* src/renderedge.c (RenderLineFixedEdgeInit):
* src/fbtrap.c:
* src/fbedge.c: Minor changes to allow things to compile within
libpixman tree, (replace xserver include directives with
pixman-xserver-compat.h and sprinkle a few const qualifiers).
* src/Makefile.am (libpixman_la_SOURCES): Add sources for new
point-sampling rasterization.
* src/fbtrap.c: Merge in changes from xserver, (mostly just
whitespace).
2005-01-18 Carl Worth <cworth@cworth.org>
* src/fbedge.c:
* src/fbedgeimp.h:
* src/fbtrap.c:
* src/renderedge.c:
* src/renderedge.h: Add pristine files from the X server
containing Keith's newer point-sampling implementation of
trapezoid rasterization. The plan is to munge these files as
little as possible to make them work within libpixman, (so that it
will be easier to share patches between libpixman and the X
server).
2005-01-13 Carl Worth <cworth@cworth.org>
* src/ictrap.c (IcRasterizeTrapezoid): Force alpha to 0 when the
left edge is entirely above top. (This is a workaround for some
bizarre edge effects in the current algorithm).
(IcRasterizeTrapezoid): Fix the above correction so that it
doesn't force 0 alpha when the left edge is positioned above but
slopes so as to contain some of the pixel.
2005-01-07 Carl Worth <cworth@cworth.org>
* src/icrop.h:
* src/icint.h: Restore extern tag for variable declarations,
(accidentally removed when recently removing extern from function
prototypes).
2005-01-04 Carl Worth <cworth@cworth.org>
* src/ic.c (pixman_composite): Do nothing if src image has width
or height == 0 to avoid potential divide-by-zero.
2004-12-23 Carl Worth <cworth@cworth.org>
* src/slim_internal.h: Rename __internal_linkage to
pixman_private.
* src/icrop.h:
* src/icint.h:
* src/icimage.h: Track rename to pixman_private and move it to
before the function return value to quiet gcc warnings about
visibility attribute ignored for non-class type.
* configure.in:
* src/Makefile.am (INCLUDES): Add the following warnings when
compiling with gcc: -Wall -Wpointer-arith -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs
-fno-strict-aliasing
* src/icrect.c (pixman_color_rects): Fix to actually call
pixman_fill_rect_32bpp in the 32 bpp case. Thanks to
TOKUNAGA Hiroyuki <tkng@xem.jp>.
(pixman_fill_rect_8bpp, pixman_fill_rect_32bpp): Fix typo in
naming: bbp -> bpp.
2004-12-20 Alexander Larsson <alexl@redhat.com>
* src/icrect.c: (pixman_fill_rect_8bbp), (pixman_fill_rect_32bbp),
(pixman_fill_rect_general), (pixman_color_rects),
(pixman_fill_rectangles):
Special case solid color rectangle fills.
2004-10-28 Carl Worth <cworth@cworth.org>
* Makefile.am (release-verify-newer): Abort release-publish if
there's already a published tar file with the current version.
(release-publish): Add code to update the LATEST-package-version
file.
2004-10-27 Carl Worth <cworth@cworth.org>
* RELEASING: Put the tag command back which was accidentally
removed from the instructions.
* NEWS: Update date since 0.1.2 release didn't get pushed out
until today.
* RELEASING: Update release instructions to include new
release-publish target.
Suggest "cvs -q update -Ad" as an alternative to checkout.
* Makefile.am (release-publish): Add release-check and
release-publish targets to simplify the release process.
2004-10-13 Carl Worth <cworth@cworth.org>
* NEWS: Add notes for snapshot 0.1.2
* configure.in: Increment version to 0.1.2
* src/icint.h (MOD):
* src/iccompose.c (IcFetch_transform):
* src/ic.c (pixman_composite): Switch from two different buggy mod
macros to a new MOD macro which should work in C89 or C99.
2004-09-12 David Reveman <c99drn@cs.umu.se>
* src/icformat.c (pixman_format_init): pixman_format_init expects
that all variables not touched are zero. We need to add a memset
here to make that true.
Added pixman_format_get_masks, which allow clients to get the
masks from a format.
* src/icimage.c: Added the implementation of pixman_image_get_format,
which was missing.
* src/icint.h: slim_hidden_proto pixman_image_set_component_alpha.
* src/pixman.h: Added pixman_image_set_component_alpha, making it
possible to use component alpha.
* src/icimage.c (pixman_image_set_clip_region): Make a copy of
the client owned region.
(IcComputeCompositeRegion): Intersect possible client region.
Added pixman_image_set_component_alpha.
* src/icint.h: Include "../config.h".
Define IMAGE_BYTE_ORDER and BITMAP_BIT_ORDER correctly.
* configure.in: Added AC_C_BIGENDIAN.
* src/ic.c (pixman_composite):
* src/iccompose.c (IcFetch_transform, IcFetcha_transform):
* src/icimage.h: Added support for both transform and repeat
(thanks to Owen Taylor <otaylor@redhat.com>).
2004-05-06 Carl Worth <cworth@isi.edu>
* src/icimage.c (pixman_image_set_clip_region): Leave
clientClipType as CT_NONE if region is NULL (thanks to Vladimir
Vukicevic <vladimir@pobox.com>).
2004-04-16 Carl Worth <cworth@isi.edu>
* NEWS: Add notes for snapshot 0.1.1
* configure.in: Increment LIBPIXMAN_VERSION to 0.1.1
* src/ictrap.c (IcCreateAlphaPicture):
* src/icrect.c (pixman_color_rects):
* src/pixregion.c (pixman_region16_print, pixman_region16_valid):
* src/icint.h (IcBitsMask):
* src/icimage.h:
* src/icimage.c (pixman_image_change):
* src/icformat.c (pixman_format_create):
* src/pixman.h: Fix bogus names such as PIXMAN_FORMAT_NAME_AR_GB32
that were left over from a broken search-and-replace. Normalize
structure defintions, (eg. struct _pixman_region16_t -> struct
pixman_region16). Normalize indentation.
* AUTHORS: Fix alphabetization.
2004-02-24 Carl Worth <cworth@isi.edu>
* AUTHORS: Added attribution for several authors after sifting
through the ChangeLog.
Fix email address for Anders Carlsson.
2004-01-24 Carl Worth <cworth@isi.edu>
* src/iccompose.c (IcFetch_transform):
(IcFetcha_transform): Remove dead-code (useless n++).
2004-01-22 Richard Worth <richard@theworths.org>
* src/Makefile.am: Add '-no-undefined' to end of
libpixman_la_LDFLAGS tp enable building shared libary under
cygwin.
* src/pixman.h: Remove all 'extern ' and ' __external_linkage'
(macro for __declspec(dllexport) and __declspec(dllimport))
from function declarations. These are no longer needed for cygwin.
2003-12-17 Carl Worth <cworth@east.isi.edu>
* src/pixman.h: Remove trailing commas from enum, (some compilers
like to complain about this).
2003-12-12 Dave Beckett <Dave.Beckett@bristol.ac.uk>
* src/Makefile.am: Remove LIBPIXMAN_CFLAGS/LIBS cruft.
(libpixman_la_SOURCES): slim_export.h slim_import.h gone.
2003-12-12 Carl Worth <cworth@east.isi.edu>
* src/pixman.h: Fold contents of slim_export/import.h directly
into this file to avoid dependence on external slim package.
* src/icint.h:
* src/pixregionint.h: Use quote-based include now that
slim_internal is an internal file.
* src/icint.h: Follow convention of other files for
multi-inclusion guard (_IC_INT_H_)
* configure.in: Remove cruft.
2003-12-10 Dave Beckett <Dave.Beckett@bristol.ac.uk>
* update.pl: fixes for wrong order of renames
* src/pixregion.c, src/pixman.h, src/ictri.c, src/ictrap.c, src/icimage.c, src/icformat.c, src/ic.c:
Correct some more renames where the order of the renaming
caused later renames to fail due to earlier prefixes failing.
* update.pl: Add rename fixes
* src/pixregionint.h, src/pixregion.c, src/pixman.h, src/ictri.c, src/ictrap.c, src/ictransform.c, src/icrect.c, src/icpixels.c, src/icint.h, src/icimage.h, src/icimage.c, src/icformat.c, src/iccompose.c, src/iccolor.c:
Correct over-eager renames of the form pixman_thing_tName into
pixman_thing_name. It was inevitable really this would happen!
* update.pl: Added helper script for updating names in source.
* src/pixregionint.h, src/pixregion.c, src/pixman.h, src/icutil.c, src/ictri.c, src/ictrap.c, src/ictransform.c, src/icstipple.c, src/icrop.h, src/icrect.c, src/icpixels.c, src/icint.h, src/icimage.h, src/icimage.c, src/icformat.c, src/iccompose.c, src/iccolor.c, src/icbltone.c, src/icblt.c, src/ic.c:
Rename exported Ic* and PixRegion* functions, types, enums
to be prefixed pixman (or PIXMAN for enum values)
* libpixman.pc.in, README: libpixman is the pixel manipulation library
* src/pixregionint.h, src/icint.h:
Change ic.h/pixregion.h headers inclusions to be pixman.h
* src/ic.h: Removed ic.h, merged into pixman.h
* src/pixman.h:
Merged pixregion.h (former name and CVS history of this file)
and ic.h (now CVS deleted here).
* src/Makefile.am:
Updated for libpixregion,libic to libpixman source merges.
Added -I$(srcdir) so we get internal headers from here even
when srcdir != builddir.
* libpixman.pc.in, configure.in, Makefile.am:
Updated for libpixregion,libic to libpixman package name, dependencies.
* README, COPYING, AUTHORS:
Merge of libic, slim AUTHORS, COPYING, README
* Initial repository copy of libpixregion, libic, slim CVS.
* Constructed a merged ChangeLog below via emacs VC mode (which rocks!)
2003-12-09 Carl Worth <cworth@isi.edu>
* ChangeLog.libpixregion, autogen.sh, ChangeLog.libic:
* autogen.sh: Allow names of all autofoo programs to be
overridden via environment variables.
2003-11-25 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/icutil.c:
* configure.in: Bump version to 0.1.5 for new 64-bit fixes.
* src/icutil.c (icStipple8Bits): One more fix needed for 64-bit
machine (alpha in this case). Thanks to Jakub Bogusz
<qboosh@pld-linux.org>.
2003-11-17 Carl Worth <cworth@isi.edu>
* src/icrop.h, src/icutil.c, ChangeLog.libic:
* src/icutil.c (icStipple1Bits):
* src/icrop.h (IcStipple16Bits): Fixes needed to compile libic on
x86_64. Many thanks to David R Bacon <dbacon@cis.ksu.edu>.
2003-11-06 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/ic.h: Removed stale version from ic.h.
Better to have no version listed than the wrong one.
2003-11-01 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/ic.h, src/icimage.c:
Add IcImageGetDepth. Bump version to 0.1.3
2003-10-29 Carl Worth <cworth@isi.edu>
* ChangeLog.libpixregion, configure.in, ChangeLog.libic:
Drop AC_CONFIG_AUX_DIR(config) as it was confusing "make distcheck"
* ChangeLog.libic, src/icimage.c, src/icimage.h:
Fix memory leak of image->transform.
Remove currently unused DevUnion type and IcImageChange function.
* ChangeLog.libic:
Bumped version to 0.1.2 to indicate new IcOperator type.
* ChangeLog.libic, src/ic.c, src/ic.h, src/icblt.c, src/icbltone.c, src/iccolor.c, src/iccompose.c, src/icimage.c, src/icimage.h, src/icint.h, src/icrect.c, src/ictransform.c, src/ictrap.c, src/ictri.c:
Patch from Bryan Worth <bryan@theworths.org> to eliminate lots of leftover,
undesired dependencies on X header files.
2003-09-24 Carl Worth <cworth@isi.edu>
* ChangeLog.slim:
Require __GNUC__ >= 3 before defining slim_hidden_def macro
2003-09-23 Carl Worth <cworth@isi.edu>
* src/slim_internal.h:
Require __GNUC__ >= 3 before defining slim_hidden_def macro
2003-09-10 Carl Worth <cworth@isi.edu>
* src/ic.c, src/iccolor.c, src/icformat.c, src/icimage.c, src/icrect.c, ChangeLog.libic, ChangeLog.libpixregion, configure.in, src/pixregion.c:
Updated calls to slim_hidden_def to track cahnges in slim 0.2.0
* ChangeLog.slim: Bump version number to 0.2.0
* ChangeLog.slim, src/slim_internal.h:
Remove ';' from slim_hidden_def. Bump version to 0.1.1
2003-09-05 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/ic.c, src/ic.h, src/icblt.c, src/icbltone.c, src/iccolor.c, src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h, src/icint.h, src/icpixels.c, src/icrect.c, src/icrop.h, src/icstipple.c, src/ictransform.c, src/ictrap.c, src/ictri.c, src/icutil.c:
Expose functions for creating IcFormat based on IcFormatName or masks.
The actual IcFormat struct is no longer exposed.
Bump version number to 0.1.1
* ChangeLog.libic: Portability fix for OpenBSD (from Michael Schubert)
2003-09-02 Carl Worth <cworth@isi.edu>
* src/ic.h: Portability fix for OpenBSD (from Michael Schubert)
2003-08-19 Carl Worth <cworth@isi.edu>
* autogen.sh: Add --enable-maintainer-mode to autogen.sh
* autogen.sh:
Fixed to give a better warning if pkg-config is not installed
2003-08-01 Richard Henderson <rth@twiddle.net>
* ChangeLog.libic, src/iccolor.c:
* src/iccolor.c (Ones): Define as __builtin_popcount when available.
2003-07-31 Richard Henderson <rth@twiddle.net>
* src/ic.c, src/ic.h, src/iccolor.c, src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h, src/icint.h, src/icrect.c, src/icrop.h, src/ictri.c, ChangeLog.libic:
* configure.in: Check for slim revision.
* libic.pc.in: Depend on slim.
* src/ic.c, src/iccompose.c: Don't include icimage.h.
* src/icimage.h: Don't include ic.h.
* src/ic.h: Include slim_{export,import}.h as appropriate. Mark all
symbols __external_linkage.
* src/icint.h: Include slim_import.h; mark symbols __internal_linkage;
add slim hidden_proto declarations.
* src/icimage.h: Mark all symbols __internal_linkage.
* src/icrop.h: Likewise.
* src/ic.c (IcComposite): Provide hidden definition.
* src/iccolor.c (IcColorToPixel): Likewise.
* src/icformat.c (IcFormatInit): Likewise.
* src/icimage.c (IcImageCreate, IcImageDestroy): Likewise.
(IcImageSetRepeat): Likewise.
* src/icrect.c (IcFillRectangles): Likewise.
* src/tri.c (IcRasterizeTriangle): Make static.
* ChangeLog.slim, src/slim_internal.h:
* src/slim_internal.h (__internal_linkage): Attribute visibility
not present until gcc 3.3.
* src/icimage.h, src/icrop.h, src/icutil.c, ChangeLog.libic, src/ic.c, src/icbltone.c, src/iccompose.c:
* src/ic.c: Make everything but IcComposite static.
* src/iccompose.c: Make everything except IcBuildCompositeOperand
and IcCompositeGeneral static.
* src/icbltone.c (Ic8Lane, Ic16Lane, Ic32Lane): Make static.
(IcLaneTable): Turn into a function.
(IcBltOne): Make IcLane const.
(icStipple24Bits): Make static.
* src/icimage.h: Remove lots of now static declarations.
* src/icrop.h: Likewise.
* src/icutil.c (icStipple8Bits, icStipple4Bits): Make static.
(icStipple2Bits, icStipple1Bits): Make static.
(IcStippleTable): Turn into a function.
2003-07-30 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/ic.h: Committing missed ChangeLog entry
* ChangeLog.libic, src/ic.h:
Fixed IcRectangle to be compatible with XRectangle.
* ChangeLog.libpixregion, configure.in, src/pixman.h:
Removed false dependency on X.
2003-07-30 Richard Henderson <rth@twiddle.net>
* ChangeLog.slim:
* Makefile.am (EXTRA_DIST, pkgconfigdir, pkgconfig_DATA): New.
* configure.in (AC_OUTPUT): Add slim.pc.
* slim.pc.in: New file.
* ChangeLog.libpixregion, configure.in, libpixman.pc.in, src/pixman.h, src/pixregion.c, src/pixregionint.h:
* configure.in: Run PKG_CHECK_MODULES on slim.
* libpixregion.pc.in: Require slim.
* src/pixregion.c (PixRegionCreateSimple): Mark hidden.
(PixRegionCopy, PixRegionUnion): Mark hidden.
* src/pixregion.h: Include and use X11/Xfuncproto.h. Include
slim_{export,import}.h as appropriate. Mark all functions with
__external_linkage.
* src/pixregionint.h: Rename include protect to _PIXREGIONINT_H_.
* src/slim_export.h, src/slim_import.h, src/slim_internal.h, ChangeLog.slim:
* src/slim_internal.h: New file.
* src/slim_export.h: New file.
* src/slim_import.h: New file.
* src/Makefile.am (include_HEADERS): Add them.
* configure.in (AC_INIT): Check for src/slim_export.h
2003-07-30 Carl Worth <cworth@isi.edu>
* ChangeLog.slim: Initial commit of slim shell
2003-07-29 Carl Worth <cworth@isi.edu>
* src/ic.c, src/ic.h, src/iccompose.c, src/icimage.h, src/icint.h:
Replaced CARD*/INT* datatypes with stdint types (vektor@dumbterm.net).
2003-07-10 Anders Carlsson <andersca@codefactory.se>
* ChangeLog.libic:
2003-07-10 Anders Carlsson <andersca@codefactory.se>
* autogen.sh:
Pass --enable-maintainer-mode to configure
* configure.in:
Add compiler warning flags to CFLAGS.
2003-07-09 Anders Carlsson <andersca@codefactory.se>
* src/ic.h, src/icimage.c, ChangeLog.libic:
2003-07-09 Anders Carlsson <andersca@codefactory.se>
* src/ic.h:
* src/icimage.c: (IcImageGetData):
Add accessor for getting a pointer to the image data.
2003-07-08 Anders Carlsson <andersca@codefactory.se>
* src/ic.h, src/icimage.c, ChangeLog.libic:
2003-07-09 Anders Carlsson <andersca@codefactory.se>
* src/ic.h:
* src/icimage.c: (IcImageGetWidth), (IcImageGetHeight),
(IcImageGetStride):
Add accessors.
2003-05-29 Carl Worth <cworth@isi.edu>
* src/ic.c, src/iccompose.c: Cleanup of some stale unused code.
2003-05-15 Carl Worth <cworth@isi.edu>
* src/ic.h, src/iccompose.c, src/icimage.c, src/icimage.h,
src/icint.h, src/ictransform.c, ChangeLog.libic: Fixed
transform/filter support
2003-05-05 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/ictrap.c:
Avoid crash in IcCompositeTrapezoids when there's nothing to draw.
2003-04-26 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/icimage.c, src/icimage.h: Fixed memory leak
2003-04-25 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/ic.h, src/icint.h, src/icrect.c,
src/ictrap.c, src/ictri.c: Remove X datatypes from public
interface
* configure.in, src/Makefile.am, src/pixman.h, src/pixregionint.h:
Fixed libtool versioning
* ChangeLog.libic, src/ic.h:
Fixed to not reference XFixed. Fixed libtool versioning
2003-04-23 Carl Worth <cworth@isi.edu>
* src/ic.h: extern "C" stuff to support C++ (Fredrik Höglund)
2003-04-22 Carl Worth <cworth@isi.edu>
* ChangeLog.libpixregion, configure.in: Fixed typo (Owen Taylor)
2003-04-17 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/ic.c, src/ic.h, src/iccolor.c,
src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h,
src/icint.h, src/icpixels.c, src/icrect.c, src/ictrap.c,
src/ictri.c: Removed reliance on server headers. Reowrked IcFormat
2003-03-05 Carl Worth <cworth@isi.edu>
* ChangeLog.libic, src/ic.h, src/icimage.h, src/icint.h:
Updated to use libpixregion
2003-02-25 Carl Worth <cworth@isi.edu>
* src/ic.c, src/ic.h, src/iccompose.c, src/icimage.c,
src/icimage.h, src/icint.h, src/ictrap.c, src/ictri.c: updated to
use libpixregion instead of Xlib region code
* ChangeLog.libpixregion, src/pixman.h, src/pixregion.c: API cleanup
* src/.cvsignore, src/Makefile.am, src/pixman.h, src/pixregion.c,
src/pixregionint.h: Initial import of libpixregion
* src/.cvsignore, src/Makefile.am, src/pixman.h, src/pixregion.c,
src/pixregionint.h: New file.
* .cvsignore, AUTHORS, COPYING, ChangeLog.libpixregion, INSTALL,
Makefile.am, NEWS, README, autogen.sh, configure.in,
libpixman.pc.in: Initial import of libpixregion
* .cvsignore, AUTHORS, COPYING, ChangeLog.libpixregion, INSTALL,
Makefile.am, NEWS, README, autogen.sh, configure.in,
libpixman.pc.in: New file.
2003-02-21 Carl Worth <cworth@isi.edu>
* src/ic.h, src/icimage.h, src/icint.h, src/ictrap.c, src/ictri.c:
Added triangle support
* src/ictransform.c, ChangeLog.libic, src/ic.c, src/icbltone.c,
src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h,
src/icint.h, src/icutil.c: Some reorganization and cruft removal
* src/ic.c, src/ic.h, src/icimage.c, src/icint.h, src/icpixels.c,
src/icstipple.c, src/ictrap.c: Started cleaning up public libic
interface
* src/icimage.h, src/icint.h, src/icrop.h:
Initial import of libic code, (still very preliminary).
* src/icimage.h, src/icint.h, src/icrop.h: New file.
* src/ictrap.c, src/ictri.c, src/icutil.c:
Initial import of libic code, (still very preliminary).
* src/ictrap.c, src/ictri.c, src/icutil.c: New file.
* src/iccompose.c, src/icformat.c, src/icimage.c, src/icpixels.c, src/icrect.c, src/icstipple.c:
Initial import of libic code, (still very preliminary).
* src/iccompose.c, src/icformat.c, src/icimage.c, src/icpixels.c, src/icrect.c, src/icstipple.c:
New file.
* src/icbltone.c:
Initial import of libic code, (still very preliminary).
* src/icbltone.c: New file.
* src/ic.c, src/ic.h, src/icblt.c:
Initial import of libic code, (still very preliminary).
* src/ic.c, src/ic.h, src/icblt.c: New file.
* ChangeLog.libic:
Initial import of libic code, (still very preliminary).
* ChangeLog.libic: New file.

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,9 @@
This code uses automake, in order to generate the Makefiles use:
$ autogen.sh
After that, standard build procedures apply:
$ make
# make install

Просмотреть файл

Просмотреть файл

@ -0,0 +1,692 @@
# Makefile.in generated by automake 1.9.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libpixman.pc.in $(top_srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL NEWS TODO config.guess config.sub \
depcomp install-sh ltmain.sh missing mkinstalldirs
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libpixman.pc
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
pkgconfigDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgconfig_DATA)
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VERSION_INFO = @VERSION_INFO@
WARN_CFLAGS = @WARN_CFLAGS@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = . src
EXTRA_DIST = \
COPYING \
ChangeLog.libic \
ChangeLog.libpixregion \
ChangeLog.slim \
libpixman.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libpixman.pc
# Some custom targets to make it easier to release things.
# Use either:
# make release-check
# or make release-publish
RELEASE_UPLOAD_HOST = cairographics.org
RELEASE_UPLOAD_DIR = /srv/cairo.freedesktop.org/www/snapshots
RELEASE_URL_BASE = http://cairographics.org/snapshots
RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org
tar_file = $(PACKAGE)-$(VERSION).tar.gz
md5_file = $(tar_file).md5
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
libpixman.pc: $(top_builddir)/config.status $(srcdir)/libpixman.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
$(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkdir_p) $(distdir)/.
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am uninstall-pkgconfigDATA
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-generic clean-libtool clean-recursive \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-pkgconfigDATA install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-libtool \
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-info-am \
uninstall-pkgconfigDATA
$(md5_file): $(tar_file)
md5sum $^ > $@
release-remove-old:
rm -f $(tar_file) $(md5_file)
release-check: release-remove-old distcheck $(md5_file)
release-verify-newer:
@echo -n "Checking that no $(VERSION) release already exists..."
@ssh $(RELEASE_UPLOAD_HOST) test ! -e $(RELEASE_UPLOAD_DIR)/$(tar_file) \
|| (echo "Ouch." && echo "Found: $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)/$(tar_file)" \
&& echo "The version in configure.in must be incremented before a new release." \
&& false)
@echo "Good."
release-publish: release-verify-newer release-check
mkdir -p releases
scp $(tar_file) $(md5_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)
mv $(tar_file) $(md5_file) releases
ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && touch $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
@echo ""
@echo "Please send an announcement to $(RELEASE_ANNOUNCE_LIST)"
@echo "including the following:"
@echo ""
@echo "Subject: $(PACKAGE) snapshot $(VERSION) now available"
@echo ""
@echo "A new $(PACKAGE) snapshot $(VERSION) is now available from:"
@echo ""
@echo " $(RELEASE_URL_BASE)/$(tar_file)"
@echo " $(RELEASE_URL_BASE)/$(md5_file)"
@echo -n " "
@cat releases/$(md5_file)
@echo ""
@echo "Also, please include the new entries from the NEWS file."
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше