Exemple #1
0
// Removes any regions that are outside of the given viewport,
// and clips the regions that are intersecting it so that
// all regions remaining are fully contained inside of the viewport.
func (vr *ViewRegions) Cull(viewport text.Region) {
	pe := util.Prof.Enter("render.vr.Cull")
	defer pe.Exit()
	nr := []text.Region{}
	for _, r := range vr.Regions.Regions() {
		if viewport.Intersects(r) {
			in := viewport.Intersection(r)
			if in.Size() != 0 {
				nr = append(nr, in)
			}
		}
	}
	vr.Regions.Clear()
	vr.Regions.AddAll(nr)
}