[squeak-dev] The Trunk: Morphic-ul.565.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Aug 4 01:12:46 UTC 2011


Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.565.mcz

==================== Summary ====================

Name: Morphic-ul.565
Author: ul
Time: 4 August 2011, 3:11:12.403 am
UUID: 722fd55a-3d47-c54d-817a-19b826b9f721
Ancestors: Morphic-nice.564

Removed unnecessary blocks.
Morph >> #submorphsThat:ifNone: only accepts blocks which evaluate to a boolean as it's first argument.

=============== Diff against Morphic-nice.564 ===============

Item was changed:
  ----- Method: Canvas>>transform2By:clippingTo:during:smoothing: (in category 'Nebraska/embeddedWorlds') -----
  transform2By: aDisplayTransform clippingTo: aClipRect during: aBlock smoothing: cellSize
  
  	"an attempt to use #displayInterpolatedOn: instead of WarpBlt."
  
  	| patchRect subCanvas pureRect biggerPatch biggerClip interForm |
  
  	self flag: #bob.		"added to Canvas in hopes it will work for Nebraska"
  	(aDisplayTransform isPureTranslation) ifTrue: [
  		^aBlock value: (self copyOffset: aDisplayTransform offset negated truncated
  							clipRect: aClipRect)
  	].
  	"Prepare an appropriate warp from patch to aClipRect"
  	pureRect := (aDisplayTransform globalBoundsToLocal: aClipRect).
  	patchRect := pureRect rounded.
  	patchRect area = 0 ifTrue: [^self]. 	"oh, well!!"
  	biggerPatch := patchRect expandBy: 1.
  	biggerClip := (aDisplayTransform localBoundsToGlobal: biggerPatch) rounded.
  
  	"Render the submorphs visible in the clipping rectangle, as patchForm"
  	subCanvas := FormCanvas extent: biggerPatch extent depth: self depth.
  	self isShadowDrawing ifTrue: [
  		subCanvas shadowColor: self shadowColor
  	].
  
  	"this biggerPatch/biggerClip is an attempt to improve positioning of the final image in high magnification conditions. Since we cannot grab fractional pixels from the source, take one extra and then take just the part we need from the expanded form"
  
  	subCanvas 
  		translateBy: biggerPatch topLeft negated rounded
+ 		during: aBlock.
- 		during: [ :offsetCanvas | aBlock value: offsetCanvas].
  	interForm := Form extent: biggerClip extent depth: self depth.
  	subCanvas form 
  		displayInterpolatedIn: interForm boundingBox
  		on: interForm.
  	self 
  		drawImage: interForm 
  		at: aClipRect origin 
  		sourceRect: (aClipRect origin - biggerClip origin extent: aClipRect extent)
  
  !

Item was changed:
  ----- Method: ColorPatchCanvas>>transformBy:clippingTo:during:smoothing: (in category 'drawing-support') -----
  transformBy: aDisplayTransform clippingTo: aClipRect during: aBlock smoothing: cellSize
  	"Note: This method has been originally copied from TransformationMorph."
  	| innerRect patchRect sourceQuad warp start subCanvas |
  	(aDisplayTransform isPureTranslation) ifTrue:[
  		subCanvas := self copyOffset: aDisplayTransform offset negated truncated
  							clipRect: aClipRect.
  		aBlock value: subCanvas.
  		foundMorph := subCanvas foundMorph.
  		^self
  	].
  	"Prepare an appropriate warp from patch to innerRect"
  	innerRect := aClipRect.
  	patchRect := aDisplayTransform globalBoundsToLocal:
  					(self clipRect intersect: innerRect).
  	sourceQuad := (aDisplayTransform sourceQuadFor: innerRect)
  					collect: [:p | p - patchRect topLeft].
  	warp := self warpFrom: sourceQuad toRect: innerRect.
  	warp cellSize: cellSize.
  
  	"Render the submorphs visible in the clipping rectangle, as patchForm"
  	start := (self depth = 1 and: [self isShadowDrawing not])
  		"If this is true B&W, then we need a first pass for erasure."
  		ifTrue: [1] ifFalse: [2].
  	start to: 2 do:
  		[:i | "If i=1 we first make a shadow and erase it for opaque whites in B&W"
  		subCanvas := ColorPatchCanvas extent: patchRect extent depth: self depth.
  		subCanvas stopMorph: stopMorph.
  		subCanvas foundMorph: foundMorph.
  		subCanvas doStop: doStop.
  		i=1	ifTrue: [subCanvas shadowColor: Color black.
  					warp combinationRule: Form erase]
  			ifFalse: [self isShadowDrawing ifTrue:
  					[subCanvas shadowColor: self shadowColor].
  					warp combinationRule: Form paint].
+ 		subCanvas
+ 			translateBy: patchRect topLeft negated
+ 			during: aBlock.
- 		subCanvas translateBy: patchRect topLeft negated
- 			during:[:offsetCanvas| aBlock value: offsetCanvas].
  		i = 2 ifTrue:[foundMorph := subCanvas foundMorph].
  		warp sourceForm: subCanvas form; warpBits.
  		warp sourceForm: nil.  subCanvas := nil "release space for next loop"]
  !

