mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
op/paint: add support for efficient ImageOp subimages
The new field ImageOp.Rect is initialized to cover the entire source image, but can be modified to draw only a section of it. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -30,7 +30,7 @@ func (t *Theme) Image(img paint.ImageOp) Image {
|
||||
}
|
||||
|
||||
func (im Image) Layout(gtx *layout.Context) {
|
||||
size := im.Src.Size()
|
||||
size := im.Src.Rect.Size()
|
||||
wf, hf := float32(size.X), float32(size.Y)
|
||||
w, h := gtx.Px(unit.Dp(wf*im.Scale)), gtx.Px(unit.Dp(hf*im.Scale))
|
||||
cs := gtx.Constraints
|
||||
|
||||
Reference in New Issue
Block a user