[mapserver-commits] r10914 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Jan 26 05:47:08 EST 2011
Author: tbonfort
Date: 2011-01-26 02:47:08 -0800 (Wed, 26 Jan 2011)
New Revision: 10914
Modified:
trunk/mapserver/mapagg.cpp
trunk/mapserver/mapgd.c
trunk/mapserver/maprendering.c
Log:
put text on closest integer pixel, unless a rotation is applied (avoids blurred text)
Modified: trunk/mapserver/mapagg.cpp
===================================================================
--- trunk/mapserver/mapagg.cpp 2011-01-26 10:36:33 UTC (rev 10913)
+++ trunk/mapserver/mapagg.cpp 2011-01-26 10:47:08 UTC (rev 10914)
@@ -245,19 +245,19 @@
mtx *= mapserver::trans_affine_rotation(-style->rotation);
mtx *= mapserver::trans_affine_translation(x, y);
- double fx = MS_NINT(x), fy = MS_NINT(y);
+ double fx = x, fy = y;
const char *utfptr = text;
mapserver::path_storage glyphs;
//first render all the glyphs to a path
while (*utfptr) {
if (*utfptr == '\r') {
- fx = MS_NINT(x);
+ fx = x;
utfptr++;
continue;
}
if (*utfptr == '\n') {
- fx = MS_NINT(x);
+ fx = x;
fy += ceil(style->size * AGG_LINESPACE);
utfptr++;
continue;
Modified: trunk/mapserver/mapgd.c
===================================================================
--- trunk/mapserver/mapgd.c 2011-01-26 10:36:33 UTC (rev 10913)
+++ trunk/mapserver/mapgd.c 2011-01-26 10:47:08 UTC (rev 10914)
@@ -372,6 +372,8 @@
gdImagePtr ip;
char *error=NULL;
int bbox[8];
+ x = MS_NINT(x);
+ y = MS_NINT(y);
if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return MS_FAILURE;
if(!text || !strlen(text)) return(MS_SUCCESS); /* not errors, just don't want to do anything */
Modified: trunk/mapserver/maprendering.c
===================================================================
--- trunk/mapserver/maprendering.c 2011-01-26 10:36:33 UTC (rev 10913)
+++ trunk/mapserver/maprendering.c 2011-01-26 10:47:08 UTC (rev 10914)
@@ -706,8 +706,13 @@
if(computeLabelStyle(&s,label,fontset,scalefactor) == MS_FAILURE) {
return MS_FAILURE;
}
- x = labelPnt.x;
- y = labelPnt.y;
+ if(s.rotation == 0) {
+ x = MS_NINT(labelPnt.x);
+ y = MS_NINT(labelPnt.y);
+ } else {
+ x = labelPnt.x;
+ y = labelPnt.y;
+ }
if (label->type == MS_TRUETYPE) {
if(MS_VALID_COLOR(label->shadowcolor)) {
s.color = &label->shadowcolor;
More information about the mapserver-commits
mailing list