Author: spouliot
Date: 2006-08-10 11:08:41 -0400 (Thu, 10 Aug 2006)
New Revision: 63594
Modified:
trunk/libgdiplus/src/ChangeLog
trunk/libgdiplus/src/general.c
trunk/libgdiplus/src/general.h
trunk/libgdiplus/src/graphics-path.c
trunk/libgdiplus/src/graphics.c
trunk/libgdiplus/src/image.c
trunk/libgdiplus/src/matrix.c
trunk/libgdiplus/src/region-bitmap.c
trunk/libgdiplus/src/region.c
Log:
* graphics.c: s/CONVERTION/CONVERSION/ (alp)
* general.c: s/CONVERTION/CONVERSION/ (alp)
* image.c: s/CONVERTION/CONVERSION/ (alp)
* general.h: s/CONVERTION/CONVERSION/ (alp)
* region.c: s/CONVERTION/CONVERSION/ (alp)
* region-bitmap.c: s/CONVERTION/CONVERSION/ (alp)
* matrix.c: Changed some null checks not to print warnings during unit
tests.
* graphics-path.c: Fix GdipWidenPath to return the same value as GDI+.
Changed some null checks not to print warnings during unit tests.
2006-08-10 Sebastien Pouliot <[EMAIL PROTECTED]>
Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog 2006-08-10 15:06:05 UTC (rev 63593)
+++ trunk/libgdiplus/src/ChangeLog 2006-08-10 15:08:41 UTC (rev 63594)
@@ -1,5 +1,18 @@
2006-08-10 Sebastien Pouliot <[EMAIL PROTECTED]>
+ * graphics.c: s/CONVERTION/CONVERSION/ (alp)
+ * general.c: s/CONVERTION/CONVERSION/ (alp)
+ * image.c: s/CONVERTION/CONVERSION/ (alp)
+ * general.h: s/CONVERTION/CONVERSION/ (alp)
+ * region.c: s/CONVERTION/CONVERSION/ (alp)
+ * region-bitmap.c: s/CONVERTION/CONVERSION/ (alp)
+ * matrix.c: Changed some null checks not to print warnings during unit
+ tests.
+ * graphics-path.c: Fix GdipWidenPath to return the same value as GDI+.
+ Changed some null checks not to print warnings during unit tests.
+
+2006-08-10 Sebastien Pouliot <[EMAIL PROTECTED]>
+
* font.c: Deal with gdip_unit_conversion being a function.
* general.c: Add OPTIMIZE_CONVERTION to help avoid a floating point
division and multiplication when converting units (in the case where
Modified: trunk/libgdiplus/src/general.c
===================================================================
--- trunk/libgdiplus/src/general.c 2006-08-10 15:06:05 UTC (rev 63593)
+++ trunk/libgdiplus/src/general.c 2006-08-10 15:08:41 UTC (rev 63594)
@@ -592,8 +592,8 @@
{
double x2, y2;
- /* avoid unit convertion whenever possible */
- if (!OPTIMIZE_CONVERTION (graphics)) {
+ /* avoid unit conversion whenever possible */
+ if (!OPTIMIZE_CONVERSION (graphics)) {
x = gdip_unitx_convgr (graphics, x);
y = gdip_unity_convgr (graphics, y);
width = gdip_unitx_convgr (graphics, width);
@@ -623,8 +623,8 @@
void
gdip_cairo_move_to (GpGraphics *graphics, double x, double y, BOOL
convert_units, BOOL antialiasing)
{
- /* avoid unit convertion whenever possible */
- if (convert_units && !OPTIMIZE_CONVERTION (graphics)) {
+ /* avoid unit conversion whenever possible */
+ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) {
x = gdip_unitx_convgr (graphics, x);
y = gdip_unity_convgr (graphics, y);
}
@@ -645,8 +645,8 @@
void
gdip_cairo_line_to (GpGraphics *graphics, double x, double y, BOOL
convert_units, BOOL antialiasing)
{
- /* avoid unit convertion whenever possible */
- if (convert_units && !OPTIMIZE_CONVERTION (graphics)) {
+ /* avoid unit conversion whenever possible */
+ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) {
x = gdip_unitx_convgr (graphics, x);
y = gdip_unity_convgr (graphics, y);
}
@@ -668,8 +668,8 @@
gdip_cairo_curve_to (GpGraphics *graphics, double x1, double y1, double x2,
double y2, double x3, double y3,
BOOL convert_units, BOOL antialiasing)
{
- /* avoid unit convertion whenever possible */
- if (convert_units && !OPTIMIZE_CONVERTION (graphics)) {
+ /* avoid unit conversion whenever possible */
+ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) {
x1 = gdip_unitx_convgr (graphics, x1);
y1 = gdip_unity_convgr (graphics, y1);
x2 = gdip_unitx_convgr (graphics, x2);
Modified: trunk/libgdiplus/src/general.h
===================================================================
--- trunk/libgdiplus/src/general.h 2006-08-10 15:06:05 UTC (rev 63593)
+++ trunk/libgdiplus/src/general.h 2006-08-10 15:08:41 UTC (rev 63594)
@@ -27,10 +27,10 @@
/* avoid fp division and multiplication that would return the same number */
-#define OPTIMIZE_CONVERTION(g) (((g->page_unit == UnitDisplay) && (g->type !=
gtPostScript)) || \
+#define OPTIMIZE_CONVERSION(g) (((g->page_unit == UnitDisplay) && (g->type !=
gtPostScript)) || \
(g->page_unit == UnitPixel) || (g->page_unit == UnitWorld))
-/* macros for common convertions, i.e. to or from UnitCairoPoint */
+/* 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))
#define gdip_unity_convgr(g,f) (gdip_unit_conversion (g->page_unit,
UnitCairoPoint, g->dpi_y, g->type, f))
#define gdip_convgr_unitx(g,f) (gdip_unit_conversion (UnitCairoPoint,
g->page_unit, g->dpi_x, g->type, f))
@@ -47,7 +47,7 @@
#define CAIRO_HIGH_LIMIT 16383
#define CAIRO_LIMIT(v) ((v < CAIRO_LOW_LIMIT) ? CAIRO_LOW_LIMIT : (v >
CAIRO_HIGH_LIMIT) ? CAIRO_HIGH_LIMIT : v)
-/* prototypes for cairo wrappers to deal with coordonates limits, unit
convertion and antialiasing) */
+/* prototypes for cairo wrappers to deal with coordonates limits, unit
conversion and antialiasing) */
void gdip_cairo_rectangle (GpGraphics *graphics, double x, double y, double
width, double height, BOOL antialiasing);
void gdip_cairo_move_to (GpGraphics *graphics, double x, double y, BOOL
convert_units, BOOL antialiasing);
void gdip_cairo_line_to (GpGraphics *graphics, double x, double y, BOOL
convert_units, BOOL antialiasing);
Modified: trunk/libgdiplus/src/graphics-path.c
===================================================================
--- trunk/libgdiplus/src/graphics-path.c 2006-08-10 15:06:05 UTC (rev
63593)
+++ trunk/libgdiplus/src/graphics-path.c 2006-08-10 15:08:41 UTC (rev
63594)
@@ -350,8 +350,8 @@
GpStatus
GdipGetPointCount (GDIPCONST GpPath *path, int *count)
{
- g_return_val_if_fail (path != NULL, InvalidParameter);
- g_return_val_if_fail (count != NULL, InvalidParameter);
+ if (!path || !count)
+ return InvalidParameter;
*count = path->count;
return Ok;
@@ -361,9 +361,8 @@
GdipGetPathTypes (GpPath *path, byte *types, int count)
{
int i;
- g_return_val_if_fail (path != NULL, InvalidParameter);
- g_return_val_if_fail (types != NULL, InvalidParameter);
- if (count < 1)
+
+ if (!path || !types || (count < 1))
return InvalidParameter;
for (i = 0; i < count; i++)
@@ -376,9 +375,8 @@
GdipGetPathPoints (GDIPCONST GpPath *path, GpPointF *points, int count)
{
int i;
- g_return_val_if_fail (path != NULL, InvalidParameter);
- g_return_val_if_fail (points != NULL, InvalidParameter);
- if (count < 1)
+
+ if (!path ||!points || (count < 1))
return InvalidParameter;
for (i = 0; i < count; i++) {
@@ -1581,11 +1579,9 @@
if (!nativePath || !pen)
return InvalidParameter;
- /* quick out */
- if (nativePath->count == 0)
- return Ok;
- /* for compatibility with MS GDI+ (reported as FDBK49685) */
- if (nativePath->count == 1)
+ /* (0) is deal within System.Drawing */
+ /* (1) for compatibility with MS GDI+ (reported as FDBK49685) */
+ if (nativePath->count <= 1)
return OutOfMemory;
status = gdip_prepare_path (nativePath, matrix, flatness);
Modified: trunk/libgdiplus/src/graphics.c
===================================================================
--- trunk/libgdiplus/src/graphics.c 2006-08-10 15:06:05 UTC (rev 63593)
+++ trunk/libgdiplus/src/graphics.c 2006-08-10 15:08:41 UTC (rev 63594)
@@ -178,8 +178,8 @@
{
double rx, ry, cx, cy;
- /* if required deal, once and for all, with unit convertion */
- if (convert_units && !OPTIMIZE_CONVERTION (graphics)) {
+ /* if required deal, once and for all, with unit conversion */
+ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) {
x = gdip_unitx_convgr (graphics, x);
y = gdip_unity_convgr (graphics, y);
width = gdip_unitx_convgr (graphics, width);
@@ -338,8 +338,8 @@
int increment = sign * 90;
bool enough = FALSE;
- /* if required deal, once and for all, with unit convertions */
- if (convert_units && !OPTIMIZE_CONVERTION (graphics)) {
+ /* if required deal, once and for all, with unit conversions */
+ if (convert_units && !OPTIMIZE_CONVERSION (graphics)) {
x = gdip_unitx_convgr (graphics, x);
y = gdip_unity_convgr (graphics, y);
width = gdip_unitx_convgr (graphics, width);
@@ -383,8 +383,8 @@
float rx, ry, cx, cy, alpha;
double sin_alpha, cos_alpha;
- /* if required deal, once and for all, with unit convertions */
- if (!OPTIMIZE_CONVERTION (graphics)) {
+ /* if required deal, once and for all, with unit conversions */
+ if (!OPTIMIZE_CONVERSION (graphics)) {
x = gdip_unitx_convgr (graphics, x);
y = gdip_unity_convgr (graphics, y);
width = gdip_unitx_convgr (graphics, width);
Modified: trunk/libgdiplus/src/image.c
===================================================================
--- trunk/libgdiplus/src/image.c 2006-08-10 15:06:05 UTC (rev 63593)
+++ trunk/libgdiplus/src/image.c 2006-08-10 15:08:41 UTC (rev 63594)
@@ -192,7 +192,7 @@
return InvalidParameter;
}
- if (!OPTIMIZE_CONVERTION (graphics)) {
+ if (!OPTIMIZE_CONVERSION (graphics)) {
x = gdip_unitx_convgr (graphics, x);
y = gdip_unity_convgr (graphics, y);
width = gdip_unitx_convgr (graphics, width);
@@ -376,7 +376,7 @@
return status;
}
- // see OPTIMIZE_CONVERTION in general.h
+ // see OPTIMIZE_CONVERSION in general.h
if ((srcUnit != UnitPixel) && (srcUnit != UnitWorld) && ((srcUnit !=
UnitDisplay) || (graphics->type != gtPostScript))) {
dstx = gdip_unit_conversion (srcUnit, UnitCairoPoint,
graphics->type, graphics->dpi_x, dstx);
dsty = gdip_unit_conversion (srcUnit, UnitCairoPoint,
graphics->type, graphics->dpi_y, dsty);
Modified: trunk/libgdiplus/src/matrix.c
===================================================================
--- trunk/libgdiplus/src/matrix.c 2006-08-10 15:06:05 UTC (rev 63593)
+++ trunk/libgdiplus/src/matrix.c 2006-08-10 15:08:41 UTC (rev 63594)
@@ -208,7 +208,9 @@
GpStatus
GdipDeleteMatrix (GpMatrix *matrix)
{
- g_return_val_if_fail (matrix != NULL, InvalidParameter);
+ if (!matrix)
+ return InvalidParameter;
+
GdipFree (matrix);
return Ok;
}
Modified: trunk/libgdiplus/src/region-bitmap.c
===================================================================
--- trunk/libgdiplus/src/region-bitmap.c 2006-08-10 15:06:05 UTC (rev
63593)
+++ trunk/libgdiplus/src/region-bitmap.c 2006-08-10 15:08:41 UTC (rev
63594)
@@ -526,7 +526,7 @@
/* here the memory is allocated for a ARGB bitmap - so 32 times bigger
than our normal alpha bitmap */
if ((size < 1) || (size > REGION_MAX_BITMAP_SIZE << 5)) {
- g_warning ("Path convertion requested %d bytes (%d x %d).
Maximum size is %d bytes.",
+ g_warning ("Path conversion requested %d bytes (%d x %d).
Maximum size is %d bytes.",
size, bounds.Width, bounds.Height,
REGION_MAX_BITMAP_SIZE << 5);
return NULL;
}
Modified: trunk/libgdiplus/src/region.c
===================================================================
--- trunk/libgdiplus/src/region.c 2006-08-10 15:06:05 UTC (rev 63593)
+++ trunk/libgdiplus/src/region.c 2006-08-10 15:08:41 UTC (rev 63594)
@@ -298,7 +298,7 @@
int i;
GpRectF *rect;
- /* no convertion is required for complex regions */
+ /* no conversion is required for complex regions */
if (!region || (region->type != RegionTypeRectF))
return;
@@ -1551,7 +1551,7 @@
if (gdip_is_matrix_empty (matrix))
return Ok;
- /* avoid heavy stuff (e.g. convertion to path, invalidating bitmap...)
+ /* avoid heavy stuff (e.g. conversion to path, invalidating bitmap...)
if the transform is only to do a simple translation */
if (gdip_is_matrix_a_translation (matrix)) {
return GdipTranslateRegion (region,
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches