summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2009-12-01 17:25:49 +0000
committerscuri <scuri>2009-12-01 17:25:49 +0000
commitda448b73cc1d103d9fdb4829b2f731514834bce3 (patch)
treeb0f661ec6dc1a5d1ae458e4a932e0ef668e913d7
parent41be4b7e6f5661a28d02edad52c6651097da7202 (diff)
Fixed: text alignment in the Windows base driver when WriteMode=XOR.
-rw-r--r--html/en/history.html4
-rw-r--r--src/win32/cdwin.c24
2 files changed, 14 insertions, 14 deletions
diff --git a/html/en/history.html b/html/en/history.html
index 0a04acc..7464f1d 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -19,7 +19,7 @@
<body>
<h2>History of Changes</h2>
-<h3>CVS (27/Nov/2009)</h3>
+<h3>CVS (01/Dec/2009)</h3>
<ul>
<li><span class="style1">Changed</span><span class="hist_changed">:</span>
Freetype updated to version 2.3.11.</li>
@@ -51,6 +51,8 @@
<strong>CanvasFont</strong> in the PICTURE driver.</li>
<li><span style="color: #FF0000">Fixed:</span> improved support for line
endings at <strong>cdPlay</strong> in the METAFILE driver.</li>
+ <li><span style="color: #FF0000">Fixed:</span> text alignment in the Windows
+ base driver when WriteMode=XOR.</li>
</ul>
<h3><a href="http://sourceforge.net/projects/canvasdraw/files/5.2/">Version 5.2</a> (26/Jun/2009)</h3>
<ul>
diff --git a/src/win32/cdwin.c b/src/win32/cdwin.c
index 371bb6d..57c07b9 100644
--- a/src/win32/cdwin.c
+++ b/src/win32/cdwin.c
@@ -997,8 +997,6 @@ static void sTextOutBlt(cdCtxCanvas* ctxcanvas, int px, int py, const char* s, i
/* calcula o alinhamento da imagem no canvas */
if (ctxcanvas->canvas->text_orientation != 0)
{
- double d = sqrt(wt*wt + ht*ht);
-
switch (ctxcanvas->canvas->text_alignment)
{
case CD_CENTER:
@@ -1034,20 +1032,20 @@ static void sTextOutBlt(cdCtxCanvas* ctxcanvas, int px, int py, const char* s, i
px_off = (int)(wt/2 * cos_teta);
break;
case CD_NORTH_EAST:
- py_off = (int)(h/2);
- px_off = - (int)(sqrt(d*d - h*h)/2);
- break;
- case CD_NORTH_WEST:
- py_off = (int)(sqrt(d*d - w*w)/2);
- px_off = - (int)(w/2);
+ py_off = (int)(ht/2 * cos_teta + wt/2 * sin_teta);
+ px_off = (int)(ht/2 * sin_teta - wt/2 * cos_teta);
break;
case CD_SOUTH_WEST:
- py_off = - (int)(h/2);
- px_off = (int)(sqrt(d*d - h*h)/2);
+ py_off = - (int)(ht/2 * cos_teta + wt/2 * sin_teta);
+ px_off = - (int)(ht/2 * sin_teta - wt/2 * cos_teta);
+ break;
+ case CD_NORTH_WEST:
+ py_off = (int)(ht/2 * cos_teta - wt/2 * sin_teta);
+ px_off = (int)(ht/2 * sin_teta + wt/2 * cos_teta);
break;
case CD_SOUTH_EAST:
- py_off = - (int)(sqrt(d*d - w*w)/2);
- px_off = (int)(w/2);
+ py_off = - (int)(ht/2 * cos_teta - wt/2 * sin_teta);
+ px_off = - (int)(ht/2 * sin_teta + wt/2 * cos_teta);
break;
}
}
@@ -1095,7 +1093,7 @@ static void sTextOutBlt(cdCtxCanvas* ctxcanvas, int px, int py, const char* s, i
case CD_CENTER:
case CD_EAST:
case CD_WEST:
- py_off = py;
+ py_off = 0;
break;
}
}