// Class: openfl._internal.renderer.canvas.CanvasDisplayObject

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 Std() {return require("./../../../../Std");}
function openfl__$internal_renderer_canvas_CanvasShape() {return require("./../../../../openfl/_internal/renderer/canvas/CanvasShape");}

// Constructor

var CanvasDisplayObject = function(){}

// Meta

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

// Init



// Statics

CanvasDisplayObject.render = function(displayObject,renderSession) {
	if(displayObject.opaqueBackground == null && displayObject.__graphics == null) {
		return;
	}
	if(!displayObject.__renderable || displayObject.__worldAlpha <= 0) {
		return;
	}
	if(displayObject.opaqueBackground != null && !displayObject.__cacheBitmapRender && displayObject.get_width() > 0 && displayObject.get_height() > 0) {
		renderSession.blendModeManager.setBlendMode(displayObject.__worldBlendMode);
		renderSession.maskManager.pushObject(displayObject);
		var context = renderSession.context;
		var transform = displayObject.__renderTransform;
		if(renderSession.roundPixels) {
			context.setTransform(transform.a,transform.b,transform.c,transform.d,(Std().default)["int"](transform.tx),(Std().default)["int"](transform.ty));
		} else {
			context.setTransform(transform.a,transform.b,transform.c,transform.d,transform.tx,transform.ty);
		}
		var color = displayObject.opaqueBackground;
		context.fillStyle = "rgb(" + (color >>> 16 & 255) + "," + (color >>> 8 & 255) + "," + (color & 255) + ")";
		context.fillRect(0,0,displayObject.get_width(),displayObject.get_height());
		renderSession.maskManager.popObject(displayObject);
	}
	if(displayObject.__graphics != null) {
		(openfl__$internal_renderer_canvas_CanvasShape().default).render(displayObject,renderSession);
	}
}


// Export

exports.default = CanvasDisplayObject;