* builds/unix/config.guess, builds/unix/config.sub: Updated to

latest versions from gnu.org.

* builds/compiler/gcc-dev.mk: Add `-Wno-long-long' flag.

* include/freetype/internal/ftcalc.h: Define FT_SqrtFixed()
uncoditionally.
* src/base/ftbbox.c: Include FT_INTERNAL_CALC_H.
Fix compiler warnings.
* src/base/ftcalc.c: Fix (potential) compiler warnings.

* src/base/ftcalc.c (FT_SqrtFixed): Corrected/optimized the 32-bit
fixed-point square root computation.  It is now used even with
64-bits integers, as it is _much_ faster than calling FT_Sqrt64 :-)
* src/base/ftbbox.c: Removed invalid "#include FT_BEZIER_H" line.
* src/base/ftbbox.c (BBox_Cubic_Check): Rewrote function to use
direct computations with 16.16 values instead of sub-divisions.  It
is now slower, but proves a point :-)
* src/raster/ftraster.c, src/smooth/ftgrays.c, src/base/ftbbox.c:
Fixed the bezier stack depths.
* src/base/ftcalc.c (FT_MulFix): Minor rounding fix.
* builds/beos: Added BeOS-specific files to the old build system
(no changes were necessary to support BeOS in the Jamfile though).
* ftconfig.h, ftoption.h: Updated "ftconfig.h" to detect 64-bit int
types on platforms where Autoconf is not available).  Also removed
FTCALC_USE_LONG_LONG and replaced it with
FT_CONFIG_OPTION_FORCE_INT64.
* builds/win32/freetype.dsp: Updated the Visual C++ project file.
Doesn't create a DLL yet.
* cffgload.c: Removed a compilation warning.
This commit is contained in:
Werner Lemberg 2001-04-26 13:34:36 +00:00
parent c2cd00443b
commit 3780273e3e
7 changed files with 231 additions and 201 deletions

View File

@ -1,35 +1,49 @@
2001-04-26 Werner Lemberg <wl@gnu.org>
* builds/unix/config.guess, builds/unix/config.sub: Updated to
latest versions from gnu.org.
* builds/compiler/gcc-dev.mk: Add `-Wno-long-long' flag.
* include/freetype/internal/ftcalc.h: Define FT_SqrtFixed()
uncoditionally.
* src/base/ftbbox.c: Include FT_INTERNAL_CALC_H.
Fix compiler warnings.
* src/base/ftcalc.c: Fix (potential) compiler warnings.
2001-04-26 David Turner <david@freetype.org> 2001-04-26 David Turner <david@freetype.org>
* src/base/ftcalc.c (FT_SqrtFixed): corrected/optimised the 32-bit * src/base/ftcalc.c (FT_SqrtFixed): Corrected/optimized the 32-bit
fixed-point square root. it is now used even with 64-bits fixed-point square root computation. It is now used even with
ints, as it's simply _much_ faster than calling FT_Sqrt64 :-) 64-bits integers, as it is _much_ faster than calling FT_Sqrt64 :-)
* src/base/ftbbox.c : removed invalid "#include FT_BEZIER_H" line * src/base/ftbbox.c: Removed invalid "#include FT_BEZIER_H" line.
2001-04-25 David Turner <david@freetype.org> 2001-04-25 David Turner <david@freetype.org>
* src/base/ftbbox.c (BBox_Cubic_Check): rewrote function to use * src/base/ftbbox.c (BBox_Cubic_Check): Rewrote function to use
direct computations with 16.16 values instead of sub-divisions. direct computations with 16.16 values instead of sub-divisions. It
It is now slower, but proves a point :-) is now slower, but proves a point :-)
* src/raster/ftraster.c, src/smooth/ftgrays.c, src/base/ftbbox.c : * src/raster/ftraster.c, src/smooth/ftgrays.c, src/base/ftbbox.c:
fixed the bezier stack depths.. Fixed the bezier stack depths.
* src/base/ftcalc.c (FT_MulFix): minor rounding fix * src/base/ftcalc.c (FT_MulFix): Minor rounding fix.
* builds/beos : added BeOS-specific files to the old build system * builds/beos: Added BeOS-specific files to the old build system
(no changes were necessary to support BeOS in the Jamfile though) (no changes were necessary to support BeOS in the Jamfile though).
2001-04-20 David Turner <david@freetype.org> 2001-04-20 David Turner <david@freetype.org>
* ftconfig.h, ftoption.h: updated "ftconfig.h" to detect 64-bit int * ftconfig.h, ftoption.h: Updated "ftconfig.h" to detect 64-bit int
types on platforms where Autoconf is not available). Also removed types on platforms where Autoconf is not available). Also removed
FTCALC_USE_LONG_LONG and replaced it with FT_CONFIG_OPTION_FORCE_INT64 FTCALC_USE_LONG_LONG and replaced it with
FT_CONFIG_OPTION_FORCE_INT64.
* builds/win32/freetype.dsp: updated the Visual C++ project file. Doesn't * builds/win32/freetype.dsp: Updated the Visual C++ project file.
create a DLL yet.. Doesn't create a DLL yet.
* cffgload.c: removed a compilation warning * cffgload.c: Removed a compilation warning.
2001-04-10 Tom Kacvinsky <tjk@ams.org> 2001-04-10 Tom Kacvinsky <tjk@ams.org>

