diff --git a/gpu/gpu.go b/gpu/gpu.go index d8cc63a8..ea5a6b02 100644 --- a/gpu/gpu.go +++ b/gpu/gpu.go @@ -867,7 +867,7 @@ func (r *renderer) drawLayers(layers []opacityLayer, ops []imageOp) { Min: l.place.Pos, Max: l.place.Pos.Add(l.clip.Size()), } - r.ctx.Viewport(v.Min.X, v.Min.Y, v.Max.X, v.Max.Y) + r.ctx.Viewport(v.Min.X, v.Min.Y, v.Dx(), v.Dy()) f := r.layerFBOs.fbos[fbo] r.drawOps(true, l.clip.Min.Mul(-1), l.clip.Size(), ops[l.opStart:l.opEnd]) sr := f32.FRect(v) @@ -1232,7 +1232,7 @@ func (r *renderer) prepareDrawOps(ops []imageOp) { } } -func (r *renderer) drawOps(isFBO bool, opOff image.Point, viewport image.Point, ops []imageOp) { +func (r *renderer) drawOps(isFBO bool, opOff, viewport image.Point, ops []imageOp) { var coverTex driver.Texture for i := 0; i < len(ops); i++ { img := ops[i] diff --git a/gpu/internal/rendertest/refs/TestOpacity.png b/gpu/internal/rendertest/refs/TestOpacity.png index 7ddf84ea..c7f7d5af 100644 Binary files a/gpu/internal/rendertest/refs/TestOpacity.png and b/gpu/internal/rendertest/refs/TestOpacity.png differ diff --git a/gpu/internal/rendertest/render_test.go b/gpu/internal/rendertest/render_test.go index fc5c7fa8..41478319 100644 --- a/gpu/internal/rendertest/render_test.go +++ b/gpu/internal/rendertest/render_test.go @@ -483,14 +483,14 @@ func TestGapsInPath(t *testing.T) { func TestOpacity(t *testing.T) { run(t, func(ops *op.Ops) { opc1 := paint.PushOpacity(ops, .3) - // Fill screen to exercize the glClear optimization. + // Fill screen to exercise the glClear optimization. paint.FillShape(ops, color.NRGBA{R: 255, A: 255}, clip.Rect{Max: image.Pt(1024, 1024)}.Op()) opc2 := paint.PushOpacity(ops, .6) paint.FillShape(ops, color.NRGBA{G: 255, A: 255}, clip.Rect{Min: image.Pt(20, 10), Max: image.Pt(64, 128)}.Op()) opc2.Pop() opc1.Pop() opc3 := paint.PushOpacity(ops, .6) - paint.FillShape(ops, color.NRGBA{G: 255, A: 255}, clip.Rect{Min: image.Pt(50+20, 10), Max: image.Pt(50+64, 128)}.Op()) + paint.FillShape(ops, color.NRGBA{B: 255, A: 255}, clip.Ellipse(image.Rectangle{Min: image.Pt(20+20, 10), Max: image.Pt(50+64, 128)}).Op(ops)) opc3.Pop() }, func(r result) { })