New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Correction of height and width in extracted canvas #5842
Conversation
Are you able to come up with a pixiplayground or jsfiddle with this error occuring? I've done a pr for v5 fixing a similar thing, so a shared example would be great |
Welcome to the I need more info about it, how exactly did you get |
Usually I do |
The error appeared on Xiaomi mi mix 3. I was trying to get inner container screenshot with these specs. Specs: // frame.width = 430
// frame.height = 368
// resolution = 2.75
const width = frame.width * resolution // 430 * 2.75 = 1182.5;
const height = frame.height * resolution // 368 * 2.75 = 1012;
const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); // 4 * 1182.5 * 1012 = 4 786 760
const canvasData = canvasBuffer.context.getImageData(0, 0, width, height); // 4 * 1182 * 1012 = 4 784 736
// webglPixels.length !== canvasData.data.length
canvasData.data.set(webglPixels); |
Awesome! Can you also give me |
Please add |
I forgot which sprites were used. frame: width,height = [188, 250] |
Oh, you've used extract on sprites, not whole screen. Why do you need them? If its just a single sprite - there are better ways to do that. |
I extracted container. Because I've got a products and i need to take container from one product and then move it into another product. |
Is it in the same renderer, webgl context, canvas, or in different? |
different |
Thank you @martinboksa, sorry for the delay. Hoping to get a v4 release out soon. |
@bigtimebuddy no problem, I finally updated to 5.x |
Description of change
Correction of width and height in extracted canvas.
Some devices returns width and height with decimal places ( 'cause resolution is 2.758, etc.. ). So later ( in computation ) the size of data will not equal.
Example:
It caused the error
RangeError: Source is too large.
Reproduction
Chrome: android devices like: xiaomi mi mix 3
My colleague has also succeeded in the chrome mobile emulator