[squeak-dev] The Inbox: Graphics-nice.535.mcz

Eliot Miranda eliot.miranda at gmail.com
Fri Aug 19 22:17:11 UTC 2022


Me too, +1
Move it to trunk

_,,,^..^,,,_ (phone)

> On Aug 19, 2022, at 6:55 AM, commits at source.squeak.org wrote:
> 
> ´╗┐Nicolas Cellier uploaded a new version of Graphics to project The Inbox:
> http://source.squeak.org/inbox/Graphics-nice.535.mcz
> 
> ==================== Summary ====================
> 
> Name: Graphics-nice.535
> Author: nice
> Time: 19 August 2022, 3:55:21.336121 pm
> UUID: 51ad8137-3d54-2a4e-b30b-c30462a833ed
> Ancestors: Graphics-mt.534
> 
> Fix Color mercury (scaled components missing a range spec),
> provide an accelerated constructor for Color,
> and use it for some named colors.
> 
> Comparing these:
> 
>    {
>    [Color r: 16r04/255 g: 16r02/255 b: 16rFF/255] bench.
>    [Color r: 16r04 g: 16r02 b: 16rFF range: 255] bench.
>    }
> 
> I get near 9x acceleration on Spur64
> 
> =============== Diff against Graphics-mt.534 ===============
> 
> Item was changed:
>  ----- Method: Color class>>aluminum (in category 'named colors - crayons') -----
>  aluminum
> 
> +    ^ Color r: 153 g: 153 b: 153 range: 255!
> -    ^ Color r: 153/255 g: 153/255 b: 153/255!
> 
> Item was changed:
>  ----- Method: Color class>>aqua (in category 'named colors - crayons') -----
>  aqua
> 
> +    ^ Color r: 0 g: 128 b: 255 range: 255!
> -    ^ Color r: 0.0 g: 128/255 b: 1.0!
> 
> Item was changed:
>  ----- Method: Color class>>asparagus (in category 'named colors - crayons') -----
>  asparagus
> 
> +    ^ Color r: 128 g: 128 b: 0 range: 255!
> -    ^ Color r: 128/255 g: 128/255 b: 0.0!
> 
> Item was changed:
>  ----- Method: Color class>>banana (in category 'named colors - crayons') -----
>  banana
> 
> +    ^ Color r: 255 g: 255 b: 102 range: 255!
> -    ^ Color r: 1.0 g: 1.0 b: 102/255!
> 
> Item was changed:
>  ----- Method: Color class>>bubblegum (in category 'named colors - crayons') -----
>  bubblegum
> 
> +    ^ Color r: 255 g: 102  b: 255 range: 255!
> -    ^ Color r: 1.0 g: 102/255 b: 1.0!
> 
> Item was changed:
>  ----- Method: Color class>>carnation (in category 'named colors - crayons') -----
>  carnation
> 
> +    ^ Color r: 255 g: 111 b: 207 range: 255!
> -    ^ Color r: 1.0 g: 111/255 b: 207/255!
> 
> Item was changed:
>  ----- Method: Color class>>cayenne (in category 'named colors - crayons') -----
>  cayenne
> 
> +    ^ Color r: 128 g: 0 b: 0 range: 255!
> -    ^ Color r: 128/255 g: 0.0 b: 0.0!
> 
> Item was changed:
>  ----- Method: Color class>>clover (in category 'named colors - crayons') -----
>  clover
> 
> +    ^ Color r: 0 g: 128 b: 0 range: 255!
> -    ^ Color r: 0.0 g: 128/255 b: 0.0!
> 
> Item was changed:
>  ----- Method: Color class>>eggplant (in category 'named colors - crayons') -----
>  eggplant
> 
> +    ^ Color r: 64 g: 0 b: 128 range: 255!
> -    ^ Color r: 64/255 g: 0.0 b: 128/255!
> 
> Item was changed:
>  ----- Method: Color class>>fern (in category 'named colors - crayons') -----
>  fern
> 
> +    ^ Color r: 64 g: 128 b: 0 range: 255!
> -    ^ Color r: 64/255 g: 128/255 b: 0.0!
> 
> Item was changed:
>  ----- Method: Color class>>flora (in category 'named colors - crayons') -----
>  flora
> 
> +    ^ Color r: 102 g: 255 b: 102 range: 255!
> -    ^ Color r: 102/255 g: 1.0 b: 102/255!
> 
> Item was changed:
>  ----- Method: Color class>>grape (in category 'named colors - crayons') -----
>  grape
> 
> +    ^ Color r: 128 g: 0 b: 255 range: 255!
> -    ^ Color r: 128/255 g: 0.0 b: 1.0!
> 
> Item was changed:
>  ----- Method: Color class>>honeydew (in category 'named colors - crayons') -----
>  honeydew
> 
> +    ^ Color r: 204 g: 255 b: 102 range: 255!
> -    ^ Color r: 204/255 g: 1.0 b: 102/255!
> 
> Item was changed:
>  ----- Method: Color class>>ice (in category 'named colors - crayons') -----
>  ice
> +    ^Color r: 16r99 g: 16rFF b: 16rFF range: 255!
> - 
> -    ^ Color r: 102/255 g: 1.0 b: 1.0!
> 
> Item was changed:
>  ----- Method: Color class>>iron (in category 'named colors - crayons') -----
>  iron
> 
> +    ^ Color r: 76 g: 76 b: 76 range: 255!
> -    ^ Color r: 76/255 g: 76/255 b: 76/255!
> 
> Item was changed:
>  ----- Method: Color class>>lavender (in category 'named colors - crayons') -----
>  lavender
> 
> +    ^ Color r: 204 g: 102 b: 255 range: 255!
> -    ^ Color r: 204/255 g: 102/255 b: 1.0!
> 
> Item was changed:
>  ----- Method: Color class>>lead (in category 'named colors - crayons') -----
>  lead
> 
> +    ^ Color r: 25 g: 25 b: 25 range: 255!
> -    ^ Color r: 25/255 g: 25/255 b: 25/255!
> 
> Item was changed:
>  ----- Method: Color class>>lime (in category 'named colors - crayons') -----
>  lime
> 
> +    ^ Color r: 128 g: 255 b: 0 range: 255!
> -    ^ Color r: 128/255 g: 1.0 b: 0.0!
> 
> Item was changed:
>  ----- Method: Color class>>magnesium (in category 'named colors - crayons') -----
>  magnesium
> 
> +    ^ Color r: 179 g: 179 b: 179 range: 255!
> -    ^ Color r: 179/255 g: 179/255 b: 179/255!
> 
> Item was changed:
>  ----- Method: Color class>>maroon (in category 'named colors - crayons') -----
>  maroon
> 
> +    ^ Color r: 128 g: 0 b: 64 range: 255!
> -    ^ Color r: 128/255 g: 0.0 b: 64/255!
> 
> Item was changed:
>  ----- Method: Color class>>mercury (in category 'named colors - crayons') -----
>  mercury
> 
> +    ^ Color r: 230 g: 230 b: 230 range: 255!
> -    ^ Color r: 230.0 g: 230.0 b: 230.0!
> 
> Item was changed:
>  ----- Method: Color class>>midnight (in category 'named colors - crayons') -----
>  midnight
> 
> +    ^ Color r: 0 g: 0 b: 128 range: 255!
> -    ^ Color r: 0.0 g: 0.0 b: 128/255!
> 
> Item was changed:
>  ----- Method: Color class>>mocha (in category 'named colors - crayons') -----
>  mocha
> 
> +    ^ Color r: 128 g: 64 b: 0 range: 255!
> -    ^ Color r: 128/255 g: 64/255 b: 0.0!
> 
> Item was changed:
>  ----- Method: Color class>>moss (in category 'named colors - crayons') -----
>  moss
> 
> +    ^ Color r: 0 g: 128 b: 64 range: 255!
> -    ^ Color r: 0.0 g: 128/255 b: 64/255!
> 
> Item was changed:
>  ----- Method: Color class>>nickel (in category 'named colors - crayons') -----
>  nickel
> 
> +    ^ Color r: 128 g: 128 b: 128 range: 255!
> -    ^ Color r: 128/255 g: 128/255 b: 128/255!
> 
> Item was changed:
>  ----- Method: Color class>>ocean (in category 'named colors - crayons') -----
>  ocean
> 
> +    ^ Color r: 0 g: 64 b: 128 range: 255!
> -    ^ Color r: 0.0 g: 64/255 b: 128/255!
> 
> Item was changed:
>  ----- Method: Color class>>orchid (in category 'named colors - crayons') -----
>  orchid
> 
> +    ^ Color r: 102 g: 102 b: 255 range: 255!
> -    ^ Color r: 102/255 g: 102/255 b: 1.0!
> 
> Item was changed:
>  ----- Method: Color class>>plum (in category 'named colors - crayons') -----
>  plum
> 
> +    ^ Color r: 128 g: 0 b: 128 range: 255!
> -    ^ Color r: 128/255 g: 0.0 b: 128/255!
> 
> Item was changed:
>  ----- Method: Color class>>salmon (in category 'named colors - crayons') -----
>  salmon
> 
> +    ^ Color r: 255 g: 102 b: 102 range: 255!
> -    ^ Color r: 1.0 g: 102/255 b: 102/255!
> 
> Item was changed:
>  ----- Method: Color class>>seaFoam (in category 'named colors - crayons') -----
>  seaFoam
> 
> +    ^ Color r: 0 g: 1 b: 128 range: 255!
> -    ^ Color r: 0.0 g: 1.0 b: 128/255!
> 
> Item was changed:
>  ----- Method: Color class>>silver (in category 'named colors - crayons') -----
>  silver
> 
> +    ^ Color r: 204 g: 204 b: 204 range: 255!
> -    ^ Color r: 204/255 g: 204/255 b: 204/255!
> 
> Item was changed:
>  ----- Method: Color class>>sky (in category 'named colors - crayons') -----
>  sky
> 
> +    ^ Color r: 102 g: 204 b: 255 range: 255!
> -    ^ Color r: 102/255 g: 204/255 b: 1.0!
> 
> Item was changed:
>  ----- Method: Color class>>spindrift (in category 'named colors - crayons') -----
>  spindrift
> 
> +    ^ Color r: 102 g: 255 b: 204 range: 255!
> -    ^ Color r: 102/255 g: 1.0 b: 204/255!
> 
> Item was changed:
>  ----- Method: Color class>>steel (in category 'named colors - crayons') -----
>  steel
> 
> +    ^ Color r: 102 g: 102 b: 102 range: 255!
> -    ^ Color r: 102/255 g: 102/255 b: 102/255!
> 
> Item was changed:
>  ----- Method: Color class>>strawberry (in category 'named colors - crayons') -----
>  strawberry
> 
> +    ^ Color r: 255 g: 0 b: 128 range: 255!
> -    ^ Color r: 1.0 g: 0.0 b: 128/255!
> 
> Item was changed:
>  ----- Method: Color class>>tangerine (in category 'named colors - crayons') -----
>  tangerine
> 
> +    ^ Color r: 255 g: 128 b: 0 range: 255!
> -    ^ Color r: 1.0 g: 128/255 b: 0.0!
> 
> Item was changed:
>  ----- Method: Color class>>teal (in category 'named colors - crayons') -----
>  teal
> 
> +    ^ Color r: 0 g: 128 b: 128 range: 255!
> -    ^ Color r: 0.0 g: 128/255 b: 128/255!
> 
> Item was changed:
>  ----- Method: Color class>>tin (in category 'named colors - crayons') -----
>  tin
> 
> +    ^ Color r: 127 g: 127 b: 127 range: 255!
> -    ^ Color r: 127/255 g: 127/255 b: 127/255!
> 
> Item was changed:
>  ----- Method: Color class>>tungsten (in category 'named colors - crayons') -----
>  tungsten
> 
> +    ^ Color r: 51 g: 51 b: 51 range: 255!
> -    ^ Color r: 51/255 g: 51/255 b: 51/255!
> 
> Item was changed:
>  ----- Method: Color>>asColorref (in category 'conversions') -----
>  asColorref
> +    "Convert the receiver into a colorref
> +    See https://docs.microsoft.com/en-us/windows/win32/gdi/colorref"
> -    "Convert the receiver into a colorref"
>      ^ (self red * 255) rounded + ((self green * 255) rounded << 8) + ((self blue * 255) rounded << 16)!
> 
> Item was added:
> + ----- Method: Color>>setRed8:green8:blue8: (in category 'private') -----
> + setRed8: r green8: g blue8: b
> +    "Initialize this color's r, g, and b components to the given values in the range [0..255].
> +    Use an optimized operation rather than a slow division"
> +    
> +    "
> +    self assert: ((0 to: 255) allSatisfy: [:e | (e*1023/255) rounded = (e * 16r403 + 16r81 >> 8)]).
> +    "
> + 
> +    ComponentMax = 1023 ifFalse: [^self setRed: r / 255 green: g / 255 blue: b / 255].
> +    rgb == nil ifFalse: [self attemptToMutateError].
> +    rgb := ((r* 16r403 + 16r81 >> 8) bitShift: RedShift) 
> +        + ((g* 16r403 + 16r81 >> 8) bitShift: GreenShift) 
> +        + ((b* 16r403 + 16r81 >> 8)).
> +    cachedDepth := nil.
> +    cachedBitPattern := nil.!
> 
> Item was changed:
>  ----- Method: Color>>setRed:green:blue:range: (in category 'private') -----
>  setRed: r green: g blue: b range: range
>      "Initialize this color's r, g, and b components to the given values in the range [0..r]."
> 
> +    range = 255 ifTrue: [^self setRed8: r green8: g blue8: b].
>      ^ self setRed: r / range green: g / range blue: b / range!
> 
> 


More information about the Squeak-dev mailing list