var StrokePathWebGL = require('../StrokePathWebGL'); var Utils = require('../../../renderer/webgl/Utils'); var RectangleWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix){ var pipeline = this.pipeline; var camMatrix = pipeline._tempMatrix1; var shapeMatrix = pipeline._tempMatrix2; var calcMatrix = pipeline._tempMatrix3; renderer.setPipeline(pipeline); shapeMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); camMatrix.copyFrom(camera.matrix); if (parentMatrix) { camMatrix.multiplyWithOffset(parentMatrix, - camera.scrollX * src.scrollFactorX, - camera.scrollY * src.scrollFactorY); shapeMatrix.e = src.x; shapeMatrix.f = src.y; } else { shapeMatrix.e -= camera.scrollX * src.scrollFactorX; shapeMatrix.f -= camera.scrollY * src.scrollFactorY; } camMatrix.multiply(shapeMatrix, calcMatrix); var dx = src._displayOriginX; var dy = src._displayOriginY; var alpha = camera.alpha * src.alpha; if (src.isFilled) { var fillTint = pipeline.fillTint; var fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha); fillTint.TL = fillTintColor; fillTint.TR = fillTintColor; fillTint.BL = fillTintColor; fillTint.BR = fillTintColor; pipeline.setTexture2D(); pipeline.batchFillRect(- dx, - dy, src.width, src.height); } if (src.isStroked) { StrokePathWebGL(pipeline, src, alpha, dx, dy); } } ; module.exports = RectangleWebGLRenderer;