Author: spouliot
Date: 2006-09-13 09:15:44 -0400 (Wed, 13 Sep 2006)
New Revision: 65349
Modified:
trunk/libgdiplus/src/ChangeLog
trunk/libgdiplus/src/general.h
trunk/libgdiplus/src/graphics-path.c
trunk/libgdiplus/src/graphics.c
trunk/libgdiplus/src/matrix.h
Log:
2006-09-13 Sebastien Pouliot <[EMAIL PROTECTED]>
* general.h: Add/Move macros gdip_near_zero and gdip_near_one
(from matrix.h) to avoid comparison between floating points value.
* graphics.c: (make_arcs) Make sure the additional angle isn't near
zero as this will results in NaN values and break rendering (#78999)
* graphics-path.c: (append_arcs) Make sure the additional angle isn't
near zero as this will results in NaN values and break rendering
* matrix.h: Remove macros and include general.h
Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog 2006-09-13 13:09:05 UTC (rev 65348)
+++ trunk/libgdiplus/src/ChangeLog 2006-09-13 13:15:44 UTC (rev 65349)
@@ -1,3 +1,13 @@
+2006-09-13 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * general.h: Add/Move macros gdip_near_zero and gdip_near_one
+ (from matrix.h) to avoid comparison between floating points value.
+ * graphics.c: (make_arcs) Make sure the additional angle isn't near
+ zero as this will results in NaN values and break rendering (#78999)
+ * graphics-path.c: (append_arcs) Make sure the additional angle isn't
+ near zero as this will results in NaN values and break rendering
+ * matrix.h: Remove macros and include general.h
+
2006-09-12 Sebastien Pouliot <[EMAIL PROTECTED]>
* general.c: Don't apply the anti-aliasing offsets if we asked Cairo
Modified: trunk/libgdiplus/src/general.h
===================================================================
--- trunk/libgdiplus/src/general.h 2006-09-13 13:09:05 UTC (rev 65348)
+++ trunk/libgdiplus/src/general.h 2006-09-13 13:15:44 UTC (rev 65349)
@@ -25,6 +25,9 @@
#include "gdip.h"
+/* avoid direct floating point comparison */
+#define gdip_near_zero(value) ((value >= -0.0001f) && (value <= 0.0001f))
+#define gdip_near_one(value) ((value >= 0.9999f) && (value <= 1.0001f))
/* avoid fp division and multiplication that would return the same number */
#define OPTIMIZE_CONVERSION(g) (((g->page_unit == UnitDisplay) && (g->type !=
gtPostScript)) || \
Modified: trunk/libgdiplus/src/graphics-path.c
===================================================================
--- trunk/libgdiplus/src/graphics-path.c 2006-09-13 13:09:05 UTC (rev
65348)
+++ trunk/libgdiplus/src/graphics-path.c 2006-09-13 13:15:44 UTC (rev
65349)
@@ -691,8 +691,7 @@
int i;
float drawn = 0;
float endAngle = startAngle + sweepAngle;
- int sign = (endAngle > 0) ? 1 : -1;
- int increment = sign * 90;
+ int increment = (endAngle > 0) ? 90 : -90;
bool enough = FALSE;
if (fabs (sweepAngle) >= 360) {
@@ -716,6 +715,10 @@
enough = TRUE;
}
+ /* a near zero value will introduce bad artefact in the drawing
(#78999) */
+ if (gdip_near_zero (additional))
+ return;
+
append_arc (path,
(i == 0) ? TRUE : FALSE, /* only move to the
starting pt in the 1st iteration */
x, y, width, height, /* bounding rectangle */
Modified: trunk/libgdiplus/src/graphics.c
===================================================================
--- trunk/libgdiplus/src/graphics.c 2006-09-13 13:09:05 UTC (rev 65348)
+++ trunk/libgdiplus/src/graphics.c 2006-09-13 13:15:44 UTC (rev 65349)
@@ -334,8 +334,7 @@
int i;
float drawn = 0;
float endAngle = startAngle + sweepAngle;
- int sign = (endAngle > 0) ? 1 : -1;
- int increment = sign * 90;
+ int increment = (endAngle > 0) ? 90 : -90;
bool enough = FALSE;
/* if required deal, once and for all, with unit conversions */
@@ -367,7 +366,11 @@
additional = endAngle - current; /* otherwise, add the
remainder */
enough = TRUE;
}
-
+
+ /* a near zero value will introduce bad artefact in the drawing
(#78999) */
+ if (gdip_near_zero (additional))
+ return;
+
make_arc (graphics,
(i == 0) ? TRUE : FALSE, /* only move to the
starting pt in the 1st iteration */
x, y, width, height, /* bounding rectangle */
Modified: trunk/libgdiplus/src/matrix.h
===================================================================
--- trunk/libgdiplus/src/matrix.h 2006-09-13 13:09:05 UTC (rev 65348)
+++ trunk/libgdiplus/src/matrix.h 2006-09-13 13:15:44 UTC (rev 65349)
@@ -23,7 +23,7 @@
#ifndef _MATRIX_H_
#define _MATRIX_H_
-#include "gdip.h"
+#include "general.h"
/* internal (private) API for matrix */
@@ -32,9 +32,6 @@
#define gdip_matrix_reverse_order(order) ((order == MatrixOrderPrepend)
? MatrixOrderAppend : MatrixOrderPrepend)
-#define gdip_near_zero(value) ((value >= -0.0001f) && (value <= 0.0001f))
-#define gdip_near_one(value) ((value >= 0.9999f) && (value <= 1.0001f))
-
BOOL gdip_is_matrix_a_translation (GpMatrix *matrix);
BOOL gdip_is_matrix_empty (GpMatrix* matrix);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches