Commit 9555ea7a authored by Nigel Tao's avatar Nigel Tao

image/draw: add an Op argument to Draw.

R=r
CC=golang-dev
https://golang.org/cl/4622041
parent 7fd51f2f
...@@ -34,9 +34,9 @@ type Image interface { ...@@ -34,9 +34,9 @@ type Image interface {
Set(x, y int, c image.Color) Set(x, y int, c image.Color)
} }
// Draw calls DrawMask with a nil mask and an Over op. // Draw calls DrawMask with a nil mask.
func Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point) { func Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point, op Op) {
DrawMask(dst, r, src, sp, nil, image.ZP, Over) DrawMask(dst, r, src, sp, nil, image.ZP, op)
} }
// clip clips r against each image's bounds (after translating into the // clip clips r against each image's bounds (after translating into the
......
...@@ -271,7 +271,7 @@ func TestNonZeroSrcPt(t *testing.T) { ...@@ -271,7 +271,7 @@ func TestNonZeroSrcPt(t *testing.T) {
b.Set(1, 0, image.RGBAColor{0, 0, 5, 5}) b.Set(1, 0, image.RGBAColor{0, 0, 5, 5})
b.Set(0, 1, image.RGBAColor{0, 5, 0, 5}) b.Set(0, 1, image.RGBAColor{0, 5, 0, 5})
b.Set(1, 1, image.RGBAColor{5, 0, 0, 5}) b.Set(1, 1, image.RGBAColor{5, 0, 0, 5})
Draw(a, image.Rect(0, 0, 1, 1), b, image.Pt(1, 1)) Draw(a, image.Rect(0, 0, 1, 1), b, image.Pt(1, 1), Over)
if !eq(image.RGBAColor{5, 0, 0, 5}, a.At(0, 0)) { if !eq(image.RGBAColor{5, 0, 0, 5}, a.At(0, 0)) {
t.Errorf("non-zero src pt: want %v got %v", image.RGBAColor{5, 0, 0, 5}, a.At(0, 0)) t.Errorf("non-zero src pt: want %v got %v", image.RGBAColor{5, 0, 0, 5}, a.At(0, 0))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment