mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 16:35:36 +00:00
gpu/headless: make Screenshot take an input image to tranfer into
When extracting headless.Window's content via screenshots, it can be useful to keep reusing the same image for output, as well as specify which area of the Window is to be extracted. The updated Screenshot method does this by using the supplied image. API change: users must pass an existing image to Window.Screenshot. Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
@@ -47,7 +47,8 @@ func resetOps(gtx layout.Context) {
|
||||
func finishBenchmark(b *testing.B, w *headless.Window) {
|
||||
b.StopTimer()
|
||||
if *dumpImages {
|
||||
img, err := w.Screenshot()
|
||||
img := image.NewRGBA(image.Rectangle{Max: w.Size()})
|
||||
err := w.Screenshot(img)
|
||||
w.Release()
|
||||
if err != nil {
|
||||
b.Error(err)
|
||||
|
||||
Reference in New Issue
Block a user