[squeak-dev] The Trunk: Balloon-ul.29.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 13 14:34:29 UTC 2017


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

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

Name: Balloon-ul.29
Author: ul
Time: 13 March 2017, 3:46:23.134314 am
UUID: dd3147a6-e291-47c3-97a1-f7032958288f
Ancestors: Balloon-nice.28

SortedCollection Whack-a-mole

=============== Diff against Balloon-nice.28 ===============

Item was changed:
  ----- Method: GradientFillStyle>>computePixelRampOfSize: (in category 'private') -----
  computePixelRampOfSize: length
  	"Compute the pixel ramp in the receiver"
  	| bits lastValue ramp lastColor lastIndex lastWord |
+ 	ramp := colorRamp sorted:[:a1 :a2| a1 key < a2 key].
- 	ramp := colorRamp asSortedCollection:[:a1 :a2| a1 key < a2 key].
  	bits := Bitmap new: length.
  	lastColor := ramp first value.
  	lastWord := lastColor pixelWordForDepth: 32.
  	lastIndex := 0.
  	ramp do:[:assoc| | nextIndex nextColor distance theta step nextWord |
  		nextIndex := (assoc key * length) rounded.
  		nextColor := assoc value.
  		nextWord := nextColor pixelWordForDepth: 32.
  		distance := (nextIndex - lastIndex).
  		distance = 0 ifTrue:[distance := 1].
  		step := 1.0 / distance asFloat.
  		theta := 0.0.
  		lastIndex+1 to: nextIndex do:[:i|
  			theta := theta + step.
  			"The following is an open-coded version of:
  				color := nextColor alphaMixed: theta with: lastColor.
  				bits at: i put: (color scaledPixelValue32).
  			"
  			bits at: i put: (self scaledAlphaMix: theta of: lastWord with: nextWord).
  		].
  		lastIndex := nextIndex.
  		lastColor := nextColor.
  		lastWord := nextWord.
  	].
  	lastValue := lastColor scaledPixelValue32.
  	lastIndex+1 to: length do:[:i| bits at: i put: lastValue].
  	^bits!

Item was changed:
  ----- Method: InterpolatedGradientFillStyle>>computePixelRampOfSize: (in category 'as yet unclassified') -----
  computePixelRampOfSize: length
  	"Compute the pixel ramp in the receiver."
  	
  	| bits ramp lastColor lastIndex lastWord |
+ 	ramp := colorRamp sorted:[:a1 :a2| a1 key < a2 key].
- 	ramp := colorRamp asSortedCollection:[:a1 :a2| a1 key < a2 key].
  	bits := Bitmap new: length.
  	lastColor := ramp first value.
  	lastWord := lastColor pixelWord32.
  	lastIndex := 0.
  	ramp do:[:assoc| | distance nextColor theta nextWord nextIndex step |
  		nextIndex := (assoc key * length) rounded.
  		nextColor := assoc value.
  		nextWord := nextColor pixelWord32.
  		distance := nextIndex - lastIndex.
  		distance = 0 ifTrue: [distance := 1].
  		step := 1.0 / distance.
  		theta := 0.0.
  		lastIndex+1 to: nextIndex do: [:i|
  			theta := theta + step.
  			bits at: i put: (self interpolatedAlphaMix: theta of: lastWord and: nextWord)].
  		lastIndex := nextIndex.
  		lastColor := nextColor.
  		lastWord := nextWord].
  	lastIndex+1 to: length do: [:i| bits at: i put: lastWord].
  	^bits!



More information about the Squeak-dev mailing list