<commit_before>// Copyright 2002-2012, University of Colorado

/**
 * Mutable state passed through the scene graph rendering process that stores
 * the current transformation and layer.
 *
 * A fresh RenderState should be used for each render pass.
 *
 * @author <NAME>
 */

var phet = phet || {};
phet.scene = phet.scene || {};

(function(){
    phet.scene.RenderState = function() {
        this.transform = new phet.math.Transform3();
        
        this.layer = null;
        
        // clipping shapes should be added in reference to the global coordinate frame
        this.clipShapes = [];
        
        this.multiLayerRender = true;
    }

    var RenderState = phet.scene.RenderState;

    RenderState.prototype = {
        constructor: RenderState,
        
        // add a clipping region in the local coordinate frame
        pushClipShape: function( shape ) {
            // transform the shape into global coordinates
            this.clipShapes.push( this.transform.transformShape( shape ) );
            
            // notify the layer to actually do the clipping
            this.layer.pushClipShape( shape );
        },
        
        popClipShape: function() {
            this.clipShapes.pop();
            this.layer.popClipShape();
        },
        <commit_msg>Layer existence checks on RenderState clipping<commit_after>// Copyright 2002-2012, University of Colorado

/**
 * Mutable state passed through the scene graph rendering process that stores
 * the current transformation and layer.
 *
 * A fresh RenderState should be used for each render pass.
 *
 * @author <NAME>
 */

var phet = phet || {};
phet.scene = phet.scene || {};

(function(){
    phet.scene.RenderState = function() {
        this.transform = new phet.math.Transform3();
        
        this.layer = null;
        
        // clipping shapes should be added in reference to the global coordinate frame
        this.clipShapes = [];
        
        this.multiLayerRender = true;
    }

    var RenderState = phet.scene.RenderState;

    RenderState.prototype = {
        constructor: RenderState,
        
        // add a clipping region in the local coordinate frame
        pushClipShape: function( shape ) {
            // transform the shape into global coordinates
            this.clipShapes.push( this.transform.transformShape( shape ) );
            
            // notify the layer to actually do the clipping
            if( this.layer ) {
                this.layer.pushClipShape( shape );
            }
        },
        
        popClipShape: function() {
            this.clipShapes.pop();
            
            if( this.layer ) {
                this.layer.popClipShape();
            }
        },
        
{'fraction_non_alphanumeric': 0.09070958302852963, 'fraction_numerical': 0.006583760058522311, 'mean_word_length': 1.875920084121977, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2945798', 'n_tokens_mistral': 704, 'n_tokens_neox': 690, 'n_words': 215}