• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cshum / imagor / 15283178198

27 May 2025 06:42PM UTC coverage: 92.448% (-0.1%) from 92.545%
15283178198

push

github

cshum
vipsprocessor fallback func progress

21 of 26 new or added lines in 4 files covered. (80.77%)

3 existing lines in 2 files now uncovered.

4872 of 5270 relevant lines covered (92.45%)

1.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.07
/processor/vipsprocessor/bmp.go
1
package vipsprocessor
2

3
import (
4
        "github.com/cshum/imagor"
5
        "github.com/cshum/vipsgen/vips"
6
        "golang.org/x/image/bmp"
7
        "image"
8
        "image/draw"
9
        "io"
10
)
11

12
func loadImageFromBMP(r io.Reader) (*vips.Image, error) {
1✔
13
        img, err := bmp.Decode(r)
1✔
14
        if err != nil {
1✔
UNCOV
15
                return nil, err
×
UNCOV
16
        }
×
17
        rect := img.Bounds()
1✔
18
        size := rect.Size()
1✔
19
        rgba, ok := img.(*image.RGBA)
1✔
20
        if !ok {
2✔
21
                rgba = image.NewRGBA(rect)
1✔
22
                draw.Draw(rgba, rect, img, rect.Min, draw.Src)
1✔
23
        }
1✔
24
        return vips.NewImageFromMemory(rgba.Pix, size.X, size.Y, 4)
1✔
25
}
26
func BmpFallbackFunc(blob *imagor.Blob, _ *vips.LoadOptions) (*vips.Image, error) {
1✔
27
        if blob.BlobType() == imagor.BlobTypeBMP {
2✔
28
                // fallback with Go BMP decoder if vips error on BMP
1✔
29
                r, _, err := blob.NewReader()
1✔
30
                if err != nil {
1✔
NEW
31
                        return nil, err
×
NEW
32
                }
×
33
                defer func() {
2✔
34
                        _ = r.Close()
1✔
35
                }()
1✔
36
                return loadImageFromBMP(r)
1✔
NEW
37
        } else {
×
NEW
38
                return nil, imagor.ErrUnsupportedFormat
×
NEW
39
        }
×
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc