(source)
| 63781 | return target; |
| 63782 | } |
| 63783 | function copyToDataUrl(source) { |
| 63784 | var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref3$sourceAttachmen = _ref3.sourceAttachment, sourceAttachment = _ref3$sourceAttachmen === void 0 ? 36064 : _ref3$sourceAttachmen, _ref3$targetMaxHeight = _ref3.targetMaxHeight, targetMaxHeight = _ref3$targetMaxHeight === void 0 ? Number.MAX_SAFE_INTEGER : _ref3$targetMaxHeight; |
| 63785 | var data = readPixelsToArray(source, { |
| 63786 | sourceAttachment: sourceAttachment |
| 63787 | }); |
| 63788 | var width = source.width, height = source.height; |
| 63789 | while(height > targetMaxHeight){ |
| 63790 | var _scalePixels = (0, _webglUtils.scalePixels)({ |
| 63791 | data: data, |
| 63792 | width: width, |
| 63793 | height: height |
| 63794 | }); |
| 63795 | data = _scalePixels.data; |
| 63796 | width = _scalePixels.width; |
| 63797 | height = _scalePixels.height; |
| 63798 | } |
| 63799 | (0, _webglUtils.flipRows)({ |
| 63800 | data: data, |
| 63801 | width: width, |
| 63802 | height: height |
| 63803 | }); |
| 63804 | var canvas = document.createElement("canvas"); |
| 63805 | canvas.width = width; |
| 63806 | canvas.height = height; |
| 63807 | var context = canvas.getContext("2d"); |
| 63808 | var imageData = context.createImageData(width, height); |
| 63809 | imageData.data.set(data); |
| 63810 | context.putImageData(imageData, 0, 0); |
| 63811 | return canvas.toDataURL(); |
| 63812 | } |
| 63813 | function copyToImage(source) { |
| 63814 | var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref4$sourceAttachmen = _ref4.sourceAttachment, sourceAttachment = _ref4$sourceAttachmen === void 0 ? 36064 : _ref4$sourceAttachmen, _ref4$targetImage = _ref4.targetImage, targetImage = _ref4$targetImage === void 0 ? null : _ref4$targetImage; |
| 63815 | var dataUrl = copyToDataUrl(source, { |
no test coverage detected