Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

2008-04-21 Sebastien Pouliot <sebastien@ximian.com>

	* general-private.h: Don't clamp values for Cairo >= 1.6 since 
	the fixed point values are now kept in the 24/8 format.
	* graphics-private.h: Change the CAIRO_AA_OFFSET_X from 1.0 to 
	0.5 for Cairo >= 1.6.
	* graphics-cairo.c: Revert earlier AA tweaks (r100945) as it 
	broke rectangles and the change to CAIRO_AA_OFFSET_X does the 
	required fixes.
	[Fix bug #381737]
	* graphics-path.c: IsVisible X offset still needs to be 1.0 
	(whatever version of Cairo being used).


svn path=/trunk/libgdiplus/; revision=101373
  • Loading branch information...
commit b4bd4d272c6b6e374d8aa1d3e485f5af1b3b3dc8 1 parent 5fb0ed8
Sebastien Pouliot authored
View
13 src/ChangeLog
@@ -1,3 +1,16 @@
+2008-04-21 Sebastien Pouliot <sebastien@ximian.com>
+
+ * general-private.h: Don't clamp values for Cairo >= 1.6 since
+ the fixed point values are now kept in the 24/8 format.
+ * graphics-private.h: Change the CAIRO_AA_OFFSET_X from 1.0 to
+ 0.5 for Cairo >= 1.6.
+ * graphics-cairo.c: Revert earlier AA tweaks (r100945) as it
+ broke rectangles and the change to CAIRO_AA_OFFSET_X does the
+ required fixes.
+ [Fix bug #381737]
+ * graphics-path.c: IsVisible X offset still needs to be 1.0
+ (whatever version of Cairo being used).
+
2008-04-18 Jeffrey Stedfast <fejj@novell.com>
* text-cairo.c (MeasureString): #include <ctype.h> for isspace()
View
21 src/general-private.h
@@ -77,14 +77,19 @@
/* avoid floating point division/multiplications when pre-multiplying the alpha channel with R, G and B values */
extern const BYTE pre_multiplied_table[256][256];
-/* cairo has a (signed) 15(1)/16(2)bits pixel positioning, while GDI+ use (signed) 23 bits (infinity).
- * Using larger values confuse the bits used for subpixel positioning.
- * (1) http://lists.freedesktop.org/archives/cairo/2006-June/007251.html
- * (2) testing shows artefacts if using more than 15 bits
- */
-#define CAIRO_LOW_LIMIT -16384
-#define CAIRO_HIGH_LIMIT 16383
-#define CAIRO_LIMIT(v) ((v < CAIRO_LOW_LIMIT) ? CAIRO_LOW_LIMIT : (v > CAIRO_HIGH_LIMIT) ? CAIRO_HIGH_LIMIT : v)
+#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1,6,0)
+ /* older cairo has a (signed) 15(1)/16(2)bits pixel positioning, while GDI+ use (signed) 23 bits (infinity).
+ * Using larger values confuse the bits used for subpixel positioning.
+ * (1) http://lists.freedesktop.org/archives/cairo/2006-June/007251.html
+ * (2) testing shows artefacts if using more than 15 bits
+ */
+ #define CAIRO_LOW_LIMIT -16384
+ #define CAIRO_HIGH_LIMIT 16383
+ #define CAIRO_LIMIT(v) ((v < CAIRO_LOW_LIMIT) ? CAIRO_LOW_LIMIT : (v > CAIRO_HIGH_LIMIT) ? CAIRO_HIGH_LIMIT : v)
+#else
+ /* since cairo 1.6 values are split 24/8 */
+ #define CAIRO_LIMIT(v) v
+#endif
/* other shared functions */
int iround (float d) GDIP_INTERNAL;
View
17 src/graphics-cairo.c
@@ -486,10 +486,10 @@ cairo_DrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, i
int i;
/* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */
- gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, FALSE);
+ gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, TRUE);
for (i = 1; i < count; i++) {
- gdip_cairo_line_to (graphics, points [i].X, points [i].Y, TRUE, FALSE);
+ gdip_cairo_line_to (graphics, points [i].X, points [i].Y, TRUE, TRUE);
}
return stroke_graphics_with_pen (graphics, pen);
@@ -501,10 +501,10 @@ cairo_DrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, i
int i;
/* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */
- gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, FALSE);
+ gdip_cairo_move_to (graphics, points [0].X, points [0].Y, TRUE, TRUE);
for (i = 1; i < count; i++) {
- gdip_cairo_line_to (graphics, points [i].X, points [i].Y, TRUE, FALSE);
+ gdip_cairo_line_to (graphics, points [i].X, points [i].Y, TRUE, TRUE);
}
return stroke_graphics_with_pen (graphics, pen);
@@ -563,7 +563,7 @@ GpStatus
cairo_DrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path)
{
/* We use graphics->copy_of_ctm matrix for path creation. We should have it set already. */
- GpStatus status = gdip_plot_path (graphics, path, FALSE);
+ GpStatus status = gdip_plot_path (graphics, path, TRUE);
if (status != Ok)
return status;
@@ -741,7 +741,12 @@ cairo_FillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *poi
GpStatus
cairo_DrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height)
{
- gdip_cairo_rectangle (graphics, x, y, width, height, FALSE);
+ /* wide pen position can be different between cairo and gdi+ */
+ if (gdip_cairo_pen_width_needs_adjustment (pen)) {
+ x -= 1.0f;
+ y -= 1.0f;
+ }
+ gdip_cairo_rectangle (graphics, x, y, width, height, TRUE);
return stroke_graphics_with_pen (graphics, pen);
}
View
2  src/graphics-path.c
@@ -1925,7 +1925,7 @@ GdipIsVisiblePathPoint (GpPath *path, float x, float y, GpGraphics *graphics, BO
if (status == Ok) {
cairo_set_fill_rule (g->ct, gdip_convert_fill_mode (path->fill_mode));
cairo_set_antialias (g->ct, CAIRO_ANTIALIAS_NONE);
- *result = cairo_in_fill (g->ct, x + CAIRO_AA_OFFSET_X, y + CAIRO_AA_OFFSET_Y);
+ *result = cairo_in_fill (g->ct, x + 1.0 /* CAIRO_AA_OFFSET_X */, y + CAIRO_AA_OFFSET_Y);
} else {
*result = FALSE;
}
View
9 src/graphics-private.h
@@ -42,8 +42,13 @@
#include "region-private.h"
#include "metafile.h"
-#define CAIRO_AA_OFFSET_X 1
-#define CAIRO_AA_OFFSET_Y 0.5
+#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1,6,0)
+ #define CAIRO_AA_OFFSET_X 1
+ #define CAIRO_AA_OFFSET_Y 0.5
+#else
+ #define CAIRO_AA_OFFSET_X 0.5
+ #define CAIRO_AA_OFFSET_Y 0.5
+#endif
#define CURVE_MIN_TERMS 1
#define CURVE_MAX_TERMS 7
Please sign in to comment.
Something went wrong with that request. Please try again.