[Vm-dev] VM Maker: VMMaker-dtl.314.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Mar 26 01:37:43 UTC 2013
David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-dtl.314.mcz
==================== Summary ====================
Name: VMMaker-dtl.314
Author: dtl
Time: 25 March 2013, 9:34:07.639 pm
UUID: 27bc9a3b-01be-47b3-8e3a-b5f5554a389d
Ancestors: VMMaker-tpr.313
VMMaker 4.11.4
Remove PixelValuePeekPlugin because primitivePixelValueAt is now in BitBltSimulation
=============== Diff against VMMaker-tpr.313 ===============
Item was removed:
- SmartSyntaxInterpreterPlugin subclass: #PixelValuePeekPlugin
- instanceVariableNames: ''
- classVariableNames: 'AllOnes FormBitsIndex FormDepthIndex FormHeightIndex FormWidthIndex'
- poolDictionaries: ''
- category: 'VMMaker-Plugins'!
-
- !PixelValuePeekPlugin commentStamp: 'tpr 3/14/2013 15:40' prior: 0!
- I provide a primitive to quickly peek at the pixel value of a Form at a point; thus removing the need for a full-blown BitBlt>bitPeekerFromForm:!
Item was removed:
- ----- Method: PixelValuePeekPlugin class>>initialize (in category 'initialization') -----
- initialize
- "PixelValuePeekPlugin initialize"
- "Mask constants"
- AllOnes := 16rFFFFFFFF.
-
-
- "Form fields"
- FormBitsIndex := 0.
- FormWidthIndex := 1.
- FormHeightIndex := 2.
- FormDepthIndex := 3!
Item was removed:
- ----- Method: PixelValuePeekPlugin>>primitivePixelValueAtX:y: (in category 'system primitives') -----
- primitivePixelValueAtX: xVal y: yVal
- "returns the single pixel at x at y.
- It does not handle LSB bitmaps right now.
- If x or y are < 0, return 0 to indicate transparent (cf BitBlt>bitPeekerFromForm: usage).
- Likewise if x>width or y>depth.
- Fail if the rcvr doesn't seem to be a Form, or x|y seem wrong"
- | rcvr bitmap width height depth ppW stride word mask shift pixel |
- rcvr := self primitive: 'primitivePixelValueAt' parameters: #(SmallInteger SmallInteger) receiver: #Oop.
-
- "possible quick exit if x or y is -ve"
- (xVal < 0 or: [ yVal < 0 ] ) ifTrue:[^interpreterProxy integerObjectOf: 0].
- "check that rcvr is plausibly a Form or subclass"
- rcvr := interpreterProxy stackValue: interpreterProxy methodArgumentCount.
- ((interpreterProxy isPointers: rcvr) and: [(interpreterProxy slotSizeOf: rcvr) >= 4])
- ifFalse: [^interpreterProxy primitiveFail].
-
- "get the bits oop and width/height/depth"
- bitmap := interpreterProxy fetchPointer: FormBitsIndex ofObject: rcvr.
- width := interpreterProxy fetchInteger: FormWidthIndex ofObject: rcvr.
- height := interpreterProxy fetchInteger: FormHeightIndex ofObject: rcvr.
- depth := interpreterProxy fetchInteger: FormDepthIndex ofObject: rcvr.
- "if width/height/depth are not integer, fail"
- interpreterProxy failed ifTrue:[^nil].
-
- "possible quick exit if x or y is >= extent of form. This also catches cases where the width/height are < 0"
- (xVal >= width or: [ yVal >= height ] ) ifTrue:[^interpreterProxy integerObjectOf: 0].
-
- "we don't handle LSB Forms yet"
- depth < 0 ifTrue:[^interpreterProxy primitiveFail].
-
- "OK so now we know we have a plausible Form, the width/height/depth/x/y are all reasonable and it's time to plunder the bitmap"
- ppW := 32//depth. "pixels in each word"
- stride := (width + (ppW -1)) // ppW. "how many words per rox of pixels"
- word := interpreterProxy fetchLong32:(yVal * stride) + (xVal//ppW) + 1 ofObject: bitmap. "load the word that contains our target"
- mask := 16rFFFFFFFF >> (32 - depth). "make a mask to isolate the pixel within that word"
- shift := 32 - (((xVal bitAnd: ppW-1) + 1) * depth). "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"
- pixel := (word >> shift) bitAnd: mask. "shift, mask and dim the lights"
- ^interpreterProxy integerObjectOf: pixel "pop the incoming and push our answer"
- !
Item was changed:
----- Method: VMMaker class>>versionString (in category 'version testing') -----
versionString
"VMMaker versionString"
+ ^'4.11.4'!
- ^'4.11.3'!
More information about the Vm-dev
mailing list