From 28ed9703d15649c74a8e3431ea056af41cdc7820 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Tue, 27 Oct 1998 16:49:40 +0000 Subject: [PATCH] Support high accuracy rendering (slowly) git-svn-id: svn://10.0.0.236/trunk@13558 18797224-902f-48f8-a5cc-f745e15eee43 --- .../gfx/src/windows/nsRenderingContextWin.cpp | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/mozilla/gfx/src/windows/nsRenderingContextWin.cpp b/mozilla/gfx/src/windows/nsRenderingContextWin.cpp index cf65bd5d92d..5d8a3bb481a 100644 --- a/mozilla/gfx/src/windows/nsRenderingContextWin.cpp +++ b/mozilla/gfx/src/windows/nsRenderingContextWin.cpp @@ -1507,22 +1507,30 @@ nsRenderingContextWin :: DrawString(const PRUnichar *aString, PRUint32 aLength, SetupFontAndColor(); - INT dxMem[500]; - INT* dx0; - if (nsnull != aSpacing) { - dx0 = dxMem; - if (aLength > 500) { - dx0 = new INT[aLength]; + if (nsnull != aSpacing) + { + // XXX Fix path to use a twips transform in the DC and use the + // spacing values directly and let windows deal with the sub-pixel + // positioning. + + // Slow, but accurate rendering + const PRUnichar* end = aString + aLength; + while (aString < end) + { + // XXX can shave some cycles by inlining a version of transform + // coord where y is constant and transformed once + x = aX; + y = aY; + mTMatrix->TransformCoord(&x, &y); + ::ExtTextOutW(mDC, x, y, 0, NULL, aString, 1, NULL); + aX += *aSpacing++; + aString++; } - mTMatrix->ScaleXCoords(aSpacing, aLength, dx0); } - - mTMatrix->TransformCoord(&x, &y); - - ::ExtTextOutW(mDC, x, y, 0, NULL, aString, aLength, aSpacing ? dx0 : NULL); - - if ((nsnull != aSpacing) && (dx0 != dxMem)) { - delete [] dx0; + else + { + mTMatrix->TransformCoord(&x, &y); + ::ExtTextOutW(mDC, x, y, 0, NULL, aString, aLength, NULL); } if (nsnull != mFontMetrics)