[squeak-dev] The Trunk: Graphics-kfr.528.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Aug 10 08:16:05 UTC 2022


Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-kfr.528.mcz

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

Name: Graphics-kfr.528
Author: kfr
Time: 8 July 2022, 8:58:09.715763 am
UUID: 40dbdaff-40b8-544a-8136-c4bc907174ad
Ancestors: Graphics-kfr.527

Color>>at: is slow. Speed up by using variable

=============== Diff against Graphics-kfr.527 ===============

Item was changed:
  ----- Method: Form>>processUsingKernel:factor:bias: (in category 'processing') -----
  processUsingKernel: filter factor: factor bias: bias
+ 	| image result color |
- 	| image result |
  
  	image := self.
  	result := Form extent: image extent depth: image depth.
  
  	0 to: image height - 1 do: [:y |
  		0 to: image width - 1 do: [:x |
  			| r g b |
  			r := g := b := 0.0.
  
  			0 to: filter rowCount - 1 do: [:filterY |
  				0 to: filter columnCount - 1 do: [:filterX |
  					| imageX imageY |
  					imageX := (x - (filter columnCount // 2) + filterX + image width) \\
  								image width.
  					imageY := (y - (filter rowCount // 2) + filterY + image height) \\
  								image height.
+ 					color := image colorAt: imageX at imageY.
+ 					r := r + (color red *
- 					r := r + ((image colorAt: imageX at imageY) red *
  								(filter at: filterY + 1 at: filterX + 1)).
+ 					g := g + (color green *
- 					g := g + ((image colorAt: imageX at imageY) green *
  								(filter at: filterY + 1 at: filterX + 1)).
+ 					b := b + (color blue *
- 					b := b + ((image colorAt: imageX at imageY) blue *
  								(filter at: filterY + 1 at: filterX + 1))]].
  
  			result colorAt: x at y put: (Color
  				r: ((factor * r + bias) min: 1.0 max: 0.0)
  				g: ((factor * g + bias) min: 1.0 max: 0.0)
  				b: ((factor * b + bias) min: 1.0 max: 0.0))]].
  	^ result
  !



More information about the Squeak-dev mailing list