[squeak-dev] Re: Drawing speed (was: The Trunk: Graphics-tfel.326.mcz)

Bert Freudenberg bert at freudenbergs.de
Fri Feb 19 22:53:50 UTC 2016


> On 19.02.2016, at 14:08, timfelgentreff <timfelgentreff at gmail.com> wrote:
> 
> Is that so?

Yes ;)

> I didn't find any code in VMMaker that forces the screen flip...
> Where does that happen? In the interrupt check?

In the BitBlit plugin. It calls the interpreterProxy’s showDisplayBitsLeftTopRightBottom() whenever a Form is modified. The VM is supposed to update the display if the modified form is the Display form (registered via beDisplay in the specialObjectsArray).

> I was under the impression (from the method comment in forceDisplayUpdate)
> that platforms are allowed to buffer screen updates and only need to flip
> the buffers when that primitive is called.

There are no “buffers”. All bitblt operations modifying the Display bitmap have to be shown on the screen immediately. This is the original Smalltalk model where the Display bitmap *is* the video memory.

The only exception is if deferred updates are enabled. In that case, showDisplayBitsLeftTopRightBottom() can be ignored, the image will call primitiveForceDisplayUpdate later. 


- Bert -


> 
> 
> Bert Freudenberg wrote
>> This is a bad idea, it makes dragging feel sluggish. Before, I got 17
>> ms/iteration. Now, 100 ms/iteration on a moderately-sized display. Even if
>> I replace it with “Display forceToScreen: (rect merge: newRect)” I only
>> get back to 34 ms / iteration, because it invalidates way more pixels than
>> needed (just the border vs the whole rectangle area).
>> 
>> This should not be needed anyway: the VM must show draw requests to the
>> user immediately (or say within about 10 ms) unless the
>> primitiveDeferUpdates: flag is set (which is managed by Morphic for screen
>> updates).
>> 
>> - Bert -
>> 
>>> On 19.02.2016, at 13:17, 
> 
>> commits at .squeak
> 
>> wrote:
>>> 
>>> Tim Felgentreff uploaded a new version of Graphics to project The Trunk:
>>> http://source.squeak.org/trunk/Graphics-tfel.326.mcz
>>> 
>>> ==================== Summary ====================
>>> 
>>> Name: Graphics-tfel.326
>>> Author: tfel
>>> Time: 19 February 2016, 2:17:46.541729 pm
>>> UUID: 934ee205-38fd-4dcc-a877-b238d9e47a3a
>>> Ancestors: Graphics-tfel.325
>>> 
>>> use VM primitive to flip screen buffers when drawing rectangles to the
>>> screen
>>> 
>>> =============== Diff against Graphics-tfel.325 ===============
>>> 
>>> Item was changed:
>>> ----- Method: Rectangle>>newRectButtonPressedDo: (in category
>>> 'transforming') -----
>>> newRectButtonPressedDo: newRectBlock 
>>> 	"Track the outline of a new rectangle until mouse button 
>>> 	changes. newFrameBlock produces each new rectangle from the 
>>> 	previous. Only tracks while mouse is down."
>>> 	| rect newRect buttonNow delay |
>>> 	delay := Delay forMilliseconds: 10.
>>> 	buttonNow := Sensor anyButtonPressed.
>>> 	rect := self.
>>> 	Display
>>> 		border: rect
>>> 		width: 2
>>> 		rule: Form reverse
>>> 		fillColor: Color gray.
>>> 	[buttonNow]
>>> 		whileTrue: [delay wait.
>>> 			buttonNow := Sensor anyButtonPressed.
>>> 			newRect := newRectBlock value: rect.
>>> 			newRect = rect
>>> 				ifFalse: [Display
>>> 						border: rect
>>> 						width: 2
>>> 						rule: Form reverse
>>> 						fillColor: Color gray.
>>> 					Display
>>> 						border: newRect
>>> 						width: 2
>>> 						rule: Form reverse
>>> 						fillColor: Color gray.
>>> + 					Display forceToScreen.
>>> 					rect := newRect]].
>>> 	Display
>>> 		border: rect
>>> 		width: 2
>>> 		rule: Form reverse
>>> 		fillColor: Color gray.
>>> 	Project current pointerMoved. 
>>> 	Sensor processEvent: Sensor createMouseEvent.
>>> 	^ rect!
>>> 
>>> Item was changed:
>>> ----- Method: Rectangle>>newRectFrom: (in category 'transforming') -----
>>> newRectFrom: newRectBlock
>>> 	"Track the outline of a new rectangle until mouse button changes.
>>> 	newFrameBlock produces each new rectangle from the previous"
>>> 	| rect newRect buttonStart buttonNow delay |
>>> 	delay := Delay forMilliseconds: 10.
>>> 	buttonStart := buttonNow := Sensor anyButtonPressed.
>>> 	rect := self.
>>> 	Display border: rect width: 2 rule: Form reverse fillColor: Color gray.
>>> 	[buttonNow == buttonStart] whileTrue: 
>>> 		[delay wait.
>>> 		buttonNow := Sensor anyButtonPressed.
>>> 		newRect := newRectBlock value: rect.
>>> 		newRect = rect ifFalse:
>>> 			[Display border: rect width: 2 rule: Form reverse fillColor: Color
>>> gray.
>>> 			Display border: newRect width: 2 rule: Form reverse fillColor: Color
>>> gray.
>>> + 			Display forceToScreen.
>>> 			rect := newRect]].
>>> 	Display border: rect width: 2 rule: Form reverse fillColor: Color gray.
>>> 	Project current pointerMoved. 
>>> 	Sensor processEvent: Sensor createMouseEvent.
>>> 	^ rect!
>>> 
>>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> smime.p7s (5K)
>> &lt;http://forum.world.st/attachment/4879060/0/smime.p7s&gt;
> 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4207 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160219/51b26c50/smime.bin


More information about the Squeak-dev mailing list