diff --git a/app/headless/headless.go b/app/headless/headless.go index f9903e4f..f891e947 100644 --- a/app/headless/headless.go +++ b/app/headless/headless.go @@ -116,12 +116,15 @@ func (w *Window) Frame(frame *op.Ops) { // Screenshot returns an image with the content of the window. func (w *Window) Screenshot() (*image.RGBA, error) { img := image.NewRGBA(image.Rectangle{Max: w.size}) - contextDo(w.ctx, func() error { + err := contextDo(w.ctx, func() error { return w.fbo.ReadPixels( image.Rectangle{ Max: image.Point{X: w.size.X, Y: w.size.Y}, }, img.Pix) }) + if err != nil { + return nil, err + } // Flip image in y-direction. OpenGL's origin is in the lower // left corner. row := make([]uint8, img.Stride)