mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45: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:
+6
-13
@@ -130,7 +130,6 @@ type clipOp struct {
|
||||
|
||||
// imageOpData is the shadow of paint.ImageOp.
|
||||
type imageOpData struct {
|
||||
rect image.Rectangle
|
||||
src *image.RGBA
|
||||
handle interface{}
|
||||
}
|
||||
@@ -170,18 +169,7 @@ func decodeImageOp(data []byte, refs []interface{}) imageOpData {
|
||||
if handle == nil {
|
||||
return imageOpData{}
|
||||
}
|
||||
bo := binary.LittleEndian
|
||||
return imageOpData{
|
||||
rect: image.Rectangle{
|
||||
Min: image.Point{
|
||||
X: int(int32(bo.Uint32(data[1:]))),
|
||||
Y: int(int32(bo.Uint32(data[5:]))),
|
||||
},
|
||||
Max: image.Point{
|
||||
X: int(int32(bo.Uint32(data[9:]))),
|
||||
Y: int(int32(bo.Uint32(data[13:]))),
|
||||
},
|
||||
},
|
||||
src: refs[0].(*image.RGBA),
|
||||
handle: handle,
|
||||
}
|
||||
@@ -962,7 +950,12 @@ func (d *drawState) materialFor(cache *resourceCache, rect f32.Rectangle, off f3
|
||||
m.material = materialTexture
|
||||
dr := boundRectF(rect.Add(off))
|
||||
sz := d.image.src.Bounds().Size()
|
||||
sr := layout.FRect(d.image.rect)
|
||||
sr := f32.Rectangle{
|
||||
Max: f32.Point{
|
||||
X: float32(sz.X),
|
||||
Y: float32(sz.Y),
|
||||
},
|
||||
}
|
||||
if dx := float32(dr.Dx()); dx != 0 {
|
||||
// Don't clip 1 px width sources.
|
||||
if sdx := sr.Dx(); sdx > 1 {
|
||||
|
||||
Reference in New Issue
Block a user