@@ -88,7 +88,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
8888 __CanvasError (" Canvas " + string (_canvas) + " is not a valid Canvas instance!" );
8989 }
9090
91- __validateContents ();
91+ __ValidateContents ();
9292 CopySurface (_canvas.GetSurfaceID (), _x, _y, _forceResize, _updateCache);
9393 return self;
9494 }
@@ -107,7 +107,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
107107 __CanvasError (" Canvas " + string (_canvas) + " is not a valid Canvas instance!" );
108108 }
109109
110- __validateContents ();
110+ __ValidateContents ();
111111 CopySurfacePart (_canvas.GetSurfaceID (), _x, _y, _xs, _ys, _ws, _hs, _forceResize, _updateCache);
112112 return self;
113113 }
@@ -225,6 +225,10 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
225225 __surface = -1 ;
226226 }
227227
228+ __refContents.buff = -1 ;
229+ __refContents.cbuff = -1 ;
230+ __refContents.surf = -1 ;
231+
228232 if (!__isAppSurf) __status = CanvasStatus.NO_DATA ;
229233 }
230234
@@ -641,7 +645,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
641645 draw_clear_alpha (_color, _alpha);
642646 surface_reset_target ();
643647
644- buffer_fill (__buffer, 0 , buffer_u8, 0 , buffer_get_size (__buffer) );
648+ __UpdateCache ( );
645649 return self;
646650 }
647651
@@ -653,7 +657,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
653657 // / @param {Real} x
654658 // / @param {Real} y
655659 static Draw = function (_x, _y) {
656- __validateContents ();
660+ __ValidateContents ();
657661 CheckSurface ();
658662 draw_surface (__surface, _x, _y);
659663 }
@@ -666,15 +670,15 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
666670 // / @param {Real} col
667671 // / @param {Real} alpha
668672 static DrawExt = function (_x, _y, _xscale, _yscale, _rot, _col, _alpha) {
669- __validateContents ();
673+ __ValidateContents ();
670674 CheckSurface ();
671675 draw_surface_ext (__surface, _x, _y, _xscale, _yscale, _rot, _col, _alpha);
672676 }
673677
674678 // / @param {Real} x
675679 // / @param {Real} y
676680 static DrawTiled = function (_x, _y) {
677- __validateContents ();
681+ __ValidateContents ();
678682 CheckSurface ();
679683 draw_surface_tiled (__surface, _x, _y);
680684 }
@@ -686,7 +690,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
686690 // / @param {Real} colour
687691 // / @param {Real} alpha
688692 static DrawTiledExt = function (_x, _y, _xscale, _yscale, _col, _alpha) {
689- __validateContents ();
693+ __ValidateContents ();
690694 CheckSurface ();
691695 draw_surface_tiled_ext (__surface, _x, _y, _xscale, _yscale, _col, _alpha);
692696 }
@@ -698,7 +702,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
698702 // / @param {Real} x
699703 // / @param {Real} y
700704 static DrawPart = function (_left, _top, _width, _height, _x, _y) {
701- __validateContents ();
705+ __ValidateContents ();
702706 CheckSurface ();
703707 draw_surface_part (__surface, _left, _top, _width, _height, _x, _y);
704708 }
@@ -714,7 +718,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
714718 // / @param {Real} colour
715719 // / @param {Real} alpha
716720 static DrawPartExt = function (_left, _top, _width, _height, _x, _y, _xscale, _yscale, _col, _alpha) {
717- __validateContents ();
721+ __ValidateContents ();
718722 CheckSurface ();
719723 draw_surface_part_ext (__surface, _left, _top, _width, _height, _x, _y, _xscale, _yscale, _col, _alpha);
720724 }
@@ -724,7 +728,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
724728 // / @param {Real} width
725729 // / @param {Real} height
726730 static DrawStretched = function (_x, _y, _width, _height) {
727- __validateContents ();
731+ __ValidateContents ();
728732 CheckSurface ();
729733 draw_surface_stretched (__surface, _x, _y, _width, _height);
730734 }
@@ -736,7 +740,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
736740 // / @param {Real} colour
737741 // / @param {Real} alpha
738742 static DrawStretchedExt = function (_x, _y, _width, _height, _col, _alpha) {
739- __validateContents ();
743+ __ValidateContents ();
740744 CheckSurface ();
741745 draw_surface_stretched_ext (__surface, _x, _y, _width, _height, _col, _alpha);
742746 }
@@ -756,7 +760,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
756760 // / @param {Real} colour4
757761 // / @param {Real} alpha
758762 static DrawGeneral = function (_left, _top, _width, _height, _x, _y, _xscale, _yscale, _rot, _col1, _col2, _col3, _col4, _alpha) {
759- __validateContents ();
763+ __ValidateContents ();
760764 CheckSurface ();
761765 draw_surface_general (__surface, _left, _top, _width, _height, _x, _y, _xscale, _yscale, _rot, _col1, _col2, _col3, _col4, _alpha);
762766 }
@@ -864,7 +868,7 @@ function Canvas(_width, _height, _forceInit = false, _format = surface_rgba8unor
864868 __status = CanvasStatus.HAS_DATA ;
865869 }
866870
867- static __validateContents = function () {
871+ static __ValidateContents = function () {
868872 if (!IsAvailable ()) {
869873 __CanvasError (" Canvas has no data or in use!" );
870874 }
0 commit comments