Skip to content

x/exp/shiny: windows: win.Copy coordinates scaled unexpectedly #19902

@as

Description

@as

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8rc3 windows/amd64

What operating system and processor architecture are you using (go env)?

Microsoft Windows [Version 10.0.14393]
(The "Change the size of apps on the screen" option is set to 100%)

set GOARCH=amd64
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\g
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CGO_CFLAGS=-g -O2
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

What did you do?

Copying a texture to a window doesn't work as expected when a partial copy
of the texture is desired instead of the entire texture. The coordinates of pt
are scaled by a factor of two.

The call to below win.Copy doesn't align pt with r if r != winSize

winSize := image.Pt(1920, 1080)
win, _ := src.NewWindow(&screen.NewWindowOptions{winSize.X, winSize.Y})
tx, _ := src.NewTexture(winSize)
r := image.Rect(10, 10, 20, 20) // only recopy this part to the window
// r := winSize // works if you copy the whole texture
sp := r.Min
// Uncomment the following two statements and it works
// pt.X *= 2
// pt.Y *= 2
win.Copy(pt, tx, r, screen.Src, nil)

What did you expect to see?

Rectangle updated

What did you see instead?

Some other area updated

Full example program (needs exp/shiny)

Draws on mouse click

https://play.golang.org/p/lut2R9xBMW

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions