@@ -21,37 +21,35 @@ const (
2121//
2222// For example, a standard RGBA pixel would look like this:
2323//
24- // | bit 31 bit 0 |
25- // | |
26- // pixel: rrrrrrrrggggggggbbbbbbbbaaaaaaaa
24+ // | bit 31 bit 0 |
25+ // | |
26+ // pixel: rrrrrrrrggggggggbbbbbbbbaaaaaaaa
2727//
2828// The PixelFormat for this looks as follows:
2929//
30- // red bits: 8
31- // red shift: 24
30+ // red bits: 8
31+ // red shift: 24
3232//
33- // green bits: 8
34- // green shift: 16
33+ // green bits: 8
34+ // green shift: 16
3535//
36- // blue bits: 8
37- // blue shift: 8
38- //
39- // alpha bits: 8
40- // alpha shift: 0
36+ // blue bits: 8
37+ // blue shift: 8
4138//
39+ // alpha bits: 8
40+ // alpha shift: 0
4241//
4342// We can extract the channel information as follows:
4443//
45- // red_mask := (1 << red_bits) - 1
46- // green_mask := (1 << green_bits) - 1
47- // blue_mask := (1 << blue_bits) - 1
48- // alpha_mask := (1 << alpha_bits) - 1
49- //
50- // r := (pixel >> red_shift) & red_mask
51- // g := (pixel >> green_shift) & green_mask
52- // b := (pixel >> blue_shift) & blue_mask
53- // a := (pixel >> alpha_shift) & alpha_mask
44+ // red_mask := (1 << red_bits) - 1
45+ // green_mask := (1 << green_bits) - 1
46+ // blue_mask := (1 << blue_bits) - 1
47+ // alpha_mask := (1 << alpha_bits) - 1
5448//
49+ // r := (pixel >> red_shift) & red_mask
50+ // g := (pixel >> green_shift) & green_mask
51+ // b := (pixel >> blue_shift) & blue_mask
52+ // a := (pixel >> alpha_shift) & alpha_mask
5553type PixelFormat struct {
5654 Depth uint8 // Total bit count for each pixel.
5755 RedBits uint8 // Bit count for the red channel.
@@ -66,7 +64,7 @@ type PixelFormat struct {
6664
6765// Stride returns the width, in bytes, for a single pixel.
6866func (p PixelFormat ) Stride () int {
69- return ( p .Depth + 7 ) / 8
67+ return int (( p .Depth + 7 ) / 8 )
7068}
7169
7270// Type returns an integer constant from the PF_XXX list, which
0 commit comments