// Class: openfl._internal.renderer.opengl.GLDisplayObject

var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this

$global.Object.defineProperty(exports, "__esModule", {value: true});

var __map_reserved = {};

// Imports

var $hxClasses = require("./../../../../hxClasses_stub").default;
var $import = require("./../../../../import_stub").default;
function openfl_geom_Rectangle() {return require("./../../../../openfl/geom/Rectangle");}
function openfl__$internal_renderer_opengl_GLShape() {return require("./../../../../openfl/_internal/renderer/opengl/GLShape");}

// Constructor

var GLDisplayObject = function(){}

// Meta

GLDisplayObject.__name__ = ["openfl","_internal","renderer","opengl","GLDisplayObject"];
GLDisplayObject.prototype = {
	
};
GLDisplayObject.prototype.__class__ = $hxClasses["openfl._internal.renderer.opengl.GLDisplayObject"] = GLDisplayObject;

// Init



// Statics

GLDisplayObject.render = function(displayObject,renderer) {
	if(displayObject.opaqueBackground == null && displayObject.__graphics == null) {
		return;
	}
	if(!displayObject.__renderable || displayObject.__worldAlpha <= 0) {
		return;
	}
	if(displayObject.opaqueBackground != null && !displayObject.__isCacheBitmapRender && displayObject.get_width() > 0 && displayObject.get_height() > 0) {
		renderer.__setBlendMode(displayObject.__worldBlendMode);
		renderer.__pushMaskObject(displayObject);
		var gl = renderer.__gl;
		var rect = (openfl_geom_Rectangle().default).__pool.get();
		rect.setTo(0,0,displayObject.get_width(),displayObject.get_height());
		renderer.__pushMaskRect(rect,displayObject.__renderTransform);
		var color = displayObject.opaqueBackground;
		gl.clearColor((color >>> 16 & 255) / 255,(color >>> 8 & 255) / 255,(color & 255) / 255,1);
		gl.clear(gl.COLOR_BUFFER_BIT);
		renderer.__popMaskRect();
		renderer.__popMaskObject(displayObject);
		(openfl_geom_Rectangle().default).__pool.release(rect);
	}
	if(displayObject.__graphics != null) {
		(openfl__$internal_renderer_opengl_GLShape().default).render(displayObject,renderer);
	}
}
GLDisplayObject.renderMask = function(displayObject,renderer) {
	if(displayObject.opaqueBackground == null && displayObject.__graphics == null) {
		return;
	}
	if(displayObject.opaqueBackground != null && !displayObject.__isCacheBitmapRender && displayObject.get_width() > 0 && displayObject.get_height() > 0) {
		var gl = renderer.__gl;
	}
	if(displayObject.__graphics != null) {
		(openfl__$internal_renderer_opengl_GLShape().default).renderMask(displayObject,renderer);
	}
}


// Export

exports.default = GLDisplayObject;