laya-coreui-es
Version:
laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改
38 lines (37 loc) • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveClipRect = void 0;
const SaveBase_1 = require("./SaveBase");
const Matrix_1 = require("../../../maths/Matrix");
const Rectangle_1 = require("../../../maths/Rectangle");
class SaveClipRect {
constructor() {
this._globalClipMatrix = new Matrix_1.Matrix();
this._clipInfoID = -1;
this._clipRect = new Rectangle_1.Rectangle();
this.incache = false;
}
isSaveMark() { return false; }
restore(context) {
this._globalClipMatrix.copyTo(context._globalClipMatrix);
this._clipRect.clone(context._clipRect);
context._clipInfoID = this._clipInfoID;
SaveClipRect.POOL[SaveClipRect.POOL._length++] = this;
context._clipInCache = this.incache;
}
static save(context) {
if ((context._saveMark._saveuse & SaveBase_1.SaveBase.TYPE_CLIPRECT) == SaveBase_1.SaveBase.TYPE_CLIPRECT)
return;
context._saveMark._saveuse |= SaveBase_1.SaveBase.TYPE_CLIPRECT;
var cache = SaveClipRect.POOL;
var o = cache._length > 0 ? cache[--cache._length] : (new SaveClipRect());
context._globalClipMatrix.copyTo(o._globalClipMatrix);
context._clipRect.clone(o._clipRect);
o._clipInfoID = context._clipInfoID;
o.incache = context._clipInCache;
var _save = context._save;
_save[_save._length++] = o;
}
}
exports.SaveClipRect = SaveClipRect;
SaveClipRect.POOL = SaveBase_1.SaveBase._createArray();