UNPKG

laya-coreui-es

Version:

laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改

27 lines (26 loc) 796 B
import { Pool } from "../../utils/Pool"; export class DrawImageCmd { static create(texture, x, y, width, height) { var cmd = Pool.getItemByClass("DrawImageCmd", DrawImageCmd); cmd.texture = texture; texture._addReference(); cmd.x = x; cmd.y = y; cmd.width = width; cmd.height = height; return cmd; } recover() { this.texture && this.texture._removeReference(); this.texture = null; Pool.recover("DrawImageCmd", this); } run(context, gx, gy) { if (this.texture) context.drawTexture(this.texture, this.x + gx, this.y + gy, this.width, this.height); } get cmdID() { return DrawImageCmd.ID; } } DrawImageCmd.ID = "DrawImage";