// Extend extends b to include geometry g.
540560
func (b *Bounds) Extend(g T) *Bounds {
	b.extendLayout(g.Layout())
	if b.layout == XYZM && g.Layout() == XYM {
		return b.extendXYZMFlatCoordsWithXYM(g.FlatCoords(), 0, len(g.FlatCoords()))
	}
	return b.extendFlatCoords(g.FlatCoords(), 0, len(g.FlatCoords()), g.Stride())
}
1335480
func (t *Point) AddGeometry(g interface{}) error {
	if c, ok := g.(Coordinate); ok {
		t.Coordinates = c
	} else {
		return fmt.Errorf("AssertionError: %v to %v", g, "Coordinate")
	}
	return nil
}
464169
func (err ErrNo) Extend(by int) ErrNoExtended {
	return ErrNoExtended(int(err) | (by << 8))
}
604285
func newGeometry(input interface{}) interface{} {
	var (
		result      interface{}
		coordinates interface{}
	)
	switch it := input.(type) {
	case map[string]interface{}:
		if _, ok := it[COORDINATES]; ok {
			coordinates = interfaceToArray(it[COORDINATES])
		}
		iType := it[TYPE].(string)
		switch iType {
		case POINT:
			result = NewPoint(coordinates.([]float64))
		case LINESTRING:
			result = NewLineString(coordinates.([][]float64))
		case POLYGON:
			result = NewPolygon(coordinates.([][][]float64))
		case MULTIPOINT:
			result = NewMultiPoint(coordinates.([][]float64))
		case MULTILINESTRING:
			result = NewMultiLineString(coordinates.([][][]float64))
		case MULTIPOLYGON:
			result = NewMultiPolygon(coordinates.([][][][]float64))
		case GEOMETRYCOLLECTION:
			geometries := it["geometries"].([]interface{})
			for inx, geometry := range geometries {
				geometries[inx] = newGeometry(geometry)
			}
			result = NewGeometryCollection(geometries)
		}
	case *Point, *LineString, *Polygon, *MultiPoint, *MultiLineString, *MultiPolygon, *GeometryCollection:
		result = it
	}
	return result
}
1277690
func extend(b []byte, n int) (overall, trailer []byte) {
	want := n + len(b)
	if want <= cap(b) {
		overall = b[:want]
		trailer = overall[len(b):]
		for i := range trailer {
			trailer[i] = 0
		}
	} else {
		// Grow the capacity exponentially, with a 1KiB minimum.
		c := 1024
		for c < want {
			c += c / 4
		}
		overall = make([]byte, want, c)
		trailer = overall[len(b):]
		copy(overall, b)
	}
	return overall, trailer
}
1272534
func (e *G1) Add(a, b *G1) *G1 {
	if e.p == nil {
		e.p = &curvePoint{}
	}
	e.p.Add(a.p, b.p)
	return e
}
1656
func (w *Window) Geometry() (xrect.Rect, error) {
	geom, err := RawGeometry(w.X, xproto.Drawable(w.Id))
	if err != nil {
		return nil, err
	}
	w.Geom = geom
	return geom, err
}
291423
func (pattern *Pattern) GetExtend() Extend {
	ret := Extend(C.cairo_pattern_get_extend(pattern.Ptr))
	if err := pattern.status(); err != nil {
		panic(err)
	}
	return ret
}
894627
func (p *Params) AddExpand(f string) {
	p.Expand = append(p.Expand, &f)
}
505192
func (g *Geometry) Normalize() error {
	_, err := intFromC("Normalize", cGEOSNormalize(g.g), -1)
	return err
}
939403
func Clone(g Geometry) Geometry {
	if g == nil {
		return nil
	}

	switch g := g.(type) {
	case Point:
		return g
	case MultiPoint:
		if g == nil {
			return nil
		}
		return g.Clone()
	case LineString:
		if g == nil {
			return nil
		}
		return g.Clone()
	case MultiLineString:
		if g == nil {
			return nil
		}
		return g.Clone()
	case Ring:
		if g == nil {
			return nil
		}
		return g.Clone()
	case Polygon:
		if g == nil {
			return nil
		}
		return g.Clone()
	case MultiPolygon:
		if g == nil {
			return nil
		}
		return g.Clone()
	case Collection:
		if g == nil {
			return nil
		}
		return g.Clone()
	case Bound:
		return g
	}

	panic(fmt.Sprintf("geometry type not supported: %T", g))
}
307346
func (c *Capabilities) addExtension(r io.Reader) error {
	var buf bytes.Buffer
	encoder := base64.NewEncoder(base64.StdEncoding, &buf)
	if _, err := io.Copy(encoder, bufio.NewReader(r)); err != nil {
		return err
	}
	encoder.Close()
	c.Extensions = append(c.Extensions, buf.String())
	return nil
}
287883
func (ch *channel) Extended(code uint32) io.ReadWriter {
	if !ch.decided {
		return nil
	}
	return &extChannel{code, ch}
}
558512
func (h Handle) Extensions() (extensions []HandleExtension) {
	if h.ConflictInfo != nil {
		extensions = append(extensions, *h.ConflictInfo)
	}
	if h.FinalizedInfo != nil {
		extensions = append(extensions, *h.FinalizedInfo)
	}
	return extensions
}
117857
func (c *Cursor) extend(response *Response) {
	c.mu.Lock()
	defer c.mu.Unlock()

	c.extendLocked(response)
}
1196547
func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
	return extensionMaps[reflect.TypeOf(pb).Elem()]
}
751036
func (s *Bitset) extend(index uint) {
	if index >= s.Length(0) {
		s.Length(index + 1)
	}
}