github.com/as/shiny@v0.8.2/driver/gldriver/buffer.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package gldriver
     6  
     7  import (
     8  	"image"
     9  
    10  	"github.com/as/shiny/screen"
    11  )
    12  
    13  type bufferImpl struct {
    14  	// buf should always be equal to (i.e. the same ptr, len, cap as) rgba.Pix.
    15  	// It is a separate, redundant field in order to detect modifications to
    16  	// the rgba field that are invalid as per the screen.Buffer documentation.
    17  	buf  []byte
    18  	rgba image.RGBA
    19  	size image.Point
    20  
    21  	t screen.Texture
    22  }
    23  
    24  func (b *bufferImpl) Release()                {}
    25  func (b *bufferImpl) Size() image.Point       { return b.size }
    26  func (b *bufferImpl) Bounds() image.Rectangle { return image.Rectangle{Max: b.size} }
    27  func (b *bufferImpl) RGBA() *image.RGBA       { return &b.rgba }