Author: spouliot
Date: 2007-04-24 15:29:18 -0400 (Tue, 24 Apr 2007)
New Revision: 76215
Modified:
trunk/libgdiplus/tests/ChangeLog
trunk/libgdiplus/tests/testbits.c
trunk/libgdiplus/tests/testgdi.c
Log:
2007-04-24 Sebastien Pouliot <[EMAIL PROTECTED]>
* testbits.cs: Use public header file. Comment stuff that use private
API (stuff is not exposed anymore).
* testgdi.c: Use public header file and fix warnings.
Modified: trunk/libgdiplus/tests/ChangeLog
===================================================================
--- trunk/libgdiplus/tests/ChangeLog 2007-04-24 19:28:56 UTC (rev 76214)
+++ trunk/libgdiplus/tests/ChangeLog 2007-04-24 19:29:18 UTC (rev 76215)
@@ -1,3 +1,9 @@
+2007-04-24 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * testbits.cs: Use public header file. Comment stuff that use private
+ API (stuff is not exposed anymore).
+ * testgdi.c: Use public header file and fix warnings.
+
2007-04-03 Sebastien Pouliot <[EMAIL PROTECTED]>
* testgdi.c: Adjust sample as private symbol gdip_graphics_new isn't
Modified: trunk/libgdiplus/tests/testbits.c
===================================================================
--- trunk/libgdiplus/tests/testbits.c 2007-04-24 19:28:56 UTC (rev 76214)
+++ trunk/libgdiplus/tests/testbits.c 2007-04-24 19:29:18 UTC (rev 76215)
@@ -1,8 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
-#include "gdip.h"
+#include "GdiPlusFlat.h"
static int status_counter = 0;
@@ -12,46 +13,45 @@
main (int argc, char **argv)
{
GpBitmap *bitmap;
- GdipBitmapData d, q;
- GpStatus status;
+ BitmapData d, q;
Rect r;
int i, j;
unsigned long *lptr;
unsigned char *cptr;
-
- status = GdipCreateBitmapFromScan0 (10, 10, 10 * 4, Format32bppArgb,
GdipAlloc(10 * 10 * 4), &bitmap);
+ BYTE *scan0 = (BYTE*) GdipAlloc(10 * 10 * 4);
+ GpStatus status = GdipCreateBitmapFromScan0 (10, 10, 10 * 4,
PixelFormat32bppArgb, scan0, &bitmap);
CHECK_STATUS(1);
printf ("Full rectangle, no format conversion, read only\n");
r.X = 0; r.Y = 0;
r.Width = 10; r.Height = 10;
- status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead,
Format32bppArgb, &d);
+ status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead,
PixelFormat32bppArgb, &d);
CHECK_STATUS(1);
printf ("Attempt to re-lock (should fail)\n");
- status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead,
Format32bppArgb, &q);
+ status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead,
PixelFormat32bppArgb, &q);
CHECK_STATUS(0);
printf ("Unlock\n");
status = GdipBitmapUnlockBits (bitmap, &d);
CHECK_STATUS(1);
- lptr = (unsigned long *) bitmap->active_bitmap->scan0;
+/* lptr = (unsigned long *) bitmap->active_bitmap->scan0;
for (j = 0; j < 10; j++) {
for (i = 0; i < 10; i++) {
*lptr++ = j | j << 8 | i << 16 | i << 24;
}
}
-
- memset (&d, 0x00, sizeof(GdipBitmapData));
+*/
+ memset (&d, 0x00, sizeof (BitmapData));
printf ("\nHalf rectangle, no format conversion, read only\n");
r.X = 5; r.Y = 5;
r.Width = 5; r.Height = 5;
- status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead,
Format32bppArgb, &d);
+ status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead,
PixelFormat32bppArgb, &d);
CHECK_STATUS(1);
for (j = 0; j < 5; j++) {
- lptr = (unsigned long *) d.scan0 + j * d.stride;
+ lptr = (unsigned long *) d.Scan0 + j * d.Stride;
printf ("%d: ", j);
for (i = 0; i < 5; i++) {
printf ("%08x ", *lptr++);
@@ -59,23 +59,23 @@
printf ("\n");
}
printf ("Modifying (setting to 0xff)\n");
- memset (d.scan0, 0xff, d.stride * d.height);
+ memset (d.Scan0, 0xff, d.Stride * d.Height);
printf ("Unlocking\n");
status = GdipBitmapUnlockBits (bitmap, &d);
CHECK_STATUS(1);
- printf ("Original data after unlock (shouldn't be 0xffffffff): 0x%08x\n",
+/* printf ("Original data after unlock (shouldn't be 0xffffffff): 0x%08x\n",
((unsigned long *)(bitmap->active_bitmap->scan0))[55]);
if (((unsigned long *)(bitmap->active_bitmap->scan0))[55] == 0xffffffff)
printf ("==> FAIL!\n");
-
- memset (&d, 0x00, sizeof(GdipBitmapData));
+*/
+ memset (&d, 0x00, sizeof (BitmapData));
printf ("\nHalf rectangle, 32bpp ARGB -> 32bpp RGB, read only\n");
r.X = 5; r.Y = 5;
r.Width = 5; r.Height = 5;
- status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead,
Format32bppRgb, &d);
+ status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead,
PixelFormat32bppRgb, &d);
CHECK_STATUS(1);
- lptr = (unsigned long *) d.scan0;
+ lptr = (unsigned long *) d.Scan0;
for (j = 0; j < 5; j++) {
printf ("%d: ", j);
for (i = 0; i < 5; i++) {
@@ -87,15 +87,15 @@
status = GdipBitmapUnlockBits (bitmap, &d);
CHECK_STATUS(1);
- memset (&d, 0x00, sizeof(GdipBitmapData));
+ memset (&d, 0x00, sizeof (BitmapData));
printf ("\nHalf rectangle, 32bpp ARGB -> 24bpp RGB, read/write only\n");
r.X = 5; r.Y = 5;
r.Width = 5; r.Height = 5;
- status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead |
ImageLockModeWrite, Format24bppRgb, &d);
+ status = GdipBitmapLockBits (bitmap, &r, ImageLockModeRead |
ImageLockModeWrite, PixelFormat24bppRgb, &d);
CHECK_STATUS(1);
for (j = 0; j < 5; j++) {
- cptr = (unsigned char *) (d.scan0 + (j * d.stride));
+ cptr = (unsigned char *) (d.Scan0 + (j * d.Stride));
printf ("%d: ", j);
for (i = 0; i < 5; i++) {
printf ("%02x%02x%02x ", cptr[0], cptr[1], cptr[2]);
@@ -106,7 +106,7 @@
printf ("Modifying (setting to 0xaabbcc)\n");
for (j = 0; j < 5; j++) {
- cptr = (unsigned char *) (d.scan0 + (j * d.stride));
+ cptr = (unsigned char *) (d.Scan0 + (j * d.Stride));
for (i = 0; i < 5; i++) {
*cptr++ = 0xcc;
*cptr++ = 0xbb;
@@ -117,15 +117,16 @@
status = GdipBitmapUnlockBits (bitmap, &d);
CHECK_STATUS(1);
- printf ("Original data after Unlock (should be all 0xffaabbcc):\n");
+/* printf ("Original data after Unlock (should be all 0xffaabbcc):\n");
for (j = 5; j < 10; j++) {
- lptr = (unsigned long *) (bitmap->active_bitmap->scan0 + j *
bitmap->active_bitmap->stride) + 5;
+ lptr = (unsigned long *) (bitmap->active_bitmap->Scan0 + j *
bitmap->active_bitmap->Stride) + 5;
printf ("%d: ", j);
for (i = 5; i < 10; i++) {
printf ("%08x ", *lptr++);
}
printf ("\n");
}
-
+*/
+ GdipFree (scan0);
return 0;
}
Modified: trunk/libgdiplus/tests/testgdi.c
===================================================================
--- trunk/libgdiplus/tests/testgdi.c 2007-04-24 19:28:56 UTC (rev 76214)
+++ trunk/libgdiplus/tests/testgdi.c 2007-04-24 19:29:18 UTC (rev 76215)
@@ -15,12 +15,10 @@
#include <unistd.h>
#include <math.h>
+#include "GdiPlusFlat.h"
+#include <X11/Xlib.h>
#include <cairo.h>
-#include "gdip.h"
-
-#include <freetype/tttables.h>
-
typedef struct win {
Display *dpy;
int scr;
@@ -56,7 +54,7 @@
GdipCreateFromXDrawable_linux (NULL, NULL, &gp);
{
GpPen *pen;
- GpBrush *brush;
+ GpSolidFill *brush;
int a = 255;
int r = 255;
int g = 0;
@@ -68,10 +66,9 @@
GdipDrawRectangle (gp, pen, 10, 10, 60, 60);
GdipDrawLine (gp, pen, 0, 0, 100, 100);
- GdipCreateSolidFill (a << 24 | r << 16 | g << 8 | b,
- &brush);
+ GdipCreateSolidFill (a << 24 | r << 16 | g << 8 | b, &brush);
- printf ("%s\n",cairo_status_to_string (GdipFillEllipse (gp,
brush, 40, 40, 50, 75)));
+ printf ("%s\n",cairo_status_to_string (GdipFillEllipse (gp,
(GpBrush*)brush, 40, 40, 50, 75)));
// return;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches