]> Cypherpunks repositories - gostls13.git/commitdiff
drawGlyphOver optimization.
authorNigel Tao <nigeltao@golang.org>
Tue, 11 May 2010 03:35:16 +0000 (13:35 +1000)
committerNigel Tao <nigeltao@golang.org>
Tue, 11 May 2010 03:35:16 +0000 (13:35 +1000)
Timings (as for change 1122043) go from 49ms to 48ms ish. It's
mostly lost in the noise, but it probably doesn't hurt.

R=r
CC=golang-dev
https://golang.org/cl/1179041

src/pkg/exp/draw/draw.go

index 0589dde5ef08c5eda4aa9c6ffd3c9d26b7834585..dcafc893449ec297ee57a709b65b65c6fb36465a 100644 (file)
@@ -167,10 +167,11 @@ func drawGlyphOver(dst *image.RGBA, r Rectangle, src image.ColorImage, mask *ima
                                continue
                        }
                        ma |= ma << 8
-                       dr := uint32(dst.Pixel[y][x].R)
-                       dg := uint32(dst.Pixel[y][x].G)
-                       db := uint32(dst.Pixel[y][x].B)
-                       da := uint32(dst.Pixel[y][x].A)
+                       rgba := dst.Pixel[y][x]
+                       dr := uint32(rgba.R)
+                       dg := uint32(rgba.G)
+                       db := uint32(rgba.B)
+                       da := uint32(rgba.A)
                        // dr, dg, db and da are all 8-bit color at the moment, ranging in [0,255].
                        // We work in 16-bit color, and so would normally do:
                        // dr |= dr << 8