diff options
Diffstat (limited to 'libgo/go/image/ycbcr/ycbcr.go')
-rw-r--r-- | libgo/go/image/ycbcr/ycbcr.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libgo/go/image/ycbcr/ycbcr.go b/libgo/go/image/ycbcr/ycbcr.go index cda45996df0..f2de3d6fbc5 100644 --- a/libgo/go/image/ycbcr/ycbcr.go +++ b/libgo/go/image/ycbcr/ycbcr.go @@ -142,7 +142,7 @@ func (p *YCbCr) Bounds() image.Rectangle { } func (p *YCbCr) At(x, y int) image.Color { - if !p.Rect.Contains(image.Point{x, y}) { + if !(image.Point{x, y}.In(p.Rect)) { return YCbCrColor{} } switch p.SubsampleRatio { @@ -169,6 +169,15 @@ func (p *YCbCr) At(x, y int) image.Color { } } +// SubImage returns an image representing the portion of the image p visible +// through r. The returned value shares pixels with the original image. +func (p *YCbCr) SubImage(r image.Rectangle) image.Image { + q := new(YCbCr) + *q = *p + q.Rect = q.Rect.Intersect(r) + return q +} + func (p *YCbCr) Opaque() bool { return true } |