View File

@ -10,11 +10,11 @@
import fileinput, sys, string, glob import fileinput, sys, string, glob
# the Project's title, this can be over-ridden from the command line with # The Project's title. This can be overridden from the command line with
# an option # an option.
project_title = "Project" project_title = "Project"
# The following defines the HTML header used by all generated pages # The following defines the HTML header used by all generated pages.
# #
html_header_1 = """\ html_header_1 = """\
<html> <html>
@ -38,52 +38,54 @@ html_header_2= """ API Reference</title>
html_header_3=""" API Reference</h1></center> html_header_3=""" API Reference</h1></center>
""" """
# this is recomputed later when the project title changes
# This is recomputed later when the project title changes.
#
html_header = html_header_1 + project_title + html_header_2 + project_title + html_header_3 html_header = html_header_1 + project_title + html_header_2 + project_title + html_header_3
# The HTML footer used by all generated pages # The HTML footer used by all generated pages.
# #
html_footer = """\ html_footer = """\
</body> </body>
</html>""" </html>"""
# The header and footer used for each section # The header and footer used for each section.
# #
section_title_header = "<center><h1>" section_title_header = "<center><h1>"
section_title_footer = "</h1></center>" section_title_footer = "</h1></center>"
# The header and footer used for code segments # The header and footer used for code segments.
# #
code_header = "<font color=blue><pre>" code_header = "<font color=blue><pre>"
code_footer = "</pre></font>" code_footer = "</pre></font>"
# Paragraph header and footer # Paragraph header and footer.
# #
para_header = "<p>" para_header = "<p>"
para_footer = "</p>" para_footer = "</p>"
# Block header and footer # Block header and footer.
# #
block_header = "<center><table width=75%><tr><td>" block_header = "<center><table width=75%><tr><td>"
block_footer = "</td></tr></table><hr width=75%></center>" block_footer = "</td></tr></table><hr width=75%></center>"
# Description header/footer # Description header/footer.
# #
description_header = "<center><table width=87%><tr><td>" description_header = "<center><table width=87%><tr><td>"
description_footer = "</td></tr></table></center><br>" description_footer = "</td></tr></table></center><br>"
# Marker header/inter/footer combination # Marker header/inter/footer combination.
# #
marker_header = "<center><table width=87% cellpadding=5><tr bgcolor=#EEEEFF><td><em><b>" marker_header = "<center><table width=87% cellpadding=5><tr bgcolor=#EEEEFF><td><em><b>"
marker_inter = "</b></em></td></tr><tr><td>" marker_inter = "</b></em></td></tr><tr><td>"
marker_footer = "</td></tr></table></center>" marker_footer = "</td></tr></table></center>"
# Source code extracts header/footer # Source code extracts header/footer.
# #
source_header = "<center><table width=87%><tr bgcolor=#D6E8FF width=100%><td><pre>" source_header = "<center><table width=87%><tr bgcolor=#D6E8FF width=100%><td><pre>"
source_footer = "</pre></table></center><br>" source_footer = "</pre></table></center><br>"
# Chapter header/inter/footer # Chapter header/inter/footer.
# #
chapter_header = "<center><table width=75%><tr><td><h2>" chapter_header = "<center><table width=75%><tr><td><h2>"
chapter_inter = "</h2><ul>" chapter_inter = "</h2><ul>"
@ -92,8 +94,8 @@ chapter_footer = "</ul></td></tr></table></center>"
current_section = None current_section = None
# This function is used to sort the index. It's a simple lexicographical # This function is used to sort the index. It is a simple lexicographical
# sort, except that it places capital letters before small ones. # sort, except that it places capital letters before lowercase ones.
# #
def index_sort( s1, s2 ): def index_sort( s1, s2 ):
if not s1: if not s1:
@ -126,7 +128,7 @@ def index_sort( s1, s2 ):
return 0 return 0
# sort input_list, placing the elements of order_list in front # Sort input_list, placing the elements of order_list in front.
# #
def sort_order_list( input_list, order_list ): def sort_order_list( input_list, order_list ):
new_list = order_list[:] new_list = order_list[:]
@ -136,8 +138,8 @@ def sort_order_list( input_list, order_list ):
return new_list return new_list
# translate a single line of source to HTML. This will convert # Translate a single line of source to HTML. This will convert
# a "<" into "&lt.", ">" into "&gt.", etc.. # a "<" into "&lt.", ">" into "&gt.", etc.
# #
def html_format( line ) def html_format( line )
result = string.replace( line, "<", "&lt." ) result = string.replace( line, "<", "&lt." )
@ -146,8 +148,8 @@ def html_format( line )
return result return result
# The FreeType 2 reference is extracted from the source files. These contain # The FreeType 2 reference is extracted from the source files. These
# various comment blocks that follow one of the following formats: # contain various comment blocks that follow one of the following formats:
# #
# /************************** # /**************************
# * # *
@ -176,7 +178,7 @@ def html_format( line )
# /**************************/ # /**************************/
# #
# Each block contains a list of markers; each one can be followed by # Each block contains a list of markers; each one can be followed by
# some arbitrary text or a list of fields. Here's an example: # some arbitrary text or a list of fields. Here an example:
# #
# <Struct> # <Struct>
# MyStruct # MyStruct
@ -195,15 +197,15 @@ def html_format( line )
# #
# Each field is simply of the format: WORD :: TEXT... # Each field is simply of the format: WORD :: TEXT...
# #
# Note that typically each comment block is followed by some source # Note that typically each comment block is followed by some source code
# code declaration that may need to be kept in the reference. # declaration that may need to be kept in the reference.
# #
# Note that markers can alternatively be written as "@MARKER:" # Note that markers can alternatively be written as "@MARKER:" instead of
# instead of "<MARKER>". All marker identifiers are converted to # "<MARKER>". All marker identifiers are converted to lower case during
# lower case during parsing in order to simply sorting. # parsing in order to simply sorting.
# #
# We associate with each block the following source lines that do not # We associate with each block the following source lines that do not begin
# begin with a comment. For example, the following: # with a comment. For example, the following:
# #
# /********************************** # /**********************************
# * # *
@ -211,38 +213,37 @@ def html_format( line )
# * # *
# */ # */
# #
# bla_bla_bla # bla_bla_bla
# bilip_bilip # bilip_bilip
# #
# /* - this comment acts as a separator - */ # /* - this comment acts as a separator - */
# #
# blo_blo_blo # blo_blo_blo
# #
# #
# will only keep the first two lines of sources with # will only keep the first two lines of sources with
# the "blabla" block. # the "blabla" block.
# #
# However, the comment will be kept, with following source lines # However, the comment will be kept, with following source lines if it
# if it contains a starting '#' or '@' as in: # contains a starting '#' or '@' as in:
# #
# /*@.....*/ # /*@.....*/
# /*#.....*/ # /*#.....*/
# /* @.....*/ # /* @.....*/
# /* #.....*/ # /* #.....*/
# #
############################################################################# #############################################################################
# #
# The DocCode class is used to store source code lines # The DocCode class is used to store source code lines.
# #
# 'self.lines' contains a set of source code lines that will # 'self.lines' contains a set of source code lines that will be dumped as
# be dumped as HTML in a <PRE> tag. # HTML in a <PRE> tag.
# #
# The object is filled line by line by the parser; it strips the # The object is filled line by line by the parser; it strips the leading
# leading "margin" space from each input line before storing it # "margin" space from each input line before storing it in 'self.lines'.
# in 'self.lines'.
# #
class DocCode: class DocCode:
@ -278,11 +279,11 @@ class DocCode:
while l > 0 and string.strip( self.lines[l - 1] ) == "": while l > 0 and string.strip( self.lines[l - 1] ) == "":
l = l - 1 l = l - 1
# the code footer should be directly appended to the last code # The code footer should be directly appended to the last code
# line to avoid an additional blank line # line to avoid an additional blank line.
# #
sys.stdout.write( code_header ) sys.stdout.write( code_header )
for line in self.lines[0 : l+1]: for line in self.lines[0 : l+1]:
sys.stdout.write( '\n' + html_format(line) ) sys.stdout.write( '\n' + html_format(line) )
sys.stdout.write( code_footer ) sys.stdout.write( code_footer )
@ -370,8 +371,9 @@ class DocParagraph:
cursor = cursor + len( word ) + 1 cursor = cursor + len( word ) + 1
# handle trailing periods, commas, etc. at the end of
# cross references. # Handle trailing periods, commas, etc. at the end of cross
# references.
# #
if extra: if extra:
if cursor + len( extra ) + 1 > max_width: if cursor + len( extra ) + 1 > max_width:
@ -410,10 +412,9 @@ class DocParagraph:
# #
# DocContent is used to store the content of a given marker. # DocContent is used to store the content of a given marker.
# #
# The "self.items" list contains (field,elements) records, where # The "self.items" list contains (field,elements) records, where "field"
# "field" corresponds to a given structure fields or function # corresponds to a given structure fields or function parameter (indicated
# parameter (indicated by a "::"), or NULL for a normal section # by a "::"), or NULL for a normal section of text/code.
# of text/code.
# #
# Hence, the following example: # Hence, the following example:
# #
@ -436,8 +437,8 @@ class DocParagraph:
# #
# in 'self.items'. # in 'self.items'.
# #
# The DocContent object is entirely built at creation time; you must # The DocContent object is entirely built at creation time; you must pass a
# pass a list of input text lines in the "lines_list" parameter. # list of input text lines in the "lines_list" parameter.
# #
class DocContent: class DocContent:
@ -449,7 +450,7 @@ class DocContent:
paragraph = None # represents the current DocParagraph paragraph = None # represents the current DocParagraph
code = None # represents the current DocCode code = None # represents the current DocCode
elements = [] # the list of elements for the current field, elements = [] # the list of elements for the current field;
# contains DocParagraph or DocCode objects # contains DocParagraph or DocCode objects
field = None # the current field field = None # the current field
@ -633,20 +634,18 @@ class DocContent:
############################################################################# #############################################################################
# #
# # The DocBlock class is used to store a given comment block. It contains
# The DocBlock class is used to store a given comment block. It contains
# a list of markers, as well as a list of contents for each marker. # a list of markers, as well as a list of contents for each marker.
# #
# "self.items" is a list of (marker, contents) elements, where # "self.items" is a list of (marker, contents) elements, where 'marker' is
# 'marker' is a lowercase marker string, and 'contents' is a DocContent # a lowercase marker string, and 'contents' is a DocContent object.
# object.
# #
# "self.source" is simply a list of text lines taken from the # "self.source" is simply a list of text lines taken from the uncommented
# uncommented source itself. # source itself.
# #
# Finally, "self.name" is a simple identifier used to uniquely identify # Finally, "self.name" is a simple identifier used to uniquely identify
# the block. It is taken from the first word of the first # the block. It is taken from the first word of the first paragraph of the
# paragraph of the first marker of a given block, i.e: # first marker of a given block, i.e:
# #
# <Type> Goo # <Type> Goo
# <Description> Bla bla bla # <Description> Bla bla bla
@ -708,6 +707,7 @@ class DocBlock:
# This function adds a new element to 'self.items'. # This function adds a new element to 'self.items'.
#
# 'marker' is a marker string, or None. # 'marker' is a marker string, or None.
# 'lines' is a list of text lines used to compute a list of # 'lines' is a list of text lines used to compute a list of
# DocContent objects. # DocContent objects.
@ -726,7 +726,7 @@ class DocBlock:
l = len( lines ) l = len( lines )
# add a new marker only if its marker and its content list # add a new marker only if its marker and its content list
# aren't empty # are not empty
# #
if l > 0 and marker: if l > 0 and marker:
content = DocContent( lines ) content = DocContent( lines )
@ -931,14 +931,13 @@ class DocSectionList:
abstract = block.find_content( "abstract" ) abstract = block.find_content( "abstract" )
if self.sections.has_key( name ): if self.sections.has_key( name ):
# There is already a section with this name in our # There is already a section with this name in our list. We
# list. We will try to complete it. # will try to complete it.
# #
section = self.sections[name] section = self.sections[name]
if section.abstract: if section.abstract:
# This section already has an abstract defined; # This section already has an abstract defined; simply check
# simply check that the new section doesn't # that the new section doesn't provide a new one.
# provide a new one.
# #
if abstract: if abstract:
section.block.print_error( section.block.print_error(
@ -949,8 +948,8 @@ class DocSectionList:
"second definition in " + "second definition in " +
"'" + block.location() + "'" ) "'" + block.location() + "'" )
else: else:
# The old section didn't contain an abstract; we are # The old section didn't contain an abstract; we are now
# now going to replace it. # going to replace it.
# #
section.abstract = abstract section.abstract = abstract
section.description = block.find_content( "description" ) section.description = block.find_content( "description" )
@ -979,8 +978,8 @@ class DocSectionList:
def prepare_files( self, file_prefix = None ): def prepare_files( self, file_prefix = None ):
# prepare the section list, by computing section filenames # prepare the section list, by computing section filenames and the
# and the index # index
# #
if file_prefix: if file_prefix:
prefix = file_prefix + "-" prefix = file_prefix + "-"
@ -996,8 +995,8 @@ class DocSectionList:
else: else:
section.title = "UNKNOWN_SECTION_TITLE!" section.title = "UNKNOWN_SECTION_TITLE!"
# sort section elements according to the <order> marker if
# available # sort section elements according to the <order> marker if available
# #
for section in self.sections.values(): for section in self.sections.values():
order = section.block.find_content( "order" ) order = section.block.find_content( "order" )
@ -1101,7 +1100,7 @@ class DocSectionList:
# Filter a given list of DocBlocks. Returns a new list of DocBlock objects # Filter a given list of DocBlocks. Returns a new list of DocBlock objects
# that only contains element whose "type" (i.e. first marker) is in the # that only contains element whose "type" (i.e. first marker) is in the
# "types" parameter. # "types" parameter.
# #
@ -1152,7 +1151,8 @@ class DocDocument:
if block.name: if block.name:
content = block.find_content( "chapter" ) content = block.find_content( "chapter" )
if content: if content:
# it's a chapter definition -- add it to our list # a chapter definition -- add it to our list
#
chapter = DocChapter( block ) chapter = DocChapter( block )
self.chapters.append( chapter ) self.chapters.append( chapter )
else: else:
@ -1216,6 +1216,7 @@ class DocDocument:
print chapter_footer print chapter_footer
# list lost sections # list lost sections
#
if self.lost_sections: if self.lost_sections:
print chapter_header + "OTHER SECTIONS:" + chapter_inter print chapter_header + "OTHER SECTIONS:" + chapter_inter
@ -1234,6 +1235,7 @@ class DocDocument:
print chapter_footer print chapter_footer
# index # index
#
print chapter_header + '<a href="' + self.section_list.index_filename + '">Index</a>' + chapter_footer print chapter_header + '<a href="' + self.section_list.index_filename + '">Index</a>' + chapter_footer
print html_footer print html_footer
@ -1265,8 +1267,8 @@ def filter_section_blocks( block ):
return block.section != None return block.section != None
# Perform a lexicographical comparison of two DocBlock # Perform a lexicographical comparison of two DocBlock objects. Returns -1,
# objects. Returns -1, 0 or 1. # 0 or 1.
# #
def block_lexicographical_compare( b1, b2 ): def block_lexicographical_compare( b1, b2 ):
if not b1.name: if not b1.name:
@ -1285,7 +1287,7 @@ def block_lexicographical_compare( b1, b2 ):
return 1 return 1
# dump a list block as a single HTML page # Dump a list block as a single HTML page.
# #
def dump_html_1( block_list ): def dump_html_1( block_list ):
print html_header print html_header
@ -1349,7 +1351,7 @@ def make_block_list():
# 1 - parse comment format 1 # 1 - parse comment format 1
# 2 - parse comment format 2 # 2 - parse comment format 2
# #
# 4 - wait for beginning of source (or comment ??) # 4 - wait for beginning of source (or comment?)
# 5 - process source # 5 - process source
# #
comment = [] comment = []
@ -1414,15 +1416,15 @@ def make_block_list():
# #
elif format == 1: elif format == 1:
# If the line doesn't begin with a "*", something went # If the line doesn't begin with a "*", something went wrong,
# wrong, and we must exit, and forget the current block. # and we must exit, and forget the current block.
# #
if l == 0 or line2[0] != '*': if l == 0 or line2[0] != '*':
block = [] block = []
format = 0 format = 0
# Otherwise, we test for an end of block, which is an # Otherwise, we test for an end of block, which is an arbitrary
# arbitrary number of '*', followed by '/'. # number of '*', followed by '/'.
# #
else: else:
i = 1 i = 1
@ -1449,8 +1451,8 @@ def make_block_list():
# #
elif format == 2: elif format == 2:
# If the line doesn't begin with '/*' and end with '*/', # If the line doesn't begin with '/*' and end with '*/', this is
# this is the end of the format 2 format. # the end of the format 2 format.
# #
if l < 4 or line2[: 2] != '/*' or line2[-2 :] != '*/': if l < 4 or line2[: 2] != '/*' or line2[-2 :] != '*/':
if block != []: if block != []:
@ -1538,7 +1540,7 @@ def main( argv ):
## section_list.dump_html_index() ## section_list.dump_html_index()
# If called from the command line # if called from the command line
# #
if __name__ == '__main__': if __name__ == '__main__':
main( sys.argv ) main( sys.argv )

View File

@ -342,11 +342,12 @@
/* */ /* */
/* @description: */ /* @description: */
/* A macro used in #include statements to name the file containing */ /* A macro used in #include statements to name the file containing */
/* a small useful API to handle bezier arcs. Note that you _must_ */ /* a small useful API to handle bezier arcs. Note that you _must_ */
/* include FT_FREETYPE_H or FT_IMAGE_H before this header.. */ /* include FT_FREETYPE_H or FT_IMAGE_H before this header. */
/* */ /* */
#define FT_BEZIER_H <freetype/ftbezier.h> #define FT_BEZIER_H <freetype/ftbezier.h>
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* @macro: */ /* @macro: */

View File

@ -146,10 +146,10 @@ FT_BEGIN_HEADER
FT_Int32 y ); FT_Int32 y );
#ifdef FT_CONFIG_OPTION_OLD_CALCS
FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x ); FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x );
#ifdef FT_CONFIG_OPTION_OLD_CALCS
#define SQRT_64( z ) FT_Sqrt64( &z ) #define SQRT_64( z ) FT_Sqrt64( &z )
/*************************************************************************/ /*************************************************************************/

View File

@ -28,6 +28,7 @@
#include FT_BBOX_H #include FT_BBOX_H
#include FT_IMAGE_H #include FT_IMAGE_H
#include FT_OUTLINE_H #include FT_OUTLINE_H
#include FT_INTERNAL_CALC_H
typedef struct TBBox_Rec_ typedef struct TBBox_Rec_
@ -36,7 +37,7 @@
FT_BBox bbox; FT_BBox bbox;
} TBBox_Rec; } TBBox_Rec;
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -214,7 +215,7 @@
FT_Pos* min, FT_Pos* min,
FT_Pos* max ) FT_Pos* max )
{ {
FT_Pos stack[32*3+1], *arc; FT_Pos stack[32*3 + 1], *arc;
arc = stack; arc = stack;
@ -253,7 +254,7 @@
} }
} }
/* Unknown direction - split the arc in two */ /* Unknown direction -- split the arc in two */
arc[6] = y4; arc[6] = y4;
arc[1] = y1 = ( y1 + y2 ) / 2; arc[1] = y1 = ( y1 + y2 ) / 2;
arc[5] = y4 = ( y4 + y3 ) / 2; arc[5] = y4 = ( y4 + y3 ) / 2;
@ -285,15 +286,28 @@
FT_Pos* min, FT_Pos* min,
FT_Pos* max ) FT_Pos* max )
{ {
FT_Pos a = y4 - 3*y3 + 3*y2 - y1; /* FT_Pos a = y4 - 3*y3 + 3*y2 - y1; */
FT_Pos b = y3 - 2*y2 + y1; FT_Pos b = y3 - 2*y2 + y1;
FT_Pos c = y2 - y1; FT_Pos c = y2 - y1;
FT_Pos d = y1; FT_Pos d = y1;
FT_Pos y; FT_Pos y;
FT_Fixed uu; FT_Fixed uu;
/* the polynom is "a*x^3 + 3b*x^2 + 3c*x + d", however, we also */ FT_UNUSED ( y4 );
/* have dP/dx(u) = 0, which implies that P(u) = b*u^2 + 2c*u + d */
/* The polynom is */
/* */
/* a*x^3 + 3b*x^2 + 3c*x + d . */
/* */
/* However, we also have */
/* */
/* dP/dx(u) = 0 , */
/* */
/* which implies that */
/* */
/* P(u) = b*u^2 + 2c*u + d */
if ( u > 0 && u < 0x10000L ) if ( u > 0 && u < 0x10000L )
{ {
uu = FT_MulFix( u, u ); uu = FT_MulFix( u, u );
@ -316,7 +330,7 @@
/* always compare first and last points */ /* always compare first and last points */
if ( y1 < *min ) *min = y1; if ( y1 < *min ) *min = y1;
else if ( y1 > *max ) *max = y1; else if ( y1 > *max ) *max = y1;
if ( y4 < *min ) *min = y4; if ( y4 < *min ) *min = y4;
else if ( y4 > *max ) *max = y4; else if ( y4 > *max ) *max = y4;
@ -334,47 +348,48 @@
return; return;
} }
/* there are some split points, now, find them.. */ /* There are some split points. Find them. */
{ {
FT_Pos a = y4 - 3*y3 + 3*y2 - y1; FT_Pos a = y4 - 3*y3 + 3*y2 - y1;
FT_Pos b = y3 - 2*y2 + y1; FT_Pos b = y3 - 2*y2 + y1;
FT_Pos c = y2 - y1; FT_Pos c = y2 - y1;
FT_Pos d, t1; FT_Pos d;
FT_Fixed t; FT_Fixed t;
/* we need to solve "ax²+2bx+c" here, without floating points !! */
/* the trick is to normalize to a different representation in order */ /* we need to solve "ax^2+2bx+c" here, without floating points! */
/* to use our 16.16 fixed point routines.. */ /* The trick is to normalize to a different representation in order */
/* to use our 16.16 fixed point routines. */
/* */ /* */
/* we're going to compute FT_MulFix(b,b) and FT_MulFix(a,c) after */ /* We compute FT_MulFix(b,b) and FT_MulFix(a,c) after the */
/* the normalisation. these values must fit in a single 16.16 */ /* the normalization. These values must fit into a single 16.16 */
/* value. */ /* value. */
/* */ /* */
/* we normalize a, b and c to "8.16" fixed float values to ensure */ /* We normalize a, b, and c to "8.16" fixed float values to ensure */
/* that their product is held in a "16.16" value.. */ /* that their product is held in a "16.16" value. */
/* */ /* */
{ {
FT_ULong t1, t2; FT_ULong t1, t2;
int shift = 0; int shift = 0;
t1 = (FT_ULong)((a >= 0) ? a : -a ); t1 = (FT_ULong)((a >= 0) ? a : -a );
t2 = (FT_ULong)((b >= 0) ? b : -b ); t2 = (FT_ULong)((b >= 0) ? b : -b );
t1 |= t2; t1 |= t2;
t2 = (FT_ULong)((c >= 0) ? c : -c ); t2 = (FT_ULong)((c >= 0) ? c : -c );
t1 |= t2; t1 |= t2;
if ( t1 == 0 ) /* all coefficients are 0 !! */ if ( t1 == 0 ) /* all coefficients are 0! */
return; return;
if ( t1 > 0xFFFFFFL ) if ( t1 > 0xFFFFFFL )
{ {
do do
{ {
shift--; shift--;
t1 >>= 1; t1 >>= 1;
} } while ( t1 > 0xFFFFFFL );
while ( t1 > 0xFFFFFFL );
a >>= shift; a >>= shift;
b >>= shift; b >>= shift;
c >>= shift; c >>= shift;
@ -385,9 +400,8 @@
{ {
shift++; shift++;
t1 <<= 1; t1 <<= 1;
} } while ( t1 < 0x800000L );
while ( t1 < 0x800000L );
a <<= shift; a <<= shift;
b <<= shift; b <<= shift;
c <<= shift; c <<= shift;
@ -399,7 +413,7 @@
{ {
if ( b != 0 ) if ( b != 0 )
{ {
t = - FT_DivFix( c, b )/2; t = - FT_DivFix( c, b ) / 2;
test_cubic_zero( y1, y2, y3, y4, t, min, max ); test_cubic_zero( y1, y2, y3, y4, t, min, max );
} }
} }
@ -412,23 +426,23 @@
if ( d == 0 ) if ( d == 0 )
{ {
/* there is a single split point, at -b/a */ /* there is a single split point at -b/a */
t = - FT_DivFix( b, a ); t = - FT_DivFix( b, a );
test_cubic_zero( y1, y2, y3, y4, t, min, max ); test_cubic_zero( y1, y2, y3, y4, t, min, max );
} }
else else
{ {
/* there are two solutions, we need to filter them though */ /* there are two solutions; we need to filter them though */
d = FT_SqrtFixed( (FT_Int32)d ); d = FT_SqrtFixed( (FT_Int32)d );
t = - FT_DivFix( b - d, a ); t = - FT_DivFix( b - d, a );
test_cubic_zero( y1, y2, y3, y4, t, min, max ); test_cubic_zero( y1, y2, y3, y4, t, min, max );
t = - FT_DivFix( b + d, a ); t = - FT_DivFix( b + d, a );
test_cubic_zero( y1, y2, y3, y4, t, min, max ); test_cubic_zero( y1, y2, y3, y4, t, min, max );
} }
} }
} }
} }
#endif #endif

View File

@ -239,50 +239,49 @@
FT_UInt32 y, FT_UInt32 y,
FT_Int64 *z ) FT_Int64 *z )
{ {
{ FT_UInt32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
FT_UInt32 lo1, hi1, lo2, hi2, lo, hi, i1, i2;
lo1 = x & 0x0000FFFFU; hi1 = x >> 16; lo1 = x & 0x0000FFFFU; hi1 = x >> 16;
lo2 = y & 0x0000FFFFU; hi2 = y >> 16; lo2 = y & 0x0000FFFFU; hi2 = y >> 16;
lo = lo1 * lo2; lo = lo1 * lo2;
i1 = lo1 * hi2; i1 = lo1 * hi2;
i2 = lo2 * hi1; i2 = lo2 * hi1;
hi = hi1 * hi2; hi = hi1 * hi2;
/* Check carry overflow of i1 + i2 */ /* Check carry overflow of i1 + i2 */
i1 += i2; i1 += i2;
hi += (FT_UInt32)( i1 < i2 ) << 16; hi += (FT_UInt32)( i1 < i2 ) << 16;
hi += i1 >> 16; hi += i1 >> 16;
i1 = i1 << 16; i1 = i1 << 16;
/* Check carry overflow of i1 + lo */ /* Check carry overflow of i1 + lo */
lo += i1; lo += i1;
hi += ( lo < i1 ); hi += ( lo < i1 );
z->lo = lo; z->lo = lo;
z->hi = hi; z->hi = hi;
}
} }
static FT_UInt32 static FT_UInt32
ft_div64by32( FT_UInt32 hi, ft_div64by32( FT_UInt32 hi,
FT_UInt32 lo, FT_UInt32 lo,
FT_UInt32 y ) FT_UInt32 y )
{ {
FT_UInt r, q; FT_UInt r, q;
FT_Int i; FT_Int i;
q = 0; q = 0;
r = hi; r = hi;
if ( r >= y ) if ( r >= y )
return (FT_UInt32)0x7FFFFFFF; return (FT_UInt32)0x7FFFFFFFL;
i = 32; i = 32;
do do
{ {
r <<= 1; r <<= 1;
@ -295,10 +294,9 @@
q |= 1; q |= 1;
} }
lo <<= 1; lo <<= 1;
} } while ( --i );
while (--i);
return q;
return q;
} }
@ -310,6 +308,7 @@
{ {
register FT_UInt32 lo, hi, max; register FT_UInt32 lo, hi, max;
max = x->lo > y->lo ? x->lo : y->lo; max = x->lo > y->lo ? x->lo : y->lo;
lo = x->lo + y->lo; lo = x->lo + y->lo;
hi = x->hi + y->hi + ( lo < max ); hi = x->hi + y->hi + ( lo < max );
@ -319,15 +318,13 @@
} }
/* documentation is in freetype.h */ /* documentation is in freetype.h */
FT_EXPORT_DEF( FT_Long ) FT_MulDiv( FT_Long a, FT_EXPORT_DEF( FT_Long ) FT_MulDiv( FT_Long a,
FT_Long b, FT_Long b,
FT_Long c ) FT_Long c )
{ {
long s; long s;
if ( a == 0 || b == c ) if ( a == 0 || b == c )
@ -347,10 +344,10 @@
ft_multo64( a, b, &temp ); ft_multo64( a, b, &temp );
temp2.hi = 0; temp2.hi = 0;
temp2.lo = (FT_UInt32)(c >> 1); temp2.lo = (FT_UInt32)(c >> 1);
FT_Add64( &temp, &temp2, &temp ); FT_Add64( &temp, &temp2, &temp );
a = ft_div64by32( temp.hi, temp.lo, b ); a = ft_div64by32( temp.hi, temp.lo, b );
} }
else else
@ -440,13 +437,14 @@
FT_Int32 y, FT_Int32 y,
FT_Int64 *z ) FT_Int64 *z )
{ {
FT_Int32 s; FT_Int32 s;
s = x; x = ABS( x ); s = x; x = ABS( x );
s ^= y; y = ABS( y ); s ^= y; y = ABS( y );
ft_multo64( x, y, z ); ft_multo64( x, y, z );
if ( s < 0 ) if ( s < 0 )
{ {
z->lo = (FT_UInt32)-(FT_Int32)z->lo; z->lo = (FT_UInt32)-(FT_Int32)z->lo;
@ -476,7 +474,7 @@
if ( x->hi == 0 ) if ( x->hi == 0 )
{ {
if ( y > 0 ) if ( y > 0 )
q = (x->lo + (y >> 1)) / y; q = ( x->lo + ( y >> 1 ) ) / y;
else else
q = 0x7FFFFFFFL; q = 0x7FFFFFFFL;
@ -484,6 +482,7 @@
} }
q = ft_div64by32( x->hi, x->lo, y ); q = ft_div64by32( x->hi, x->lo, y );
return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q ); return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
} }
@ -563,20 +562,20 @@
} }
#endif /* FT_CONFIG_OPTION_OLD_CALCS */ #endif /* FT_CONFIG_OPTION_OLD_CALCS */
#endif /* FT_LONG64 */ #endif /* FT_LONG64 */
/* a not-so-fast but working 16.16 fixed point square root function */ /* a not-so-fast but working 16.16 fixed point square root function */
FT_EXPORT_DEF( FT_Int32 ) FT_SqrtFixed( FT_Int32 x ) FT_EXPORT_DEF( FT_Int32 ) FT_SqrtFixed( FT_Int32 x )
{ {
FT_UInt32 root, rem_hi, rem_lo, test_div; FT_UInt32 root, rem_hi, rem_lo, test_div;
FT_Int count; FT_Int count;
root = 0; root = 0;
if ( x > 0 ) if ( x > 0 )
@ -584,19 +583,19 @@
rem_hi = 0; rem_hi = 0;
rem_lo = x; rem_lo = x;
count = 24; count = 24;
do do
{ {
rem_hi = (rem_hi << 2) | (rem_lo >> 30); rem_hi = ( rem_hi << 2 ) | ( rem_lo >> 30 );
rem_lo <<= 2; rem_lo <<= 2;
root <<= 1; root <<= 1;
test_div = (root << 1) + 1; test_div = ( root << 1 ) + 1;
if ( rem_hi >= test_div ) if ( rem_hi >= test_div )
{ {
rem_hi -= test_div; rem_hi -= test_div;
root += 1; root += 1;
} }
} } while ( --count );
while (--count);
} }
return (FT_Int32)root; return (FT_Int32)root;

View File

@ -247,7 +247,7 @@
TScan last_ey; TScan last_ey;
FT_Vector bez_stack[32 * 3+1]; FT_Vector bez_stack[32 * 3 + 1];
int lev_stack[32]; int lev_stack[32];
FT_Outline outline; FT_Outline outline;