New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 809930 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Feb 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Regression issue in scale function

Reported by viachesl...@gmail.com, Feb 7 2018

Issue description

UserAgent: 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:
 
scale_result_to_394_221_ok.jpg
66.6 KB View Download
scale_result_to_326_183_nok.jpg
68.9 KB View Download
test_scale.jpg
31.0 KB View Download
Labels: Needs-Triage-M64
Labels: Needs-Bisect
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!
809930.mp4
4.0 MB View Download
Cc: viswatej...@techmahindra.com
Labels: Triaged-ET Needs-Feedback
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);

Project Member

Comment 6 by sheriffbot@chromium.org, Feb 8 2018

Cc: sc00335...@techmahindra.com
Labels: -Needs-Feedback
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
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!
809930.html
151 bytes View Download
Labels: Needs-Feedback
Open the link https://jsfiddle.net/epateev/86rwc3q2/2/
Click on "Choose File" button, choose test_scale.jpg and see the result.
test_scale_repro.jpg
137 KB View Download
Project Member

Comment 10 by sheriffbot@chromium.org, Feb 9 2018

Labels: -Needs-Feedback
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
Cc: -viswatej...@techmahindra.com -sc00335...@techmahindra.com
Labels: -Pri-2 -Needs-Bisect ReleaseBlock-Stable RegressedIn-64 M-64 FoundIn-64 Target-64 hasbisect OS-Linux OS-Mac Pri-1
Owner: xlai@chromium.org
Status: Assigned (was: Unconfirmed)
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!

Comment 12 by xlai@chromium.org, Feb 12 2018

Labels: -ReleaseBlock-Stable -Needs-Triage-M64
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.

Comment 13 by xlai@chromium.org, Feb 21 2018

Status: Fixed (was: Assigned)
Forgot to mark this as fixed.

Sign in to add a comment