<commit_before>var ImageRenderer = (function (wrapText, Math) {
    "use strict";

    function ImageRenderer(screen) {
        this.screen = screen;
        this.ctx = screen.getContext('2d');

        this.screenWidth = screen.width;
        this.screenHeight = screen.height;
        this.drawableDict = {'0': {}, '1': {}, '2': {}, '3': {}};
        this.drawableTxtDict = {};
    }

    ImageRenderer.prototype.resize = function (width, height) {
        this.screen.width = width;
        this.screen.height = height;
        this.screenWidth = width;
        this.screenHeight = height;
    };

    ImageRenderer.prototype.add = function (drawable) {
        if (drawable.txt) {
            this.drawableTxtDict[drawable.id] = drawable;
        } else {
            this.drawableDict[drawable.zIndex][drawable.id] = drawable;
        }
    };

    ImageRenderer.prototype.remove = function (drawable) {
        if (drawable.txt) {
            delete this.drawableTxtDict[drawable.id];
        } else {
            delete this.drawableDict[drawable.zIndex][drawable.id];
        }
    };

    ImageRenderer.prototype.has = function (drawable) {
        return this.drawableDict[drawable.zIndex][drawable.id] !== undefined ||
            this.drawableTxtDict[drawable.id];
    };

    ImageRenderer.prototype.draw = function () {
        var self = this;
        this.ctx.clearRect(0, 0, this.screenWidth, this.screenHeight);

        for (var key in this.drawableDict) {
            iterate(this.drawableDict[key]);
        }

        function iterate(dict) {
            for (var key in dict) {
                var elem = dict[key];

                self.ctx.drawImage(
                    elem.img.img,
                    elem.getCornerX(),
                    elem.getCornerY(),
                    elem.getWidth(),
                    elem.getHeight()
                );
            }
        }

        for (key in this.drawableTxtDict) {
            var elem = this.drawableTxtDict[key];

            this.ctx.save();

            if (elem.txt.alpha || elem.txt.alpha === 0) {
                this.ctx.globalAlpha = elem.txt.alpha;
            }
            this.ctx.textBaseline = 'middle';
            this.ctx.textAlign = 'center';
            this.ctx.fillStyle = elem.txt.color;
            this.ctx.font = elem.txt.size + 'px ' + elem.txt.fontFamily;

            if (elem.txt.rotation) {
                this.ctx.translate(elem.x, elem.y);
                this.ctx.rotate(elem.txt.rotation);
                this.ctx.translate(-elem.x, -elem.y);
            }

            var txtIsToLong =
                elem.txt.maxLineLength && this.ctx.measureText(elem.txt.msg).width > elem.txt.maxLineLength;
            if (txtIsToLong) {
                wrapText(this.ctx, elem.txt.msg, elem.x, elem.y, elem.txt.maxLineLength, elem.txt.lineHeight);
            } else {
                this.ctx.fillText(elem.txt.msg, elem.x, elem.y);
            }

            this.ctx.restore();
        }


    };

    return ImageRenderer;
})(wrapText, Math);<commit_msg>unused dependency in core (cherry picked from commit f7eb31d)<commit_after>var ImageRenderer = (function (wrapText) {
    "use strict";

    function ImageRenderer(screen) {
        this.screen = screen;
        this.ctx = screen.getContext('2d');

        this.screenWidth = screen.width;
        this.screenHeight = screen.height;
        this.drawableDict = {'0': {}, '1': {}, '2': {}, '3': {}};
        this.drawableTxtDict = {};
    }

    ImageRenderer.prototype.resize = function (width, height) {
        this.screen.width = width;
        this.screen.height = height;
        this.screenWidth = width;
        this.screenHeight = height;
    };

    ImageRenderer.prototype.add = function (drawable) {
        if (drawable.txt) {
            this.drawableTxtDict[drawable.id] = drawable;
        } else {
            this.drawableDict[drawable.zIndex][drawable.id] = drawable;
        }
    };

    ImageRenderer.prototype.remove = function (drawable) {
        if (drawable.txt) {
            delete this.drawableTxtDict[drawable.id];
        } else {
            delete this.drawableDict[drawable.zIndex][drawable.id];
        }
    };

    ImageRenderer.prototype.has = function (drawable) {
        return this.drawableDict[drawable.zIndex][drawable.id] !== undefined ||
            this.drawableTxtDict[drawable.id];
    };

    ImageRenderer.prototype.draw = function () {
        var self = this;
        this.ctx.clearRect(0, 0, this.screenWidth, this.screenHeight);

        for (var key in this.drawableDict) {
            iterate(this.drawableDict[key]);
        }

        function iterate(dict) {
            for (var key in dict) {
                var elem = dict[key];

                self.ctx.drawImage(
                    elem.img.img,
                    elem.getCornerX(),
                    elem.getCornerY(),
                    elem.getWidth(),
                    elem.getHeight()
                );
            }
        }

        for (key in this.drawableTxtDict) {
            var elem = this.drawableTxtDict[key];

            this.ctx.save();

            if (elem.txt.alpha || elem.txt.alpha === 0) {
                this.ctx.globalAlpha = elem.txt.alpha;
            }
            this.ctx.textBaseline = 'middle';
            this.ctx.textAlign = 'center';
            this.ctx.fillStyle = elem.txt.color;
            this.ctx.font = elem.txt.size + 'px ' + elem.txt.fontFamily;

            if (elem.txt.rotation) {
                this.ctx.translate(elem.x, elem.y);
                this.ctx.rotate(elem.txt.rotation);
                this.ctx.translate(-elem.x, -elem.y);
            }

            var txtIsToLong =
                elem.txt.maxLineLength && this.ctx.measureText(elem.txt.msg).width > elem.txt.maxLineLength;
            if (txtIsToLong) {
                wrapText(this.ctx, elem.txt.msg, elem.x, elem.y, elem.txt.maxLineLength, elem.txt.lineHeight);
            } else {
                this.ctx.fillText(elem.txt.msg, elem.x, elem.y);
            }

            this.ctx.restore();
        }


    };

    return ImageRenderer;
})(wrapText);
{'fraction_non_alphanumeric': 0.12852055681450308, 'fraction_numerical': 0.0030754289414049855, 'mean_word_length': 1.655350236355823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4317051', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1731, 'n_words': 297}