summaryrefslogtreecommitdiff
path: root/tex/context/base/supp-pdf.tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2005-06-21 00:00:00 +0200
committerHans Hagen <pragma@wxs.nl>2005-06-21 00:00:00 +0200
commitdddd4cf24fcf8ef5f9c76acb7da468f502cd0bcd (patch)
tree868075883ed03d7c02bc2860a53ffb25b93e4ce5 /tex/context/base/supp-pdf.tex
parentdfec7488b8da12222bdaa42df6f5585b2b89fd70 (diff)
downloadcontext-dddd4cf24fcf8ef5f9c76acb7da468f502cd0bcd.tar.gz
stable 2005.06.21
Diffstat (limited to 'tex/context/base/supp-pdf.tex')
-rw-r--r--tex/context/base/supp-pdf.tex60
1 files changed, 43 insertions, 17 deletions
diff --git a/tex/context/base/supp-pdf.tex b/tex/context/base/supp-pdf.tex
index 184cfb815..4ef82cdb7 100644
--- a/tex/context/base/supp-pdf.tex
+++ b/tex/context/base/supp-pdf.tex
@@ -1248,41 +1248,42 @@
\def\MPreadjustdimen % acts on \MPscratchDim and MPscratchCnt
{\ifcase\MPscratchCnt
- \multiply\MPscratchDim 4
+ \multiply\scratchdimen 4
\or
- \multiply\MPscratchDim 2
+ \multiply\scratchdimen 2
\else
\expandafter\doMPreadjustdimen
\fi}
\def\doMPreadjustdimen
- {\ifnum\MPscratchCnt > 2
- \divide\MPscratchDim 2
+ {\ifnum\MPscratchCnt>2
+ \divide\scratchdimen 2
\advance\MPscratchCnt \minusone
\expandafter\doMPreadjustdimen
\fi}
\def\MPreciprocaldeterminant
- {\MPscratchDim\withoutpt\the\dimen0 \dimen6 % s_x*s_y
- \advance\MPscratchDim - \withoutpt\the\dimen2 \dimen4 % s_x*s_y - r_x*r_y
- \ifdim\MPscratchDim<\zeropoint % we need a positive dimension
- \MPscratchDim-\MPscratchDim % for \MPadjustdimen
+ {\scratchdimen\withoutpt\the\dimen0 \dimen6 % s_x*s_y
+ \advance\scratchdimen - \withoutpt\the\dimen2 \dimen4 % s_x*s_y - r_x*r_y
+ \ifdim\scratchdimen<\zeropoint % we need a positive dimension
+ \scratchdimen-\scratchdimen % for \MPadjustdimen (?)
\doMPreciprocal
- \MPscratchDim-\MPscratchDim
+ \scratchdimen-\scratchdimen
\else
\doMPreciprocal
- \fi}
+ \fi
+ \edef\MPreciprocal{\withoutpt\the\scratchdimen}}
\newcount\MPnumerator \MPnumerator = 1073741824 % 2^{30}
% todo: dimexpr
-\def\doMPreciprocal % replace \MPscratchDim with its reciprocal
- {\ifdim\MPscratchDim=\onepoint \else
+\def\doMPreciprocal % replace \scratchdimen with its reciprocal
+ {\ifdim\scratchdimen=\onepoint \else
\MPadjustdimen
\scratchcounter\MPnumerator
- \divide\scratchcounter\MPscratchDim
- \MPscratchDim1\scratchcounter % 1 needed !
+ \divide\scratchcounter\scratchdimen
+ \scratchdimen1\scratchcounter % 1 needed !
\MPreadjustdimen
\fi}
@@ -1579,6 +1580,21 @@
%D
%D If this should ever cause problems, the scale factors can be reduced.
+% \def\doMPconcat#1#2#3#4%
+% {\dimen12=#1pt % p_x % #1\onepoint
+% \dimen14=#3pt % p_y % #3\onepoint
+% \advance\dimen12 -\dimen8 % p_x - t_x
+% \advance\dimen14 -\dimen10 % p_y - t_y
+% \dimen18=\withoutpt\the\dimen6 \dimen12 % s_y(p_x - t_x)
+% \advance\dimen18 -\withoutpt\the\dimen4 \dimen14 % - r_y(p_y-t_y)
+% \dimen14=\withoutpt\the\dimen0 \dimen14 % s_x(p_y-t_y)
+% \advance\dimen14 -\withoutpt\the\dimen2 \dimen12 % - r_x(p_x-t_x)
+% % \MPscratchDim contains precomputed 1/D:
+% \dimen18=\withoutpt\the\MPscratchDim \dimen18
+% \dimen14=\withoutpt\the\MPscratchDim \dimen14
+% \edef#2{\withoutpt\the\dimen18}% % p_x^\prime
+% \edef#4{\withoutpt\the\dimen14}} % p_y^\prime
+
\def\doMPconcat#1#2#3#4%
{\dimen12=#1pt % p_x % #1\onepoint
\dimen14=#3pt % p_y % #3\onepoint
@@ -1588,12 +1604,22 @@
\advance\dimen18 -\withoutpt\the\dimen4 \dimen14 % - r_y(p_y-t_y)
\dimen14=\withoutpt\the\dimen0 \dimen14 % s_x(p_y-t_y)
\advance\dimen14 -\withoutpt\the\dimen2 \dimen12 % - r_x(p_x-t_x)
- % \MPscratchDim contains precomputed 1/D:
- \dimen18=\withoutpt\the\MPscratchDim \dimen18
- \dimen14=\withoutpt\the\MPscratchDim \dimen14
+ % \MPreciprocal contains precomputed 1/D:
+ \dimen18=\MPreciprocal\dimen18
+ \dimen14=\MPreciprocal\dimen14
\edef#2{\withoutpt\the\dimen18}% % p_x^\prime
\edef#4{\withoutpt\the\dimen14}} % p_y^\prime
+% faster but not that often used
+%
+% \def\doMPconcat#1#2#3#4%
+% {\dimen12\dimexpr#1\points-\dimen 8\relax % p_x-t_x
+% \dimen14\dimexpr#3\points-\dimen10\relax % p_y-t_y
+% \dimen18\dimexpr\withoutpt\the\dimen6\dimen12-\withoutpt\the\dimen4\dimen14\relax % s_y(p_x-t_x)-r_y(p_y-t_y)
+% \dimen14\dimexpr\withoutpt\the\dimen0\dimen14-\withoutpt\the\dimen2\dimen12\relax % s_x(p_y-t_y)-r_x(p_x-t_x)
+% \edef#2{\withoutpt\the\dimexpr\MPreciprocal\dimen18\relax}% % p_x^\prime
+% \edef#4{\withoutpt\the\dimexpr\MPreciprocal\dimen14\relax}} % p_y^\prime
+
%D One reason for Daniel to write this patch was that at small sizes
%D the accuracy was less than optimal. Here is a test that demonstrates
%D that his alternative is pretty good: