Skip to content

Commit

Permalink
Merge branch branch-6-4 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Boudreault committed Sep 25, 2013
2 parents 5a7b14c + edae73d commit a51a359
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
17 changes: 16 additions & 1 deletion cmake/FindPostgreSQL.cmake
Expand Up @@ -5,10 +5,24 @@
# POSTGRESQL_LIBRARY, the libraries needed to use POSTGRESQL.
# POSTGRESQL_FOUND, If false, do not try to use PostgreSQL.
#
# Copyright (c) 2013 Thomas Bonfort
# Copyright (c) 2013 Thomas Bonfort, Andy Colson
#

find_program(PG_CONFIG NAMES pg_config
PATHS
$ENV{ProgramFiles}/PostgreSQL/*/bin
$ENV{SystemDrive}/PostgreSQL/*/bin
)

if (PG_CONFIG)
exec_program( ${PG_CONFIG} ARGS "--includedir" OUTPUT_VARIABLE PG_INC_PATH )
exec_program( ${PG_CONFIG} ARGS "--libdir" OUTPUT_VARIABLE PG_LIB_PATH )
else()
message(WARNING "pg_config not found, will try some defaults")
endif()

find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h
${PG_INC_PATH}
/usr/include/server
/usr/include/postgresql
/usr/include/pgsql/server
Expand All @@ -23,6 +37,7 @@ find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h

find_library(POSTGRESQL_LIBRARY NAMES pq libpq
PATHS
${PG_LIB_PATH}
/usr/lib
/usr/local/lib
/usr/lib/postgresql
Expand Down
42 changes: 25 additions & 17 deletions maplabel.c
Expand Up @@ -420,11 +420,14 @@ int msAddLabelGroup(mapObj *map, imageObj *image, int layerindex, int classindex
}
x = MS_NINT(point->x);
y = MS_NINT(point->y);
assert(rb.type == MS_BUFFER_BYTE_RGBA);
alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
if(!*alphapixptr) {
/* label point does not intersect mask */
return MS_SUCCESS;
/* Using label repeatdistance, we might have a point with x/y below 0. See #4764 */
if (x >= 0 && x < rb.width && y >= 0 && y < rb.height) {
assert(rb.type == MS_BUFFER_BYTE_RGBA);
alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
if(!*alphapixptr) {
/* label point does not intersect mask */
return MS_SUCCESS;
}
}
} else {
msSetError(MS_MISCERR, "Layer (%s) references references a mask layer, but the selected renderer does not support them", "msAddLabelGroup()", layerPtr->name);
Expand Down Expand Up @@ -595,25 +598,30 @@ int msAddLabel(mapObj *map, imageObj *image, labelObj *label, int layerindex, in
if (point) {
int x = MS_NINT(point->x);
int y = MS_NINT(point->y);
alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
if(!*alphapixptr) {
/* label point does not intersect mask */
if(ts) {
freeTextSymbol(ts);
free(ts);
/* Using label repeatdistance, we might have a point with x/y below 0. See #4764 */
if (x >= 0 && x < rb.width && y >= 0 && y < rb.height) {
alphapixptr = rb.data.rgba.a+rb.data.rgba.row_step*y + rb.data.rgba.pixel_step*x;
if(!*alphapixptr) {
/* label point does not intersect mask */
if(ts) {
freeTextSymbol(ts);
free(ts);
}
return MS_SUCCESS;
}
return MS_SUCCESS;
}
} else if (ts && ts->textpath) {
int i = 0;
for (i = 0; i < ts->textpath->numglyphs; i++) {
int x = MS_NINT(ts->textpath->glyphs[i].pnt.x);
int y = MS_NINT(ts->textpath->glyphs[i].pnt.y);
alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x;
if (!*alphapixptr) {
freeTextSymbol(ts);
free(ts);
return MS_SUCCESS;
if (x >= 0 && x < rb.width && y >= 0 && y < rb.height) {
alphapixptr = rb.data.rgba.a + rb.data.rgba.row_step * y + rb.data.rgba.pixel_step*x;
if (!*alphapixptr) {
freeTextSymbol(ts);
free(ts);
return MS_SUCCESS;
}
}
}
}
Expand Down

0 comments on commit a51a359

Please sign in to comment.