add a note about memory leaks to Drawer and Sprite docs
This commit is contained in:
parent
bdbce3a27b
commit
e8aa765ed3
|
@ -15,6 +15,11 @@ package pixel
|
||||||
//
|
//
|
||||||
// Whenever you change the Triangles, call Dirty to notify Drawer that Triangles changed. You don't
|
// Whenever you change the Triangles, call Dirty to notify Drawer that Triangles changed. You don't
|
||||||
// need to notify Drawer about a change of the Picture.
|
// need to notify Drawer about a change of the Picture.
|
||||||
|
//
|
||||||
|
// Note, that Drawer caches the results of MakePicture from Targets it's drawn to for each Picture
|
||||||
|
// it's set to. What it means is that using a Drawer with an unbounded number of Pictures leads to a
|
||||||
|
// memory leak, since Drawer caches them and never forgets. In such a situation, create a new Drawer
|
||||||
|
// for each Picture.
|
||||||
type Drawer struct {
|
type Drawer struct {
|
||||||
Triangles Triangles
|
Triangles Triangles
|
||||||
Picture Picture
|
Picture Picture
|
||||||
|
|
|
@ -11,6 +11,11 @@ import "image/color"
|
||||||
//
|
//
|
||||||
// To achieve different anchoring, transformations and color masking, use SetMatrix and SetColorMask
|
// To achieve different anchoring, transformations and color masking, use SetMatrix and SetColorMask
|
||||||
// methods.
|
// methods.
|
||||||
|
//
|
||||||
|
// Note, that Sprite caches the results of MakePicture from Targets it's drawn to for each Picture
|
||||||
|
// it's set to. What it means is that using a Sprite with an unbounded number of Pictures leads to a
|
||||||
|
// memory leak, since Sprite caches them and never forgets. In such a situation, create a new Sprite
|
||||||
|
// for each Picture.
|
||||||
type Sprite struct {
|
type Sprite struct {
|
||||||
tri *TrianglesData
|
tri *TrianglesData
|
||||||
frame Rect
|
frame Rect
|
||||||
|
|
Loading…
Reference in New Issue