~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/image/image.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
548
548
        return &Gray16{pix, w, Rectangle{ZP, Point{w, h}}}
549
549
}
550
550
 
551
 
// A PalettedColorModel represents a fixed palette of colors.
 
551
// A PalettedColorModel represents a fixed palette of at most 256 colors.
552
552
type PalettedColorModel []Color
553
553
 
554
554
func diff(a, b uint32) uint32 {
648
648
 
649
649
// Opaque scans the entire image and returns whether or not it is fully opaque.
650
650
func (p *Paletted) Opaque() bool {
651
 
        for _, c := range p.Palette {
 
651
        var present [256]bool
 
652
        base := p.Rect.Min.Y * p.Stride
 
653
        i0, i1 := base+p.Rect.Min.X, base+p.Rect.Max.X
 
654
        for y := p.Rect.Min.Y; y < p.Rect.Max.Y; y++ {
 
655
                for _, c := range p.Pix[i0:i1] {
 
656
                        present[c] = true
 
657
                }
 
658
                i0 += p.Stride
 
659
                i1 += p.Stride
 
660
        }
 
661
        for i, c := range p.Palette {
 
662
                if !present[i] {
 
663
                        continue
 
664
                }
652
665
                _, _, _, a := c.RGBA()
653
666
                if a != 0xffff {
654
667
                        return false