mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
gpu,widget,op/paint,gpu: remove support for ImageOp.Rect
This is effectively a revert of commit gioui.org/commit/69dfd2e3a5541. ImageOp.Rect is the wrong abstraction; it implies a clipping operation that is better handled by package clip. API change. Uses of ImageOp.Rect should apply a clip.Rect before the PaintOp, or use image.RGBA.SubImage (or similar). Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -20,9 +20,6 @@ import (
|
||||
// Note: the ImageOp may keep a reference to the backing image.
|
||||
// See NewImageOp for details.
|
||||
type ImageOp struct {
|
||||
// Rect is the section if the backing image to use.
|
||||
Rect image.Rectangle
|
||||
|
||||
uniform bool
|
||||
color color.RGBA
|
||||
src *image.RGBA
|
||||
@@ -74,7 +71,6 @@ func NewImageOp(src image.Image) ImageOp {
|
||||
bounds := src.Bounds()
|
||||
if bounds.Min == (image.Point{}) && src.Stride == bounds.Dx()*4 {
|
||||
return ImageOp{
|
||||
Rect: src.Bounds(),
|
||||
src: src,
|
||||
handle: new(int),
|
||||
}
|
||||
@@ -88,7 +84,6 @@ func NewImageOp(src image.Image) ImageOp {
|
||||
})
|
||||
draw.Draw(dst, dst.Bounds(), src, src.Bounds().Min, draw.Src)
|
||||
return ImageOp{
|
||||
Rect: dst.Bounds(),
|
||||
src: dst,
|
||||
handle: new(int),
|
||||
}
|
||||
@@ -110,11 +105,6 @@ func (i ImageOp) Add(o *op.Ops) {
|
||||
}
|
||||
data := o.Write(opconst.TypeImageLen, i.src, i.handle)
|
||||
data[0] = byte(opconst.TypeImage)
|
||||
bo := binary.LittleEndian
|
||||
bo.PutUint32(data[1:], uint32(i.Rect.Min.X))
|
||||
bo.PutUint32(data[5:], uint32(i.Rect.Min.Y))
|
||||
bo.PutUint32(data[9:], uint32(i.Rect.Max.X))
|
||||
bo.PutUint32(data[13:], uint32(i.Rect.Max.Y))
|
||||
}
|
||||
|
||||
func (c ColorOp) Add(o *op.Ops) {
|
||||
|
||||
Reference in New Issue
Block a user