src/graphics/image.js
function(layer) {
        if (!this.img || !layer) return;

        if (layer.type === "Canvas") {
            this._pattern = this._drawContext.createPattern(
                this.img,
                this._repeat
            );
        } else if (layer.type === "WebGL") {
            this._establishShader(
                "image:" + this.__image,
                Crafty.defaultShader("Image")
            );
            this.program.setTexture(
                this._drawLayer.makeTexture(
                    this.__image,
                    this.img,
                    this._repeat !== "no-repeat"
                )
            );
        }

        if (this._repeat === "no-repeat") {
            this.w = this.w || this.img.width;
            this.h = this.h || this.img.height;
        }

        this.ready = true;
        this.trigger("Invalidate");
    }
function(layer) {
        if (!this.img || !layer) return;

        if (layer.type === "Canvas") {
            this._pattern = this._drawContext.createPattern(
                this.img,
                this._repeat
            );
        } else if (layer.type === "WebGL") {
            this._establishShader(
                "image:" + this.__image,
                Crafty.defaultShader("Image")
            );
            this.program.setTexture(
                this._drawLayer.makeTexture(
                    this.__image,
                    this.img,
                    this._repeat !== "no-repeat"
                )
            );
        }

        if (this._repeat === "no-repeat") {
            this.w = this.w || this.img.width;
            this.h = this.h || this.img.height;
        }

        this.ready = true;
        this.trigger("Invalidate");
    }
function ( layer ) { if ( ! this . img || ! layer ) return ; if ( layer . type === "Canvas" ) { this . _pattern = this . _drawContext . createPattern ( this . img , this . _repeat ) ; } else if ( layer . type === "WebGL" ) { this . _establishShader ( "image:" + this . __image , Crafty . defaultShader ( "Image" ) ) ; this . program . setTexture ( this . _drawLayer . makeTexture ( this . __image , this . img , this . _repeat !== "no-repeat" ) ) ; } if ( this . _repeat === "no-repeat" ) { this . w = this . w || this . img . width ; this . h = this . h || this . img . height ; } this . ready = true ; this . trigger ( "Invalidate" ) ; }
called on image change or layer attachment
called on image change or layer attachment