Author: spouliot
Date: 2007-05-25 14:25:15 -0400 (Fri, 25 May 2007)
New Revision: 77961
Modified:
trunk/libgdiplus/src/ChangeLog
trunk/libgdiplus/src/general-private.h
trunk/libgdiplus/src/text-cairo.c
Log:
2007-05-25 Sebastien Pouliot <[EMAIL PROTECTED]>
* general-private.h: Don't optimize convertions when printing.
* text-cairo.c: Ensuew we converting coordinates when printing. Fix
bug #81708
Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog 2007-05-25 18:06:13 UTC (rev 77960)
+++ trunk/libgdiplus/src/ChangeLog 2007-05-25 18:25:15 UTC (rev 77961)
@@ -1,3 +1,9 @@
+2007-05-25 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * general-private.h: Don't optimize convertions when printing.
+ * text-cairo.c: Ensuew we converting coordinates when printing. Fix
+ bug #81708
+
2007-05-24 Sebastien Pouliot <[EMAIL PROTECTED]>
* graphics-cairo.c: Don't use antialiasing on clipping paths. Fix bug
Modified: trunk/libgdiplus/src/general-private.h
===================================================================
--- trunk/libgdiplus/src/general-private.h 2007-05-25 18:06:13 UTC (rev
77960)
+++ trunk/libgdiplus/src/general-private.h 2007-05-25 18:25:15 UTC (rev
77961)
@@ -63,8 +63,7 @@
#define SAFE_FLOAT_TO_UINT32(value) ((value < 0) ? 0 : (value >=
G_MAXINT32) ? G_MAXINT32 : value)
/* avoid fp division and multiplication that would return the same number */
-#define OPTIMIZE_CONVERSION(g) (((g->page_unit == UnitDisplay) &&
(g->type != gtPostScript)) || \
- (g->page_unit == UnitPixel) ||
(g->page_unit == UnitWorld))
+#define OPTIMIZE_CONVERSION(g) ((g->type != gtPostScript) &&
((g->page_unit == UnitPixel) || (g->page_unit == UnitWorld)))
/* macros for common conversions, i.e. to or from UnitCairoPoint */
#define gdip_unitx_convgr(g,f) (gdip_unit_conversion (g->page_unit,
UnitCairoPoint, g->dpi_x, g->type, f))
Modified: trunk/libgdiplus/src/text-cairo.c
===================================================================
--- trunk/libgdiplus/src/text-cairo.c 2007-05-25 18:06:13 UTC (rev 77960)
+++ trunk/libgdiplus/src/text-cairo.c 2007-05-25 18:25:15 UTC (rev 77961)
@@ -210,10 +210,11 @@
*/
cairo_set_font_face (graphics->ct, (cairo_font_face_t*)
font->cairofnt); /* Set our font; this will also be used for later
drawing */
-/* this will always return the same value
- gdip_unit_conversion (UnitPixel, UnitCairoPoint, gdip_get_display_dpi
(), graphics->type, font->sizeInPixels, &FontSize);
-*/
- FontSize = font->sizeInPixels;
+ /* this will always return the same value, except when printing */
+ if (graphics->type == gtPostScript)
+ FontSize = gdip_unit_conversion (UnitPixel, UnitCairoPoint,
gdip_get_display_dpi (), graphics->type, font->sizeInPixels);
+ else
+ FontSize = font->sizeInPixels;
cairo_set_font_size (graphics->ct, FontSize);
cairo_font_extents (graphics->ct, &FontExtent); /* Get the size
we're looking for */
@@ -753,7 +754,7 @@
static GpStatus
DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length,
GDIPCONST GpFont *font,
- GDIPCONST RectF *rc, GDIPCONST GpStringFormat *fmt, GpBrush *brush,
+ GDIPCONST RectF *rc_org, GDIPCONST GpStringFormat *fmt, GpBrush *brush,
WCHAR *CleanString, GpStringDetailStruct* StringDetails, GpDrawTextData
*data)
{
float CursorX = 0.0; /* Current X position of drawing cursor
*/
@@ -766,9 +767,22 @@
int LineHeight = data->line_height;
int MaxY = data->max_y;
cairo_font_extents_t FontExtent;
+ RectF rect, *rc = ▭
cairo_font_extents (graphics->ct, &FontExtent);
+ if (OPTIMIZE_CONVERSION (graphics)) {
+ rc->X = rc_org->X;
+ rc->Y = rc_org->Y;
+ rc->Width = rc_org->Width;
+ rc->Height = rc_org->Height;
+ } else {
+ rc->X = gdip_unitx_convgr (graphics, rc_org->X);
+ rc->Y = gdip_unity_convgr (graphics, rc_org->Y);
+ rc->Width = gdip_unitx_convgr (graphics, rc_org->Width);
+ rc->Height = gdip_unity_convgr (graphics, rc_org->Height);
+ }
+
/* Set our clipping rectangle */
if ((rc->Width!=0) && (rc->Height!=0) && ((fmt->formatFlags &
StringFormatFlagsNoClip)==0)) {
#ifdef DRAWSTRING_DEBUG
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches