11/* Automatically generated by
2- SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3171 uuid: b926bcd4-a4a9-4d38-8267-4eac3fec60d9
2+ SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3183 uuid: c5c103b4-2c5c-44e7-8e32-030e79600ca6
33 from
4- BitBltSimulation VMMaker.oscog-eem.3171 uuid: b926bcd4-a4a9-4d38-8267-4eac3fec60d9
4+ BitBltSimulation VMMaker.oscog-eem.3183 uuid: c5c103b4-2c5c-44e7-8e32-030e79600ca6
55 */
6- static char __buildInfo [] = "BitBltSimulation VMMaker.oscog-eem.3171 uuid: b926bcd4-a4a9-4d38-8267-4eac3fec60d9 " __DATE__ ;
6+ static char __buildInfo [] = "BitBltSimulation VMMaker.oscog-eem.3183 uuid: c5c103b4-2c5c-44e7-8e32-030e79600ca6 " __DATE__ ;
77
88
99#include "config.h"
@@ -167,6 +167,7 @@ EXPORT(sqInt) primitiveCopyBits(void);
167167EXPORT (sqInt ) primitiveDisplayString (void );
168168EXPORT (sqInt ) primitiveDrawLoop (void );
169169EXPORT (sqInt ) primitivePixelValueAt (void );
170+ EXPORT (sqInt ) primitivePixelValueAtPut (void );
170171EXPORT (sqInt ) primitiveWarpBits (void );
171172static sqInt reloadDestAndSourceForms (void );
172173static unsigned int rgbAddwith (unsigned int sourceWord , unsigned int destinationWord );
@@ -298,6 +299,7 @@ static sqInt (*stackObjectValue)(sqInt offset);
298299static sqInt (* stackValue )(sqInt offset );
299300static sqInt (* statNumGCs )(void );
300301static sqInt (* storeIntegerofObjectwithValue )(sqInt index , sqInt oop , sqInt integer );
302+ static usqInt (* storeLong32ofObjectwithValue )(sqInt fieldIndex , sqInt oop , usqInt anInteger );
301303#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */
302304extern sqInt byteSizeOf (sqInt oop );
303305extern sqInt failed (void );
@@ -348,6 +350,11 @@ extern sqInt statNumGCs(void);
348350# define statNumGCs () 0
349351#endif
350352extern sqInt storeIntegerofObjectwithValue (sqInt index , sqInt oop , sqInt integer );
353+ #if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 16 )
354+ extern usqInt storeLong32ofObjectwithValue (sqInt fieldIndex , sqInt oop , usqInt anInteger );
355+ #else
356+ # define storeLong32ofObjectwithValue (fieldIndex , oop , anInteger ) 0
357+ #endif
351358extern
352359#endif
353360struct VirtualMachine * interpreterProxy ;
@@ -358,7 +365,7 @@ static int maskTable[33] = {
3583650 , 1 , 3 , 0 , 15 , 31 , 0 , 0 , 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 65535 ,
3593660 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , -1
360367};
361- static const char * moduleName = "BitBltPlugin VMMaker.oscog-eem.3171 " INT_EXT ;
368+ static const char * moduleName = "BitBltPlugin VMMaker.oscog-eem.3183 " INT_EXT ;
362369static sqInt noHalftone ;
363370static sqInt noSource ;
364371static sqInt numGCsOnInvocation ;
@@ -5696,6 +5703,99 @@ primitivePixelValueAt(void)
56965703}
56975704
56985705
5706+ /* Sets the single pixel at x@y. Answers the previous value of the pixel.
5707+ It does not handle LSB bitmaps right now.
5708+ If x or y are < 0, return 0 to indicate transparent (cf
5709+ BitBlt>bitPeekerFromForm: usage).
5710+ Likewise if x>width or y>depth.
5711+ Fail if the rcvr doesn't seem to be a Form, or x|y seem wrong
5712+ */
5713+
5714+ /* BitBltSimulation>>#primitivePixelValueAtX:y:put: */
5715+ EXPORT (sqInt )
5716+ primitivePixelValueAtPut (void )
5717+ {
5718+ sqInt bitmap ;
5719+ sqInt bitsSize ;
5720+ sqInt depth ;
5721+ unsigned int mask ;
5722+ sqInt oldPixel ;
5723+ sqInt pixel ;
5724+ sqInt ppW ;
5725+ sqInt rcvr ;
5726+ sqInt shift ;
5727+ sqInt stride ;
5728+ sqInt word ;
5729+ sqInt xVal ;
5730+ sqInt yVal ;
5731+
5732+ if (!((isIntegerObject ((xVal = stackValue (2 ))))
5733+ && ((isIntegerObject ((yVal = stackValue (1 ))))
5734+ && (isIntegerObject ((pixel = stackValue (0 ))))))) {
5735+ return primitiveFailFor (PrimErrBadArgument );
5736+ }
5737+ xVal = integerValueOf (xVal );
5738+ yVal = integerValueOf (yVal );
5739+ pixel = integerValueOf (pixel );
5740+ rcvr = stackValue (3 );
5741+ rcvr = stackValue (methodArgumentCount ());
5742+ if (!((isPointers (rcvr ))
5743+ && ((slotSizeOf (rcvr )) >= 4 ))) {
5744+ return primitiveFailFor (PrimErrBadReceiver );
5745+ }
5746+ bitmap = fetchPointerofObject (FormBitsIndex , rcvr );
5747+ if (!(isWordsOrBytes (bitmap ))) {
5748+ return primitiveFailFor (PrimErrBadReceiver );
5749+ }
5750+ width = fetchIntegerofObject (FormWidthIndex , rcvr );
5751+ height = fetchIntegerofObject (FormHeightIndex , rcvr );
5752+
5753+ /* if width/height/depth are not integer, fail */
5754+ depth = fetchIntegerofObject (FormDepthIndex , rcvr );
5755+ if ((failed ())
5756+ || (depth < 0 )) {
5757+ return primitiveFailFor (PrimErrBadReceiver );
5758+ }
5759+ if ((xVal < 0 )
5760+ || ((xVal >= width )
5761+ || ((yVal < 0 )
5762+ || ((yVal >= height )
5763+ || (pixel < 0 ))))) {
5764+ return primitiveFailFor (PrimErrBadArgument );
5765+ }
5766+
5767+ /* pixels in each word */
5768+ ppW = 32 / depth ;
5769+
5770+ /* how many words per row of pixels */
5771+ stride = (width + (ppW - 1 )) / ppW ;
5772+ bitsSize = byteSizeOf (bitmap );
5773+ if (!(bitsSize >= ((stride * height ) * 4 ))) {
5774+
5775+ /* bytes per word */
5776+ return primitiveFailFor (PrimErrBadReceiver );
5777+ }
5778+
5779+ /* load the word that contains our target */
5780+ word = fetchLong32ofObject ((yVal * stride ) + (xVal / ppW ), bitmap );
5781+
5782+ /* make a mask to isolate the pixel within that word */
5783+ mask = ((usqInt )(0xFFFFFFFFU )) >> (32 - depth );
5784+
5785+ /* this is the tricky MSB part - we mask the xVal to find how far into the word we need, then add 1 for the pixel we're looking for, then * depth to get the bit shift */
5786+ shift = 32 - (((xVal & (ppW - 1 )) + 1 ) * depth );
5787+
5788+ /* shift, mask and dim the lights */
5789+ oldPixel = (((usqInt )(word )) >> shift ) & mask ;
5790+ word = ((word | (((usqInt )(mask ) << shift ))) - (((usqInt )(mask ) << shift ))) + (((sqInt )((usqInt )(pixel ) << shift )));
5791+ storeLong32ofObjectwithValue ((yVal * stride ) + (xVal / ppW ), bitmap , word );
5792+ if (!(failed ())) {
5793+ methodReturnValue (positive32BitIntegerFor (oldPixel ));
5794+ }
5795+ return null ;
5796+ }
5797+
5798+
56995799/* Invoke the warpBits primitive. If the destination is the display, then
57005800 copy it to the screen.
57015801 */
@@ -6811,6 +6911,13 @@ setInterpreter(struct VirtualMachine *anInterpreter)
68116911#endif
68126912#endif
68136913 storeIntegerofObjectwithValue = interpreterProxy -> storeIntegerofObjectwithValue ;
6914+ #if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 16 )
6915+ storeLong32ofObjectwithValue = interpreterProxy -> storeLong32ofObjectwithValue ;
6916+ #else
6917+ #if !defined(storeLong32ofObjectwithValue )
6918+ storeLong32ofObjectwithValue = 0 ;
6919+ #endif
6920+ #endif
68146921#endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */
68156922 }
68166923 return ok ;
@@ -8276,6 +8383,7 @@ void* BitBltPlugin_exports[][3] = {
82768383 {(void * )_m , "primitiveDisplayString\000\001\000" , (void * )primitiveDisplayString },
82778384 {(void * )_m , "primitiveDrawLoop\000\002\000" , (void * )primitiveDrawLoop },
82788385 {(void * )_m , "primitivePixelValueAt\000\002\001" , (void * )primitivePixelValueAt },
8386+ {(void * )_m , "primitivePixelValueAtPut\000\002\001" , (void * )primitivePixelValueAtPut },
82798387 {(void * )_m , "primitiveWarpBits\000\001\000" , (void * )primitiveWarpBits },
82808388 {(void * )_m , "setInterpreter" , (void * )setInterpreter },
82818389 {NULL , NULL , NULL }
@@ -8289,6 +8397,7 @@ EXPORT(signed short) primitiveCopyBitsMetadata = 0x100;
82898397EXPORT (signed short ) primitiveDisplayStringMetadata = 0x100 ;
82908398EXPORT (signed short ) primitiveDrawLoopMetadata = 0x200 ;
82918399EXPORT (signed short ) primitivePixelValueAtMetadata = 513 ;
8400+ EXPORT (signed short ) primitivePixelValueAtPutMetadata = 513 ;
82928401EXPORT (signed short ) primitiveWarpBitsMetadata = 0x100 ;
82938402#endif // SPURVM
82948403
0 commit comments