Item was changed:
  ----- Method: DoCommandOnceMorph>>step (in category 'stepping and presenter') -----
  step
  
  	| goForIt |
  
  	actionBlock ifNil: [^self stopStepping].
  	goForIt := actionBlock.
  	actionBlock := nil.
+ 	goForIt
- 	[
- 		goForIt value.
- 	]
  		on: ProgressTargetRequestNotification
  		do: [ :ex | ex resume: innerArea].		"in case a save/load progress display needs a home"
  !

Item was changed:
  ----- Method: FormCanvas>>transformBy:clippingTo:during:smoothing: (in category 'drawing-support') -----
  transformBy: aDisplayTransform clippingTo: aClipRect during: aBlock	 smoothing: cellSize
  
  	"Note: This method has been originally copied from TransformationMorph."
  	| innerRect patchRect sourceQuad warp start subCanvas |
  	(aDisplayTransform isPureTranslation) ifTrue:[
  		^aBlock value: (self copyOffset: aDisplayTransform offset negated truncated
  							clipRect: aClipRect)
  	].
  	"Prepare an appropriate warp from patch to innerRect"
  	innerRect := aClipRect.
  	patchRect := (aDisplayTransform globalBoundsToLocal: innerRect) truncated.
  	sourceQuad := (aDisplayTransform sourceQuadFor: innerRect)
  					collect: [:p | p - patchRect topLeft].
  	warp := self warpFrom: sourceQuad toRect: innerRect.
  
  	"Render the submorphs visible in the clipping rectangle, as patchForm"
  	start := (self depth = 1 and: [self isShadowDrawing not])
  		"If this is true B&W, then we need a first pass for erasure."
  		ifTrue: [1] ifFalse: [2].
  	start to: 2 do:
  		[:i | "If i=1 we first make a shadow and erase it for opaque whites in B&W"
  		subCanvas := self class extent: patchRect extent depth: self depth.
  		i=1	ifTrue: [subCanvas shadowColor: Color black.
  					warp combinationRule: Form erase]
  			ifFalse: [self isShadowDrawing ifTrue:
  					[subCanvas shadowColor: self shadowColor].
  					warp combinationRule: Form paint].
+ 		subCanvas
+ 			translateBy: patchRect topLeft negated
+ 			during: aBlock.
- 		subCanvas translateBy: patchRect topLeft negated
- 			during:[:offsetCanvas| aBlock value: offsetCanvas].
  		warp sourceForm: subCanvas form; cellSize: cellSize; warpBits.
  		warp sourceForm: nil.  subCanvas := nil "release space for next loop"]
  !

Item was changed:
  ----- Method: Morph>>submorphThat:ifNone: (in category 'submorphs-accessing') -----
  submorphThat: block1 ifNone: block2
+ 
+ 	^submorphs detect: block1 ifNone: block2
- 	^ submorphs detect: [:m | (block1 value: m) == true] ifNone: [block2 value]
  	!

Item was changed:
  ----- Method: PasteUpMorph>>becomeActiveDuring: (in category 'initialization') -----
  becomeActiveDuring: aBlock
  	"Make the receiver the ActiveWorld during the evaluation of aBlock.
  	Note that this method does deliberately *not* use #ensure: to prevent
  	re-installation of the world on project switches."
  	| priorWorld priorHand priorEvent |
  	priorWorld := ActiveWorld.
  	priorHand := ActiveHand.
  	priorEvent := ActiveEvent.
  	ActiveWorld := self.
  	ActiveHand := self hands first. "default"
  	ActiveEvent := nil. "not in event cycle"
+ 	aBlock
- 	[aBlock value]
  		on: Error
  		do: [:ex | 
  			ActiveWorld := priorWorld.
  			ActiveEvent := priorEvent.
  			ActiveHand := priorHand.
  			ex pass]!

Item was changed:
  ----- Method: SystemWindow>>paneMorphSatisfying: (in category 'panes') -----
  paneMorphSatisfying: aBlock
+ 
+ 	^paneMorphs detect: aBlock ifNone: [ nil ]!
- 	^ paneMorphs detect: [:aPane | aBlock value: aPane] ifNone: [nil]!




More information about the Squeak-dev mailing list