// Binds a WebGLRenderbuffer object to be used for rendering.
179821
func (c *Context) BindRenderbuffer(target int, renderbuffer *js.Object) {
	c.Call("bindRenderbuffer", target, renderbuffer)
}
1225603
func EGLImageTargetRenderbufferStorageOES(target uint32, image unsafe.Pointer) {
	C.glowEGLImageTargetRenderbufferStorageOES(gpEGLImageTargetRenderbufferStorageOES, (C.GLenum)(target), (C.GLeglImageOES)(image))
}
531844
func (s *Service) render() ([]byte, error) {
	if err := s.Validate(); err != nil {
		return nil, err
	}
	conf := s.Conf()
	if conf.Transient {
		conf.ExecStopPost = "rm " + s.confPath()
	}
	return Serialize(s.Name(), conf)
}
514300
func (c *Context) HTML(code int, name string, obj interface{}) {
	instance := c.engine.HTMLRender.Instance(name, obj)
	c.Render(code, instance)
}
401170
func (br BuilderRef) RenderHTML(buffer *bytes.Buffer, depth int, maxDepth int) {
	// If render the HTML as flat rather than nested, we don't need to recurse at all and should just
	// return after rendering the BuilderSummary.
	if maxDepth < 0 {
		if br.Builder != nil && br.Builder.LastFinishedBuildID != "" {
			must(fmt.Fprintf(buffer, `<a class="console-builder-status" href="%s" title="%s">`,
				template.HTMLEscapeString(br.Builder.LastFinishedBuildIDLink()),
				template.HTMLEscapeString(br.Builder.BuilderID),
			))
			must(fmt.Fprintf(buffer, `<div class="console-list-builder status-%s"></div>`,
				template.HTMLEscapeString(br.Builder.LastFinishedStatus.String()),
			))
		} else {
			must(fmt.Fprintf(buffer, `<a class="console-builder-status" href="/%s" title="%s">`,
				template.HTMLEscapeString(br.ID),
				template.HTMLEscapeString(br.ID),
			))
			must(buffer.WriteString(`<div class="console-list-builder"></div>`))
		}
		must(buffer.WriteString(`</a>`))
		return
	}

	must(buffer.WriteString(`<div class="console-builder-column">`))
	// Add spaces if we haven't hit maximum depth to keep the grid consistent.
	for i := 0; i < (maxDepth - depth); i++ {
		must(buffer.WriteString(`<div class="console-space"></div>`))
	}
	must(buffer.WriteString(`<div>`))
	var extraStatus string
	if br.Builder != nil {
		extraStatus += fmt.Sprintf("console-%s", br.Builder.LastFinishedStatus)
	}
	must(fmt.Fprintf(
		buffer, `<span class="%s"><a class="console-builder-item" href="%s" title="%s">%s</a></span>`,
		template.HTMLEscapeString(extraStatus),
		template.HTMLEscapeString(br.Builder.SelfLink()),
		template.HTMLEscapeString(br.BuilderName()),
		template.HTMLEscapeString(br.ShortName)))
	must(buffer.WriteString(`</div>`))

	must(buffer.WriteString(`<div class="console-build-column">`))

	status := "None"
	link := "#"
	class := ""

	// Below is a state machine for rendering a single builder's column.
	// In essence, the state machine takes 3 inputs: the current state, and
	// the if the next 2 builds exist. It uses this information to choose the
	// next state.
	//
	// Each iteration, the state machine writes out the state's corresponding element,
	// either a lone cell, the top of a long cell, the bottom of a long cell, the
	// middle of a long cell, or an empty space.
	//
	// The ultimate goal of this state machine is to visually extend a single
	// build down to the next known build for this builder by commit.

	// Initialize state machine state.
	//
	// Could equivalently be implemented using a "start" state, but
	// that requires a no-render special case which would make the
	// state machine less clean.
	var state int
	switch {
	case len(br.Build) == 1:
		switch {
		case br.Build[0] != nil:
			state = cell
		case br.Build[0] == nil:
			state = empty
		}
	case len(br.Build) > 1:
		switch {
		case br.Build[0] != nil && br.Build[1] != nil:
			state = cell
		case br.Build[0] != nil && br.Build[1] == nil:
			state = top
		case br.Build[0] == nil:
			state = empty
		}
	default:
		// This is probably a console preview.
	}
	// Execute state machine for determining cell type.
	for i, build := range br.Build {
		nextBuild := false
		if i < len(br.Build)-1 {
			nextBuild = br.Build[i+1] != nil
		}
		nextNextBuild := false
		if i < len(br.Build)-2 {
			nextNextBuild = br.Build[i+2] != nil
		}

		var nextState int
		switch state {
		case empty:
			class = "empty-cell"
			switch {
			case nextBuild && nextNextBuild:
				nextState = cell
			case nextBuild && !nextNextBuild:
				nextState = top
			case !nextBuild:
				nextState = empty
			}
		case top:
			class = "cell-top"
			status = build.Summary.Status.String()
			link = build.SelfLink()
			switch {
			case nextNextBuild:
				nextState = bottom
			case !nextNextBuild:
				nextState = middle
			}
		case middle:
			class = "cell-middle"
			switch {
			case nextNextBuild:
				nextState = bottom
			case !nextNextBuild:
				nextState = middle
			}
		case bottom:
			class = "cell-bottom"
			switch {
			case nextNextBuild:
				nextState = cell
			case !nextNextBuild:
				nextState = top
			}
		case cell:
			class = "cell"
			status = build.Summary.Status.String()
			link = build.SelfLink()
			switch {
			case nextNextBuild:
				nextState = cell
			case !nextNextBuild:
				nextState = top
			}
		default:
			panic("Unrecognized state")
		}
		// Write current state's information.
		must(fmt.Fprintf(buffer,
			`<div class="console-cell-container"><a class="console-%s status-%s" href="%s" title="%s">`+
				`<span class="console-cell-text">%s</span></a><div class="console-cell-spacer"></div></div>`,
			class, status, link,
			template.HTMLEscapeString(br.BuilderName()),
			br.ShortName))

		// Update state.
		state = nextState
	}
	must(buffer.WriteString(`</div></div>`))
}
1249476
func NewGLFrame(bounds pixel.Rect) *GLFrame {
	gf := new(GLFrame)
	gf.SetBounds(bounds)
	return gf
}
182946
func RenderScript(cfg cloudinit.RenderConfig, ds ...Decorator) ([]byte, error) {
	out, err := cfg.RenderScript()
	if err != nil {
		return nil, err
	}
	return applyDecorators([]byte(out), ds), nil
}
1290991
func (c *ContentSpec) getHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Renderer {
	renderParameters := blackfriday.HtmlRendererParameters{
		FootnoteAnchorPrefix:       c.footnoteAnchorPrefix,
		FootnoteReturnLinkContents: c.footnoteReturnLinkContents,
	}

	b := len(ctx.DocumentID) != 0

	if ctx.Config == nil {
		panic(fmt.Sprintf("RenderingContext of %q doesn't have a config", ctx.DocumentID))
	}

	if b && !ctx.Config.PlainIDAnchors {
		renderParameters.FootnoteAnchorPrefix = ctx.DocumentID + ":" + renderParameters.FootnoteAnchorPrefix
		renderParameters.HeaderIDSuffix = ":" + ctx.DocumentID
	}

	htmlFlags := defaultFlags
	htmlFlags |= blackfriday.HTML_USE_XHTML
	htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS

	if ctx.Config.Smartypants {
		htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
	}

	if ctx.Config.SmartypantsQuotesNBSP {
		htmlFlags |= blackfriday.HTML_SMARTYPANTS_QUOTES_NBSP
	}

	if ctx.Config.AngledQuotes {
		htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
	}

	if ctx.Config.Fractions {
		htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
	}

	if ctx.Config.HrefTargetBlank {
		htmlFlags |= blackfriday.HTML_HREF_TARGET_BLANK
	}

	if ctx.Config.NofollowLinks {
		htmlFlags |= blackfriday.HTML_NOFOLLOW_LINKS
	}

	if ctx.Config.NoreferrerLinks {
		htmlFlags |= blackfriday.HTML_NOREFERRER_LINKS
	}

	if ctx.Config.SmartDashes {
		htmlFlags |= blackfriday.HTML_SMARTYPANTS_DASHES
	}

	if ctx.Config.LatexDashes {
		htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
	}

	if ctx.Config.SkipHTML {
		htmlFlags |= blackfriday.HTML_SKIP_HTML
	}

	return &HugoHTMLRenderer{
		cs:               c,
		RenderingContext: ctx,
		Renderer:         blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters),
	}
}
645414
func (s *ServiceBroker) Bind(instanceID, bindingID string, details brokerapi.BindDetails) (brokerapi.Binding, error) {
	serviceBinding := NewServiceBinding()
	serviceBinding.SetInstanceID(instanceID)
	serviceBinding.SetBindingID(bindingID)
	serviceBinding.SetBindDetails(details)
	serviceBinding.SetActive(true)
	err := s.save(serviceBinding)
	return brokerapi.Binding{}, err
}
1149130
func (re *JSRE) Bind(name string, v interface{}) error {
	return re.Set(name, v)
}
449690
func (c *Context) FramebufferTexture2D(target, attachment, textarget int, texture *js.Object, level int) {
	c.Call("framebufferTexture2D", target, attachment, textarget, texture, level)
}
1169101
func deserialize(data []byte, renderer shell.Renderer) (common.Conf, error) {
	opts, err := unit.Deserialize(bytes.NewBuffer(data))
	if err != nil {
		return common.Conf{}, errors.Trace(err)
	}
	return deserializeOptions(opts, renderer)
}
561670
func (b *binder) Bind(ctx Context, i interface{}) (err error) {
	if ctx.Request().Method == http.MethodGet {
		err = b.unmarshal(ctx, i)
		return
	}

	if ctx.Request().ContentLength == 0 {
		return errors.New("request body is empty")
	}

	ct := ctx.ContentType()
	switch {
	case strings.HasPrefix(ct, "application/x-www-form-urlencoded"):
		return b.unmarshal(ctx, i)
	case strings.HasPrefix(ct, "multipart/form-data"):
		return b.unmarshal(ctx, i)
	case strings.HasPrefix(ct, "application/json"):
		return json.NewDecoder(ctx.Request().Body).Decode(i)
	case strings.HasPrefix(ct, "application/xml"):
		return xml.NewDecoder(ctx.Request().Body).Decode(i)
	default:
		return errors.New("unsupported content type")
	}
}
711030
func NewHTMLTemplateRendererWithProvider(writer http.ResponseWriter, provider HTMLTemplateProvider) *HTMLTemplateRenderer {
	return &HTMLTemplateRenderer{
		writer:   writer,
		provider: provider,
	}
}
1177881
func (d *Context) ToBuffer(index int) (rawPtr unsafe.Pointer, outSize uint) {
	rawPtr = C._duk_to_buffer(d.duk_context, C.duk_idx_t(index), (*C.duk_size_t)(unsafe.Pointer(&outSize)))
	return rawPtr, outSize
}
795651
func (fs *Funcs) Bind(goopts libs.SassOptions) {
	ghMu.RLock()
	cookies := make([]libs.Cookie, len(globalHandlers)+len(fs.f))
	// Append registered handlers to cookie array
	for i, h := range globalHandlers {
		cookies[i] = libs.Cookie{
			Sign: h.sign,
			Fn:   h.callback,
			Ctx:  fs.ctx,
		}
	}
	l := len(globalHandlers)
	ghMu.RUnlock()

	for i, h := range fs.f {
		cookies[i+l] = libs.Cookie{
			Sign: h.Sign,
			Fn:   h.Fn,
			Ctx:  fs.ctx,
		}
	}
	fs.idx = libs.BindFuncs(goopts, cookies)
}
672608
func (g *Generator) Render(templ string) ([]byte, error) {
	if g.loader == nil {
		g.loader = &symbols.Loader{Source: g.Starlark}
		g.links = map[string]*symbol{}
	}

	t, err := template.New("main").Funcs(g.funcMap()).Parse(templ)
	if err != nil {
		return nil, err
	}

	buf := bytes.Buffer{}
	if err := t.Execute(&buf, nil); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}