Skip to content

vector: FillRect() with large width has wrong color #3377

@kazzmir

Description

@kazzmir

Ebitengine Version

git@f66fd7e5ee5e609c3d4f4555a78d8a3c38e1cb82 (2.10.0-alpha.10)

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

Go Version (go version)

go version go1.25.0 linux/amd64

What steps will reproduce the problem?

package main

import (
    "image/color"
    "github.com/hajimehoshi/ebiten/v2"
    "github.com/hajimehoshi/ebiten/v2/vector"
)

type Engine struct{}

func (e *Engine) Update() error {
    return nil
}

func (e *Engine) Draw(screen *ebiten.Image) {
    w := screen.Bounds().Dx()
    h := screen.Bounds().Dy()

    vector.FillRect(screen, 0, 0, float32(w), float32(h), color.NRGBA{R: 100, A: 200}, true)
}

func (e *Engine) Layout(outsideWidth, outsideHeight int) (int, int) {
    return outsideWidth, outsideHeight
}

func main() {
    ebiten.SetWindowSize(2500, 800)

    ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)

    var engine Engine
    ebiten.RunGame(&engine)
}

As you make the window wider, the problem becomes more apparent.

What is the expected result?

Screen is expected to be a single color red square.

Image

What happens instead?

When the window gets wide enough the left side of the window is the correct color (the one passed as the color to FillRect) but the right side becomes a darker color, as if FillRect() is being applied twice to the left side.

Image

Anything else you feel useful to add?

This only occurs if antialias=true in FillRect()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions