Source
@override
void renderTextureQuad(
RenderState renderState,
RenderTextureQuad renderTextureQuad) {
if (renderTextureQuad.hasCustomVertices) {
var renderTexture = renderTextureQuad.renderTexture;
var ixList = renderTextureQuad.ixList;
var vxList = renderTextureQuad.vxList;
this.renderTextureMesh(renderState, renderTexture, ixList, vxList);
return;
}
var context = _renderingContext;
var source = renderTextureQuad.renderTexture.source;
var rotation = renderTextureQuad.rotation;
var sourceRect = renderTextureQuad.sourceRectangle;
var vxList = renderTextureQuad.vxListQuad;
var matrix = renderState.globalMatrix;
var alpha = renderState.globalAlpha;
var blendMode = renderState.globalBlendMode;
if (_activeAlpha != alpha) {
_activeAlpha = alpha;
context.globalAlpha = alpha;
}
if (_activeBlendMode != blendMode) {
_activeBlendMode = blendMode;
context.globalCompositeOperation = blendMode.compositeOperation;
}
if (rotation == 0) {
context.setTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);
context.drawImageScaledFromSource(source,
sourceRect.left, sourceRect.top, sourceRect.width, sourceRect.height,
vxList[0], vxList[1], vxList[8] - vxList[0], vxList[9] - vxList[1]);
} else if (rotation == 1) {
context.setTransform(-matrix.c, -matrix.d, matrix.a, matrix.b, matrix.tx, matrix.ty);
context.drawImageScaledFromSource(source,
sourceRect.left, sourceRect.top, sourceRect.width, sourceRect.height,
0.0 - vxList[13], vxList[12], vxList[9] - vxList[1], vxList[8] - vxList[0]);
} else if (rotation == 2) {
context.setTransform(-matrix.a, -matrix.b, -matrix.c, -matrix.d, matrix.tx, matrix.ty);
context.drawImageScaledFromSource(source,
sourceRect.left, sourceRect.top, sourceRect.width, sourceRect.height,
0.0 - vxList[8], 0.0 - vxList[9], vxList[8] - vxList[0], vxList[9] - vxList[1]);
} else if (rotation == 3) {
context.setTransform(matrix.c, matrix.d, -matrix.a, -matrix.b, matrix.tx, matrix.ty);
context.drawImageScaledFromSource(source,
sourceRect.left, sourceRect.top, sourceRect.width, sourceRect.height,
vxList[5], 0.0 - vxList[4], vxList[9] - vxList[1], vxList[8] - vxList[0]);
}
}