Revision: 3626
Author: eliot
Date: 2016-02-22 10:51:24 -0800 (Mon, 22 Feb 2016)
Log Message:
-----------
Eliminate the casts on assigning the dispatch struct in sqManualSurface.c
Modified Paths:
--------------
trunk/platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c
trunk/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.h
Property Changed:
----------------
trunk/platforms/Cross/plugins/sqPluginsSCCSVersion.h
Modified: trunk/platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c
===================================================================
--- trunk/platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c 2016-02-21 04:56:31 UTC (rev 3625)
+++ trunk/platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c 2016-02-22 18:51:24 UTC (rev 3626)
@@ -53,22 +53,23 @@
/* Create the dispatch-table that SurfacePlugin will use to interact with
instances of "struct ManualSurface" */
-static long manualSurfaceGetFormat(ManualSurface* surface, long* width, long* height, long* depth, long* isMSB);
-static void* manualSurfaceLock(ManualSurface* surface, long *pitch, long x, long y, long w, long h);
-static long manualSurfaceUnlock(ManualSurface* surface, long x, long y, long w, long h);
-static long manualSurfaceShow(ManualSurface* surface, long x, long y, long w, long h);
+static long manualSurfaceGetFormat(void *, long*, long*, long*, long*);
+static long manualSurfaceLock(void *, long *, long, long, long, long);
+static long manualSurfaceUnlock(void *, long, long, long, long);
+static long manualSurfaceShow(void *, long, long, long, long);
static sqSurfaceDispatch manualSurfaceDispatch = {
1,
0,
- (fn_getSurfaceFormat) manualSurfaceGetFormat,
- (fn_lockSurface) manualSurfaceLock,
- (fn_unlockSurface) manualSurfaceUnlock,
- (fn_showSurface) manualSurfaceShow
+ manualSurfaceGetFormat,
+ manualSurfaceLock,
+ manualSurfaceUnlock,
+ manualSurfaceShow
};
/* sqSurfaceDispatch functions *****************************************************************************/
-long manualSurfaceGetFormat(ManualSurface* surface, long* width, long* height, long* depth, long* isMSB) {
+long manualSurfaceGetFormat(void *surfaceArg, long* width, long* height, long* depth, long* isMSB) {
+ ManualSurface* surface = surfaceArg;
*width = surface->width;
*height = surface->height;
*depth = surface->depth;
@@ -77,34 +78,36 @@
return 1;
}
-void* manualSurfaceLock(ManualSurface* surface, long *pitch, long x, long y, long w, long h) {
+long manualSurfaceLock(void *surfaceArg, long *pitch, long x, long y, long w, long h) {
+ ManualSurface* surface = surfaceArg;
/* Ideally, would be atomic. But it doens't matter for the forseeable future,
since it is only called via BitBlt primitives. */
int wasLocked = surface->isLocked;
surface->isLocked = 1;
/* Can't lock if it was already locked. */
- if (wasLocked) return NULL;
+ if (wasLocked) return 0;
/* If there is no pointer, the lock-attempt fails. */
if (!surface->ptr) {
surface->isLocked = 0;
- return NULL;
+ return 0;
}
/* Success! Return the pointer. */
*pitch = surface->rowPitch;
DPRINTF(("Locked Surface: %lx Input Rect: %ld %ld %ld %ld Row Pitch: %ld\n", (long) surface, x, y, w, h, *pitch));
- return surface->ptr;
+ return (long)(surface->ptr);
}
-long manualSurfaceUnlock(ManualSurface* surface, long x, long y, long w, long h) {
+long manualSurfaceUnlock(void *surfaceArg, long x, long y, long w, long h) {
+ ManualSurface* surface = surfaceArg;
surface->isLocked = 0;
DPRINTF(("Unlocked Surface: %lx Rect: %ld %ld %ld %ld\n", (long) surface, x, y, w, h));
return 1;
}
-long manualSurfaceShow(ManualSurface* surface, long x, long y, long w, long h) {
+long manualSurfaceShow(void *surfaceArg, long x, long y, long w, long h) {
/* Unsupported */
return 0;
}
@@ -143,7 +146,7 @@
long destroyManualSurface(long surfaceID) {
if (!unregisterSurface) return 0; /* failure... couldn't init function-pointer */
- else return unregisterSurface(surfaceID);
+ return unregisterSurface(surfaceID);
}
long setManualSurfacePointer(long surfaceID, void* ptr) {
@@ -156,6 +159,6 @@
surface = (ManualSurface*)surfaceHandle;
if (surface->isLocked) return FALSE; /* can't set pointer while surface is locked */
surface->ptr = ptr;
- DPRINTF(("Set Surface: %lx Polonger: %lx\n", surfaceID, (long)ptr));
+ DPRINTF(("Set Surface: %lx Pointer: %lx\n", surfaceID, (long)ptr));
return TRUE;
}
Modified: trunk/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.h
===================================================================
--- trunk/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.h 2016-02-21 04:56:31 UTC (rev 3625)
+++ trunk/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.h 2016-02-22 18:51:24 UTC (rev 3626)
@@ -6,10 +6,10 @@
/* Plugins creating their own surfaces must register these using
the following set of functions. The typedefs are for easier casts. */
-typedef long (*fn_getSurfaceFormat)(long surfaceHandle, long* width, long* height, long* depth, long* isMSB);
-typedef long (*fn_lockSurface)(long surfaceHandle, long *pitch, long x, long y, long w, long h);
-typedef long (*fn_unlockSurface)(long surfaceHandle, long x, long y, long w, long h);
-typedef long (*fn_showSurface)(long surfaceHandle, long x, long y, long w, long h);
+typedef long (*fn_getSurfaceFormat)(void * surfaceHandle, long* width, long* height, long* depth, long* isMSB);
+typedef long (*fn_lockSurface)(void * surfaceHandle, long *pitch, long x, long y, long w, long h);
+typedef long (*fn_unlockSurface)(void * surfaceHandle, long x, long y, long w, long h);
+typedef long (*fn_showSurface)(void * surfaceHandle, long x, long y, long w, long h);
typedef struct sqSurfaceDispatch {
/* Version information. Must be provided by the client
Property changes on: trunk/platforms/Cross/plugins/sqPluginsSCCSVersion.h
___________________________________________________________________
Modified: checkindate
- Sat Feb 20 20:22:47 PST 2016
+ Mon Feb 22 10:32:52 PST 2016