[squeak-dev] The Inbox: Morphic-cmm.442.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jun 14 03:20:01 UTC 2010

A new version of Morphic was added to project The Inbox:

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

Name: Morphic-cmm.442
Author: cmm
Time: 13 June 2010, 10:18:51.107 pm
UUID: 7259de55-ebf2-47b2-b236-57ee0da11b3c
Ancestors: Morphic-cmm.441

Preserve translucency when rotating a Morph on 32-bit deep displays.

=============== Diff against Morphic-cmm.441 ===============

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 rule|
- 	| 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.
  	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].
+ 	"If my depth has alpha, do blending rather than paint"
+ 	rule := self depth = 32 ifTrue: [Form blend] ifFalse: [Form paint].
  	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: rule].
- 					warp combinationRule: Form paint].
  		subCanvas translateBy: patchRect topLeft negated
  			during:[:offsetCanvas| aBlock value: offsetCanvas].
  		warp sourceForm: subCanvas form; warpBits.
  		warp sourceForm: nil.  subCanvas := nil "release space for next loop"]

More information about the Squeak-dev mailing list