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

Bert Freudenberg bert at freudenbergs.de
Fri Feb 19 19:21:51 UTC 2016


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 source.squeak.org 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!
> 
> 



-------------- 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/1616b708/smime.bin


More information about the Squeak-dev mailing list