mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 16:59:27 +08:00
This commit is contained in:
1 parent
619899e297
commit
e8344e6387
27 files changed
+754
-150
No files matched your search
@@ -214,5 +214,14 @@ func clipGeometry(geometry GeometryBackend, path GeometryPath, clip *GeometryPat
|
||||
return path, nil
|
||||
}
|
||||
}
|
||||
if rect, ok := geometryRectangleBounds(path); ok {
|
||||
bounds, err := geometry.Bounds(*clip)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if bounds.X >= rect.X && bounds.Y >= rect.Y && bounds.X+bounds.W <= rect.X+rect.W && bounds.Y+bounds.H <= rect.Y+rect.H {
|
||||
return *clip, nil
|
||||
}
|
||||
}
|
||||
return geometry.Combine(path, *clip, GeometryIntersect)
|
||||
}
|
||||
Reference in new issue
Block a user