[squeak-dev] The Trunk: Graphics-ul.152.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Nov 2 02:13:22 UTC 2010


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

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

Name: Graphics-ul.152
Author: ul
Time: 2 November 2010, 3:12:47.835 am
UUID: f2a5386f-5f44-5f45-a35c-1dab7538fb00
Ancestors: Graphics-dtl.151

- use paragma declarations for #inline: and #var:declareC:

=============== Diff against Graphics-dtl.151 ===============

Item was changed:
  ----- Method: WarpBlt>>rgbMap:from:to: (in category 'smoothing') -----
  rgbMap: sourcePixel from: nBitsIn to: nBitsOut
  	"NOTE: This code is copied verbatim from BitBltSimulation so that it
  	may be removed from the system"
  	"Convert the given pixel value with nBitsIn bits for each color component to a pixel value with nBitsOut bits for each color component. Typical values for nBitsIn/nBitsOut are 3, 5, or 8."
  	| mask d srcPix destPix |
+ 	<inline: true>
- 	self inline: true.
  	(d := nBitsOut - nBitsIn) > 0
  		ifTrue:
  			["Expand to more bits by zero-fill"
  			mask := (1 << nBitsIn) - 1.  "Transfer mask"
  			srcPix := sourcePixel << d.
  			mask := mask << d.
  			destPix := srcPix bitAnd: mask.
  			mask := mask << nBitsOut.
  			srcPix := srcPix << d.
  			^ destPix + (srcPix bitAnd: mask)
  				 	+ (srcPix << d bitAnd: mask << nBitsOut)]
  		ifFalse:
  			["Compress to fewer bits by truncation"
  			d = 0 ifTrue: [^ sourcePixel].  "no compression"
  			sourcePixel = 0 ifTrue: [^ sourcePixel].  "always map 0 (transparent) to 0"
  			d := nBitsIn - nBitsOut.
  			mask := (1 << nBitsOut) - 1.  "Transfer mask"
  			srcPix := sourcePixel >> d.
  			destPix := srcPix bitAnd: mask.
  			mask := mask << nBitsOut.
  			srcPix := srcPix >> d.
  			destPix := destPix + (srcPix bitAnd: mask)
  					+ (srcPix >> d bitAnd: mask << nBitsOut).
  			destPix = 0 ifTrue: [^ 1].  "Dont fall into transparent by truncation"
  			^ destPix]!




More information about the Squeak-dev mailing list