Author: tkreuzer
Date: Thu Jun 12 15:50:12 2008
New Revision: 33951
URL:
http://svn.reactos.org/svn/reactos?rev=33951&view=rev
Log:
Patch by Jeffrey Morlan (mrnobo1024 at yahoo dot com, irc: Goplat), modified by me:
The freetype asm function FT_MulFix clobbers the edx register, but doesn't tell it to
gcc explicitly, so when inlined versions were resulting in wrong results. Fix it by also
marking edx as output register.
Also enable commented out code in win32k again that works correctly now.
By me:
I modified the patch to not alter any 3rd party code, but instead I copied the fuction to
_ftmulfix_ros.c and also coplied the container file ftbase.c which now uses the fixed
function from our private file.
This fixes a bunch of text output issues (underscore, text marking)
See issue #3346 for more details.
Added:
trunk/reactos/dll/3rdparty/freetype/src/base/_ftbase_ros.c (with props)
trunk/reactos/dll/3rdparty/freetype/src/base/_ftmulfix_ros.c (with props)
Modified:
trunk/reactos/dll/3rdparty/freetype/freetype.rbuild
trunk/reactos/subsystems/win32/win32k/objects/text.c
Modified: trunk/reactos/dll/3rdparty/freetype/freetype.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/freetype/free…
==============================================================================
--- trunk/reactos/dll/3rdparty/freetype/freetype.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/3rdparty/freetype/freetype.rbuild [iso-8859-1] Thu Jun 12 15:50:12
2008
@@ -24,7 +24,7 @@
<file>ftsystem.c</file>
<file>ftinit.c</file>
<file>ftdebug.c</file>
- <file>ftbase.c</file>
+ <file>_ftbase_ros.c</file>
<file>ftbbox.c</file>
<file>ftglyph.c</file>
<file>ftbdf.c</file>
Added: trunk/reactos/dll/3rdparty/freetype/src/base/_ftbase_ros.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/freetype/src/…
==============================================================================
--- trunk/reactos/dll/3rdparty/freetype/src/base/_ftbase_ros.c (added)
+++ trunk/reactos/dll/3rdparty/freetype/src/base/_ftbase_ros.c [iso-8859-1] Thu Jun 12
15:50:12 2008
@@ -1,0 +1,42 @@
+/***************************************************************************/
+/* */
+/* ftbase.c */
+/* */
+/* Single object library component (body only). */
+/* */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+
+#define FT_MAKE_OPTION_SINGLE_OBJECT
+
+#define FT_MulFix FT_MulFix_wrong
+#include "ftcalc.c"
+#undef FT_MulFix
+#include "_ftmulfix_ros.c"
+
+#include "ftdbgmem.c"
+#include "ftgloadr.c"
+#include "ftnames.c"
+#include "ftobjs.c"
+#include "ftoutln.c"
+#include "ftrfork.c"
+#include "ftstream.c"
+#include "fttrigon.c"
+#include "ftutil.c"
+
+#if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON )
+#include <ftmac.c>
+#endif
+
+/* END */
Propchange: trunk/reactos/dll/3rdparty/freetype/src/base/_ftbase_ros.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/3rdparty/freetype/src/base/_ftmulfix_ros.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/freetype/src/…
==============================================================================
--- trunk/reactos/dll/3rdparty/freetype/src/base/_ftmulfix_ros.c (added)
+++ trunk/reactos/dll/3rdparty/freetype/src/base/_ftmulfix_ros.c [iso-8859-1] Thu Jun 12
15:50:12 2008
@@ -1,0 +1,92 @@
+ FT_EXPORT_DEF( FT_Long )
+ FT_MulFix( FT_Long a,
+ FT_Long b )
+ {
+ /* use inline assembly to speed up things a bit */
+
+#if defined( __GNUC__ ) && defined( i386 )
+
+ FT_Long result;
+
+
+ __asm__ __volatile__ (
+ "imul %%edx\n"
+ "movl %%edx, %%ecx\n"
+ "sarl $31, %%ecx\n"
+ "addl $0x8000, %%ecx\n"
+ "addl %%ecx, %%eax\n"
+ "adcl $0, %%edx\n"
+ "shrl $16, %%eax\n"
+ "shll $16, %%edx\n"
+ "addl %%edx, %%eax\n"
+ "mov %%eax, %0\n"
+ : "=r"(result), "=d"(b)
+ : "a"(a), "d"(b)
+ : "%ecx"
+ );
+ return result;
+
+#elif 1
+
+ FT_Long sa, sb;
+ FT_ULong ua, ub;
+
+
+ if ( a == 0 || b == 0x10000L )
+ return a;
+
+ sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );
+ a = ( a ^ sa ) - sa;
+ sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );
+ b = ( b ^ sb ) - sb;
+
+ ua = (FT_ULong)a;
+ ub = (FT_ULong)b;
+
+ if ( ua <= 2048 && ub <= 1048576L )
+ ua = ( ua * ub + 0x8000U ) >> 16;
+ else
+ {
+ FT_ULong al = ua & 0xFFFFU;
+
+
+ ua = ( ua >> 16 ) * ub + al * ( ub >> 16 ) +
+ ( ( al * ( ub & 0xFFFFU ) + 0x8000U ) >> 16 );
+ }
+
+ sa ^= sb,
+ ua = (FT_ULong)(( ua ^ sa ) - sa);
+
+ return (FT_Long)ua;
+
+#else /* 0 */
+
+ FT_Long s;
+ FT_ULong ua, ub;
+
+
+ if ( a == 0 || b == 0x10000L )
+ return a;
+
+ s = a; a = FT_ABS( a );
+ s ^= b; b = FT_ABS( b );
+
+ ua = (FT_ULong)a;
+ ub = (FT_ULong)b;
+
+ if ( ua <= 2048 && ub <= 1048576L )
+ ua = ( ua * ub + 0x8000UL ) >> 16;
+ else
+ {
+ FT_ULong al = ua & 0xFFFFUL;
+
+
+ ua = ( ua >> 16 ) * ub + al * ( ub >> 16 ) +
+ ( ( al * ( ub & 0xFFFFUL ) + 0x8000UL ) >> 16 );
+ }
+
+ return ( s < 0 ? -(FT_Long)ua : (FT_Long)ua );
+
+#endif /* 0 */
+
+ }
Propchange: trunk/reactos/dll/3rdparty/freetype/src/base/_ftmulfix_ros.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] Thu Jun 12 15:50:12
2008
@@ -362,7 +362,7 @@
/* FIXME: Complete text metrics */
XScale = Face->size->metrics.x_scale;
YScale = Face->size->metrics.y_scale;
-#if 1 /* This (Wine) code doesn't seem to work correctly for us */
+#if 0 /* This (Wine) code doesn't seem to work correctly for us */
FontGDI->TextMetric.tmAscent = (FT_MulFix(Face->ascender, YScale) + 32)
>> 6;
FontGDI->TextMetric.tmDescent = (FT_MulFix(Face->descender, YScale) + 32)
>> 6;
FontGDI->TextMetric.tmHeight = (FT_MulFix(Face->ascender, YScale) -
@@ -644,10 +644,10 @@
Descent = pOS2->usWinDescent;
}
-#if 1 /* This (Wine) code doesn't seem to work correctly for us, cmd issue */
+#if 0 /* This (Wine) code doesn't seem to work correctly for us, cmd issue */
TM->tmAscent = (FT_MulFix(Ascent, YScale) + 32) >> 6;
TM->tmDescent = (FT_MulFix(Descent, YScale) + 32) >> 6;
-#else /* This (ros) code doesn't seem to work correctly for us for it miss 2-3 pixel
draw of the font*/
+#else /* This (ros) code was previously affected by a FreeType bug, but it works now */
TM->tmAscent = (Face->size->metrics.ascender + 32) >> 6; /* units above
baseline */
TM->tmDescent = (32 - Face->size->metrics.descender) >> 6; /* units
below baseline */
#endif