~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-11-18 15:12:26 UTC
  • mfrom: (14.2.12 vivid-proposed)
  • Revision ID: package-import@ubuntu.com-20141118151226-zug7vn93mn3dtiz3
Tags: 2:1.3.2-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - Support co-installability with gccgo-go tool:
    - d/rules,golang-go.install: Rename bin/go -> bin/golang-go
    - d/golang-go.{postinst,prerm}: Install/remove /usr/bin/go using
      alternatives.
  - d/copyright: Amendments for full compiliance with copyright format.
  - d/control: Demote golang-go.tools to Suggests to support Ubuntu MIR.
  - dropped patches (now upstream):
    - d/p/issue27650045_40001_50001.diff
    - d/p/issue28050043_60001_70001.diff
    - d/p/issue54790044_100001_110001.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        imageFields byte
80
80
 
81
81
        // From graphics control.
82
 
        transparentIndex byte
 
82
        transparentIndex    byte
 
83
        hasTransparentIndex bool
83
84
 
84
85
        // Computed.
85
86
        pixelSize      uint
175
176
                                if err != nil {
176
177
                                        return err
177
178
                                }
178
 
                                // TODO: do we set transparency in this map too? That would be
179
 
                                // d.setTransparency(m.Palette)
180
179
                        } else {
181
180
                                m.Palette = d.globalColorMap
182
181
                        }
 
182
                        if d.hasTransparentIndex && int(d.transparentIndex) < len(m.Palette) {
 
183
                                m.Palette[d.transparentIndex] = color.RGBA{}
 
184
                        }
183
185
                        litWidth, err := d.r.ReadByte()
184
186
                        if err != nil {
185
187
                                return err
228
230
 
229
231
                        d.image = append(d.image, m)
230
232
                        d.delay = append(d.delay, d.delayTime)
231
 
                        d.delayTime = 0 // TODO: is this correct, or should we hold on to the value?
 
233
                        // The GIF89a spec, Section 23 (Graphic Control Extension) says:
 
234
                        // "The scope of this extension is the first graphic rendering block
 
235
                        // to follow." We therefore reset the GCE fields to zero.
 
236
                        d.delayTime = 0
 
237
                        d.hasTransparentIndex = false
232
238
 
233
239
                case sTrailer:
234
240
                        if len(d.image) == 0 {
339
345
        d.delayTime = int(d.tmp[2]) | int(d.tmp[3])<<8
340
346
        if d.flags&gcTransparentColorSet != 0 {
341
347
                d.transparentIndex = d.tmp[4]
342
 
                d.setTransparency(d.globalColorMap)
 
348
                d.hasTransparentIndex = true
343
349
        }
344
350
        return nil
345
351
}
346
352
 
347
 
func (d *decoder) setTransparency(colorMap color.Palette) {
348
 
        if int(d.transparentIndex) < len(colorMap) {
349
 
                colorMap[d.transparentIndex] = color.RGBA{}
350
 
        }
351
 
}
352
 
 
353
353
func (d *decoder) newImageFromDescriptor() (*image.Paletted, error) {
354
354
        if _, err := io.ReadFull(d.r, d.tmp[0:9]); err != nil {
355
355
                return nil, fmt.Errorf("gif: can't read image descriptor: %s", err)