The Trunk: Morphic-ar.311.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-ar.311.mcz

commits-2
Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ar.311.mcz

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

Name: Morphic-ar.311
Author: ar
Time: 23 January 2010, 2:48:15.733 pm
UUID: 06e2c59f-5bea-714d-aef1-db97ddaec6c2
Ancestors: Morphic-ar.310, Morphic-nice.277

Merging Morphic-nice.277:

Experimental: let a Rectangle merge in place (I called this swallow:)
This has two advantages:
- avoid repeated Object creation when we just want the gross result
- avoid closures writing to outer temps

IMHO, generalizing this kind of policy could have a measurable impact on GUI speed.
However, this is against current policy to never change a Point nor rectangle in place, so I let gurus judge if worth or not.


=============== Diff against Morphic-ar.310 ===============

Item was changed:
  ----- Method: SelectionMorph>>drawOn: (in category 'drawing') -----
  drawOn: aCanvas
 
  | canvas form1 form2 box |
  super drawOn: aCanvas.
+ box := self bounds copy.
+ selectedItems do: [:m | box swallow: m fullBounds].
- box := self bounds.
- selectedItems do: [:m | box := box merge: m fullBounds].
  box := box expandBy: 1.
  canvas := Display defaultCanvasClass extent: box extent depth: 8.
  canvas translateBy: box topLeft negated
  during: [:tempCanvas | selectedItems do: [:m | tempCanvas fullDrawMorph: m]].
  form1 := (Form extent: box extent) copyBits: (0@0 extent: box extent) from: canvas form at: 0@0 colorMap: (Color maskingMap: 8).
  form2 := Form extent: box extent.
  (0@0) fourNeighbors do: [:d | form1 displayOn: form2 at: d rule: Form under].
  form1 displayOn: form2 at: 0@0 rule: Form erase.
  aCanvas stencil: form2
  at: box topLeft
  sourceRect: form2 boundingBox
  color: self borderColor
  !

Item was changed:
  ----- Method: PolygonMorph>>computeBounds (in category 'private') -----
  computeBounds
  | oldBounds delta excludeHandles |
  vertices ifNil: [^ self].
 
  self changed.
  oldBounds := bounds.
  self releaseCachedState.
+ bounds := self curveBounds expanded copy.
- bounds := self curveBounds expanded.
  self arrowForms do:
+ [:f | bounds swallow: (f offset extent: f extent)].
- [:f | bounds := bounds merge: (f offset extent: f extent)].
  handles ifNotNil: [self updateHandles].
 
  "since we are directly updating bounds, see if any ordinary submorphs exist and move them accordingly"
  (oldBounds notNil and: [(delta := bounds origin - oldBounds origin) ~= (0@0)]) ifTrue: [
  excludeHandles := IdentitySet new.
  handles ifNotNil: [excludeHandles addAll: handles].
  self submorphsDo: [ :each |
  (excludeHandles includes: each) ifFalse: [
  each position: each position + delta
  ].
  ].
  ].
  self layoutChanged.
  self changed.
  !

Item was changed:
  ----- Method: TextContainer>>bounds (in category 'private') -----
  bounds
  | bounds theText |
  self fillsOwner ifFalse: [^ textMorph textBounds].
  theText := textMorph.
  bounds := theText owner innerBounds.
  bounds := bounds insetBy: (textMorph valueOfProperty: #margins ifAbsent: [1@1]).
  theText owner submorphsBehind: theText do:
+ [:m | bounds swallow: m fullBounds].
- [:m | bounds := bounds merge: m fullBounds].
  ^ bounds!