[squeak-dev] The Trunk: Graphics-ar.72.mcz

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

[squeak-dev] The Trunk: Graphics-ar.72.mcz

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

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

Name: Graphics-ar.72
Author: ar
Time: 1 September 2009, 12:53:21 pm
UUID: 14e87ecf-9c28-964d-bcd8-714e83692432
Ancestors: Graphics-ar.71

http://bugs.squeak.org/view.php?id=6936

#asHTMLColor is inaccurate for certain values.

Attached fix resolves that, also gives 10x speed-up.

=============== Diff against Graphics-ar.71 ===============

Item was changed:
  ----- Method: Color>>asHTMLColor (in category 'conversions') -----
  asHTMLColor
+ | s |
+ s := '#000000' copy.
+ s at: 2 put: (Character digitValue: ((rgb bitShift: -6 - RedShift) bitAnd: 15)).
+ s at: 3 put: (Character digitValue: ((rgb bitShift: -2 - RedShift) bitAnd: 15)).
+ s at: 4 put: (Character digitValue: ((rgb bitShift: -6 - GreenShift) bitAnd: 15)).
+ s at: 5 put: (Character digitValue: ((rgb bitShift: -2 - GreenShift) bitAnd: 15)).
+ s at: 6 put: (Character digitValue: ((rgb bitShift: -6 - BlueShift) bitAnd: 15)).
+ s at: 7 put: (Character digitValue: ((rgb bitShift: -2 - BlueShift) bitAnd: 15)).
+ ^ s!
- ^ '#', (self class hex: self red), (self class hex: self green), (self class hex: self blue)!

Item was removed:
- ----- Method: Color class>>hex: (in category 'other') -----
- hex: aFloat
- "Return an hexadecimal two-digits string between 00 and FF
- for a float between 0.0 and 1.0"
- | str |
- str := ((aFloat * 255) asInteger printStringHex) asLowercase.
- str size = 1 ifTrue: [^'0',str] ifFalse: [^str]!