Regression issue in scale function
Reported by
viachesl...@gmail.com,
Feb 7 2018
|
|||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Steps to reproduce the problem: 1. Simply scale attached image using context.scale call 2. Print the result into another canvas (see attached files) 3. It works fine with 0.3081291553697717 scale factor, but it fails with 0.2551551815399144. What is the expected behavior? Scale must return properly scaled image What went wrong? Using 0.2551551815399144 downscale factor value we get strange result (see attached nok image). Did this work before? Yes 61.0.3163.98 Does this work in other browsers? Yes Chrome version: 64.0.3282.140 Channel: stable OS Version: 10.0 Flash Version:
,
Feb 8 2018
,
Feb 8 2018
Tested this issue on chrome reported version 64.0.3282.140 using windows-10 with steps mentioned below: 1) Launched chrome reported version and opened the image test_scale.jpg attached in comment#0 and opened Dev tools -> Console 2) With reference to the screen shots attached, we have tried executing the commands contexts.output.putImageData(ImageData, 0, 0); , ImageData, context.scale call @Reporter: Please find the attached screencast for your reference, if possible could you please provide the screen cast of the issue, so that it will help us in reproducing from our end. Thanks!
,
Feb 8 2018
,
Feb 8 2018
Commands in the attached images were mentioned just for information.
To reproduce you need to load attached file and simply scale it.
It’s up to you how to load and set the 2 parameters below.
var imageData = null; // load and set your image data here
var outputCanvas = null; // create your canvas to draw the result
The rest code can be the following:
var width = imageData.width;
var height = imageData.height;
// Step 1: convert imageData to canvas obj
var c = document.createElement('canvas');
c.width = width;
c.height = height;
c.getContext('2d').putImageData(imageData, 0, 0);
// Step 2: calculate scale parameters
// 350 * 250 = works, 300 * 200 = fail
var pixels = 350 * 250;
var sf = Math.sqrt((width * height) / pixels);
var s = 1 / sf;
var dw = Math.floor(width / sf);
var dh = Math.floor(height / sf);
// Step 3: prepare scaling canvas and scale
var canvas = document.createElement('canvas');
canvas.width = dw;
canvas.height = dh;
var downScaledContext = canvas.getContext('2d');
downScaledContext.scale(s, s);
downScaledContext.drawImage(c, 0, 0, width, height);
// Step 4: get and draw the result
var scaledImageData = downScaledContext.getImageData(0, 0, dw, dh);
outputCanvas.getContext('2d').putImageData(scaledImageData, 0, 0);
// Or we can draw using the canvas with scaledImageData directly
//outputCanvas.getContext('2d').drawImage(canvas, 0, 0, dw, dh);
,
Feb 8 2018
Thank you for providing more feedback. Adding requester "sc00335628@techmahindra.com" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Feb 9 2018
Created a .html file using the image test_scale.jpg given in comment#0. Loaded the created .html, as we are unable to set those two parameters, requesting you to share a test file(jsfiddle) in which the required parameters(mentioned in comment#5) are already set. This would help us to triage the issue in a better way. Attached is the created .html file. If possible could you please provide the screen cast for the issue, any further inputs from your end will help us in triaging the issue further. Thanks!
,
Feb 9 2018
,
Feb 9 2018
Open the link https://jsfiddle.net/epateev/86rwc3q2/2/ Click on "Choose File" button, choose test_scale.jpg and see the result.
,
Feb 9 2018
Thank you for providing more feedback. Adding requester "sc00335628@techmahindra.com" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Feb 12 2018
Able to reproduce the issue on reported version 64.0.3282.140 and the same is not seen on latest canary 66.0.3344.0 and beta 65.0.3325.51 using Windows 10, Ubuntu 14.04, Mac 10.12.6, hence providing reverse bisect info Reverse Bisect Info: ================ Last Bad build: 64.0.3280.151 First Good build: 64.0.3282.155 We cannot provide chromium/per-rivision bisect info as this issue is broken in branch builds,hence providing manual change log from omahaproxy https://chromium.googlesource.com/chromium/src/+log/64.0.3282.151..64.0.3282.155?pretty=fuller&n=10000 Commit: 68f180c2597177c389641868a36c8c4e5208aa3e Probably fixed by: https://chromium-review.googlesource.com/899913 @xlai: Suspecting the same change log, please merge it to M-64 if it is safe Adding ReleaseBlock-Stable as it is M-64 break, feel free to remove it if not applicable. Thanks!
,
Feb 12 2018
Since reverse bisect is already performed and found the first good build is in M64, I'm removing the regression-block label. https://chromium-review.googlesource.com/899913 is a hotfix landing to M64. I'll keep watching this issue until the next update of M64 is released.
,
Feb 21 2018
Forgot to mark this as fixed. |
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by susanjun...@techmahindra.com
, Feb 7 2018