Skip to content

Commit

Permalink
free image
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Feb 10, 2024
1 parent dd07500 commit 8509c6a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/hx/widgets/Image.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class ImageData {
_height = image.height;
}

public function setRGB(x:Int, y:Int, r:Int, g:Int, b:Int) {
public inline function setRGB(x:Int, y:Int, r:Int, g:Int, b:Int) {
var offset = (x + _width * y) * 3;
_data[offset + 0] = r;
_data[offset + 1] = g;
_data[offset + 2] = b;
}

public function setRGBA(x:Int, y:Int, r:Int, g:Int, b:Int, a:Int) {
public inline function setRGBA(x:Int, y:Int, r:Int, g:Int, b:Int, a:Int) {
var offset = (x + _width * y) * 3;
_data[offset + 0] = r;
_data[offset + 1] = g;
Expand Down Expand Up @@ -117,6 +117,11 @@ class Image extends Object {
}
}

public override function destroy():Bool {
imageRef.ptr.destroy();
return super.destroy();
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Instance functions
//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 8509c6a

Please sign in to comment.