[Vm-dev] VMMaker-tfel.358 in Inbox: Fixes for BitBlt simulation

timfelgentreff timfelgentreff at gmail.com
Thu Feb 12 16:55:28 UTC 2015


Hi,

I've pushed a change to the BitBlt simulation code to the Inbox
(VMMaker-tfel.358), because I didn't know where else to put it. With these
changes, we are able to run a current 4.5 image with VMMaker loaded on our
RSqueakVM, with BitBlt entirely run from within the image.

The goal is to have the VM run as many plugins as possible from pure
Smalltalk, so there will be more slight changes and maybe the odd
performance improvement for the simulation forthcoming. Is this something
that would be ok with everyone?

Here's the diff:

BitBltSimulation>>loadColorMap: (changed)
loadColorMap
	"ColorMap, if not nil, must be longWords, and 
	2^N long, where N = sourceDepth for 1, 2, 4, 8 bits, 
	or N = 9, 12, or 15 (3, 4, 5 bits per color) for 16 or 32 bits."
	| cmSize oldStyle oop cmOop |
	<inline: true>
	cmFlags := cmMask := cmBitsPerColor := 0.
	cmShiftTable := nil.
	cmMaskTable := nil.
	cmLookupTable := nil.
	cmOop := interpreterProxy fetchPointer: BBColorMapIndex ofObject:
bitBltOop.
	cmOop = interpreterProxy nilObject
		ifTrue: [^ true].
	cmFlags := ColorMapPresent.
	"even if identity or somesuch - may be cleared later"
	oldStyle := false.
	(interpreterProxy isWords: cmOop)
		ifTrue: ["This is an old-style color map (indexed only, with implicit
			RGBA conversion)"
			cmSize := interpreterProxy slotSizeOf: cmOop.
			cmLookupTable := interpreterProxy firstIndexableField: cmOop.
-			oldStyle := true.
-			self
-				cCode: ''
-				inSmalltalk: [self assert: cmLookupTable unitSize = 4]]
+			oldStyle := true]
		ifFalse: ["A new-style color map (fully qualified)"
			((interpreterProxy isPointers: cmOop)
					and: [(interpreterProxy slotSizeOf: cmOop)
							>= 3])
				ifFalse: [^ false].
			cmShiftTable := self
						loadColorMapShiftOrMaskFrom: (interpreterProxy fetchPointer: 0
ofObject: cmOop).
			cmMaskTable := self
						loadColorMapShiftOrMaskFrom: (interpreterProxy fetchPointer: 1
ofObject: cmOop).
			oop := interpreterProxy fetchPointer: 2 ofObject: cmOop.
			oop = interpreterProxy nilObject
				ifTrue: [cmSize := 0]
				ifFalse: [(interpreterProxy isWords: oop)
						ifFalse: [^ false].
					cmSize := interpreterProxy slotSizeOf: oop.
					cmLookupTable := interpreterProxy firstIndexableField: oop].
			cmFlags := cmFlags bitOr: ColorMapNewStyle.
			self
				cCode: ''
				inSmalltalk: [self assert: cmShiftTable unitSize = 4.
					self assert: cmMaskTable unitSize = 4.
					self assert: cmLookupTable unitSize = 4]].
	(cmSize bitAnd: cmSize - 1)
			= 0
		ifFalse: [^ false].
	cmMask := cmSize - 1.
	cmBitsPerColor := 0.
	cmSize = 512
		ifTrue: [cmBitsPerColor := 3].
	cmSize = 4096
		ifTrue: [cmBitsPerColor := 4].
	cmSize = 32768
		ifTrue: [cmBitsPerColor := 5].
	cmSize = 0
		ifTrue: [cmLookupTable := nil.
			cmMask := 0]
		ifFalse: [cmFlags := cmFlags bitOr: ColorMapIndexedPart].
	oldStyle
		ifTrue: ["needs implicit conversion"
			self setupColorMasks].
	"Check if colorMap is just identity mapping for RGBA parts"
	(self isIdentityMap: cmShiftTable with: cmMaskTable)
		ifTrue: [cmMaskTable := nil.
			cmShiftTable := nil]
		ifFalse: [cmFlags := cmFlags bitOr: ColorMapFixedPart].
	^ true


BitBltSimulator>>halftoneAt: (added)
+halftoneAt: idx 
+	^ halftoneBase + (idx \\ halftoneHeight * 4) long32At: 0






--
View this message in context: http://forum.world.st/VMMaker-tfel-358-in-Inbox-Fixes-for-BitBlt-simulation-tp4805362.html
Sent from the Squeak VM mailing list archive at Nabble.com.


More information about the Vm-dev mailing list