--- a/XWorkstation.st Thu May 17 15:46:23 2018 +0200
+++ b/XWorkstation.st Thu May 17 16:52:29 2018 +0200
@@ -62,7 +62,6 @@
privateIn:XWorkstation
!
-
!XWorkstation primitiveDefinitions!
%{
@@ -11280,23 +11279,25 @@
if (ISCONNECTED
&& __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
- win = __WindowVal(aDrawableId);
- xpos = __intVal(x);
- ypos = __intVal(y);
- if ((xpos < 0) || (ypos < 0)) {
- RETURN ( __MKSMALLINT(0) );
- }
- ENTER_XLIB();
- img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
- LEAVE_XLIB();
- if (img != 0) {
- ret = XGetPixel(img, 0, 0);
- XDestroyImage(img);
- RETURN ( __MKSMALLINT(ret) );
- }
+ win = __WindowVal(aDrawableId);
+ xpos = __intVal(x);
+ ypos = __intVal(y);
+ if ((xpos < 0) || (ypos < 0)) {
+ RETURN ( __MKSMALLINT(0) );
+ }
+ ENTER_XLIB();
+ img = XGetImage(myDpy, win, xpos, ypos, 1, 1, ~(unsigned long)0, ZPixmap);
+ LEAVE_XLIB();
+ if (img != 0) {
+ ret = XGetPixel(img, 0, 0);
+ XDestroyImage(img);
+ RETURN ( __MKSMALLINT(ret) );
+ }
}
%}.
^ nil
+
+ "Modified: / 17-05-2018 / 16:45:34 / Stefan Vogel"
!
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info
@@ -11317,85 +11318,86 @@
&& __bothSmallInteger(w, h)
&& __isArray(info) && (__arraySize(info) >= 8)
&& __isByteArray(imageBits)) {
- Display *dpy = myDpy;
-
- win = __WindowVal(aDrawableId);
- ENTER_XLIB();
- image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
- __intVal(w), __intVal(h),
- (unsigned)AllPlanes, ZPixmap);
- LEAVE_XLIB();
-
- if (! image) {
- RETURN ( false );
- }
-
- pad = image->bitmap_pad;
+ Display *dpy = myDpy;
+
+ win = __WindowVal(aDrawableId);
+ ENTER_XLIB();
+ image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
+ __intVal(w), __intVal(h),
+ (unsigned long)AllPlanes, ZPixmap);
+ LEAVE_XLIB();
+
+ if (! image) {
+ RETURN ( false );
+ }
+
+ pad = image->bitmap_pad;
#ifdef SUPERDEBUG
- console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
-#endif
- switch (image->depth) {
- case 1:
- case 2:
- case 4:
- case 8:
- case 16:
- case 24:
- case 32:
- numBytes = image->bytes_per_line * image->height;
- break;
-
- default:
- /* unsupported depth ? */
- console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
- numBytes = image->bytes_per_line * image->height;
- break;
- }
+ console_printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
+#endif
+ switch (image->depth) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ numBytes = image->bytes_per_line * image->height;
+ break;
+
+ default:
+ /* unsupported depth ? */
+ console_fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth);
+ numBytes = image->bytes_per_line * image->height;
+ break;
+ }
#ifdef SUPERDEBUG
- console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
-#endif
-
- if (numBytes > __byteArraySize(imageBits)) {
- /* imageBits too small */
- console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
- console_fprintf(stderr, " bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits));
- console_fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n",
- image->bitmap_pad, image->depth, image->bytes_per_line);
- goto fail;
- }
- if (image->bitmap_bit_order == MSBFirst)
- __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
- else
- __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
- __ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
- __ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
- if (image->byte_order == MSBFirst)
- __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
- else
- __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
- if (image->format == XYBitmap)
- __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
- else if (image->format == XYPixmap)
- __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
- else if (image->format == ZPixmap)
- __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
-
- __ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
- __ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
- __ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
- bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
- XDestroyImage(image);
- RETURN ( true );
+ console_printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
+#endif
+
+ if (numBytes > __byteArraySize(imageBits)) {
+ /* imageBits too small */
+ console_fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
+ console_fprintf(stderr, " bytes need:%d given:%d\n", numBytes, (int)__byteArraySize(imageBits));
+ console_fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n",
+ image->bitmap_pad, image->depth, image->bytes_per_line);
+ goto fail;
+ }
+ if (image->bitmap_bit_order == MSBFirst)
+ __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
+ else
+ __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
+ __ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
+ __ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
+ if (image->byte_order == MSBFirst)
+ __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
+ else
+ __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
+ if (image->format == XYBitmap)
+ __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
+ else if (image->format == XYPixmap)
+ __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
+ else if (image->format == ZPixmap)
+ __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
+
+ __ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
+ __ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
+ __ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
+ bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
+ XDestroyImage(image);
+ RETURN ( true );
}
fail:
if (image) {
- XDestroyImage(image);
+ XDestroyImage(image);
}
%}.
^ false
"Modified: / 11-04-2017 / 21:17:31 / cg"
+ "Modified: / 17-05-2018 / 16:45:14 / Stefan Vogel"
! !
!XWorkstation methodsFor:'selection fetching'!