Skip to content

Commit

Permalink
Added optional argument for updating the cache on .Clear()
Browse files Browse the repository at this point in the history
  • Loading branch information
tabularelf committed Jun 27, 2024
1 parent 5162214 commit 56255e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/Canvas/Canvas.gml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function Canvas(_width, _height, _forceInit = false, _format = undefined) constr
}

/// @param {Function, Undefined} callback
static SetCallbackUpdated = function(_callback) {
static SetCallbackSurfaceUpdated = function(_callback) {
__CallbackCanvasSurfaceUpdated = _callback;
return self;
}
Expand Down Expand Up @@ -692,15 +692,15 @@ function Canvas(_width, _height, _forceInit = false, _format = undefined) constr
return [_r, _g, _b, _a];
}

static Clear = function(_color = c_black, _alpha = 0) {
static Clear = function(_color = c_black, _alpha = 0, _updateCache = true) {
__Init();
CheckSurface();

surface_set_target(__surface);
draw_clear_alpha(_color, _alpha);
surface_reset_target();

__UpdateCache();
if(_updateCache) __UpdateCache();
return self;
}

Expand Down

0 comments on commit 56255e6

Please sign in to comment.