- override
Renders this display object with the given renderState
.
The display object is rendered without its filters.
Source
@override void render(RenderState renderState) { // We could use renderState.renderTextureMesh, it would work great with // the WebGL renderer but not so good with the Canvas2D renderer. var globalMatrix = renderState.globalMatrix; var renderContext = renderState.renderContext; var tempMatrix = globalMatrix.clone(); var w0 = _slices[0].targetWidth; var h0 = _slices[0].targetHeight; var w1 = _slices[4].targetWidth; var h1 = _slices[4].targetHeight; var w2 = _slices[8].targetWidth; var h2 = _slices[8].targetHeight; for (int j = 0; j < 3; j++) { var sh = j == 0 ? h0 : j == 2 ? h2 : h1; var th = j == 0 ? h0 : j == 2 ? h2 : height - h0 - h2; var ty = j == 0 ? 0 : j == 1 ? h0 : height - h2; for (int i = 0; i < 3; i++) { var sw = i == 0 ? w0 : i == 2 ? w2 : w1; var tw = i == 0 ? w0 : i == 2 ? w2 : width - w0 - w2; var tx = i == 0 ? 0 : i == 1 ? w0 : width - w2; globalMatrix.setTo(tw / sw, 0, 0, th / sh, tx, ty); globalMatrix.concat(tempMatrix); renderContext.renderTextureQuad(renderState, _slices[i + j * 3]); } } globalMatrix.copyFrom(tempMatrix); }