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

Issue metadata

Status: Accepted
Owner:
Cc:
Area: ----
NextAction: ----
Priority: Medium
Type: Defect

Blocking:
issue chromium:859400



Sign in to add a comment
link

Issue 2122: Canvas maximum size >32767px

Reported by voidvol...@gmail.com, Feb 3 2014

Issue description

[ Repost from chromium bug tracker http://code.google.com/p/chromium/issues/detail?id=339725 ]

What steps will reproduce the problem?
1. Set the size of canvas more 15bits width or length (>32767px)
2. Draw anything
3. Check result: white canvas

What is the expected output?
The colored picture.
According to W3 standarts:
http://www.w3.org/TR/html5/embedded-content-0.html#the-canvas-element

interface HTMLCanvasElement : HTMLElement {
           attribute unsigned long width;
           attribute unsigned long height;

Canvas can be any size from 0...4 294 967 295 px.

What do you see instead?
White list of canvas and lags, sometimes the page is crashed.

What version of the product are you using? On what operating system?
Chrome Version       : 32.0.1700.76 (Официальная сборка 244343) m
OS                   : Windows 7 Pro

Please provide any additional information below.
Code: http://jsbin.com/UguXuniF/3/edit?html,js,output
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<script type="text/javascript">
function test1(){
    var x = document.getElementById('board');
    x.height = 16383;
    x.width = 16383;
    var ctx = x.getContext('2d');
    ctx.fillStyle = 'royalblue';
    ctx.fillRect(0, 0, x.width, x.height);
    console.log( x.width +' x '+ x.height );
}

function test2(){
    var x = document.getElementById('board');
    x.height = 32768;
    x.width = 32768;
    var ctx = x.getContext('2d');
    ctx.fillStyle = 'orangered';
    ctx.fillRect(0, 0, x.width, x.height);
    console.log( x.width +' x '+ x.height );
}
</script>
</head>
<body>
  <button onclick="test1()">Test 1 royalblue 16383px</button>
  <button onclick="test2()">Test 2 orangered 32767px</button>
  <canvas id="board" width="300" height="300"/>
</body>
</html>
 

Comment 1 by hcm@google.com, Feb 4 2014

Project Member
Cc: hcm@google.com
Owner: reed@google.com
Assign to Mike to take a look and see if you think there is something we can do about this issue.. 

Stephen noted in the Chromium bug that it is a known limitation of Skia's design that we may not fix, but voidvolker opened here for our consideration.

Comment 2 by hcm@google.com, Oct 14 2014

Project Member
Labels: -Priority-Medium Priority-Low

Comment 3 by hcm@google.com, Dec 7 2015

Project Member
Labels: Hotlist-Fixit

Comment 4 by caryclark@google.com, Mar 2 2016

Project Member
Cc: fmalita@chromium.org
Given that Chrome draws to tiles, wouldn't it be reasonable to attack this at that level rather than in Skia? Florin, do you think there is any interest in limiting the SkCanvas to something < 32K in Chrome, and then tiling additional SkCanvas to make the width specified the as described above?

Comment 5 by fmalita@chromium.org, Mar 2 2016

Project Member
Cc: junov@chromium.org
I think canvas2d is not (always?) tiled - junov, would it make sense to limit the size in Blink?

Comment 6 by junov@chromium.org, Mar 7 2016

Project Member
Correct, canvases are never tiled in the current implementation. No need to have a limit that is explicitly known to blink since blink knows when the canvas is to big by the fact of skia failing to allocate it.  That being said, Houdini's custom paint feature is going to offer a very reasonable workaround for drawing arbitrarily large things using a write-only subset of the Canvas API. That will leverage tiling.

Comment 7 by petrcermak@chromium.org, Jul 13 2016

This issue is causing chrome://tracing to not display large traces (https://github.com/catapult-project/catapult/issues/2416#issuecomment-232327904). Are there any plans to address it in the near future?

Comment 8 by reed@google.com, Jan 18 2018

Project Member
Cc: caryclark@google.com bsalo...@google.com reed@google.com
 Issue 580  has been merged into this issue.

Comment 9 by reed@google.com, Mar 2 2018

Project Member
piggy-backing on this:

- canvas disables antialiasing at smaller sizes (e.g. 8K) due to fixed-point limitations. This should be addressed too.

Comment 11 by bugdroid1@chromium.org, Mar 7 2018

Project Member
The following revision refers to this bug:
  https://skia.googlesource.com/skia/+/461ef7af88cc966007c464130a971ec86c803f1d

commit 461ef7af88cc966007c464130a971ec86c803f1d
Author: Florin Malita <fmalita@chromium.org>
Date: Wed Mar 07 14:23:01 2018

Revert "add tiler for SkDraw"

This reverts commit be1b3971806e3d80aa9673a36e2b35d0145198ac.

Reason for revert: 

Unexpected layout test diffs: https://test-results.appspot.com/data/layout_results/linux_trusty_blink_rel/24989/layout-test-results/results.html

Original change's description:
> add tiler for SkDraw
> 
> Bug: skia:2122
> Change-Id: I276de2064939151eef5fa14c53188e8b5728b7c9
> Reviewed-on: https://skia-review.googlesource.com/110840
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Yuqian Li <liyuqian@google.com>

TBR=liyuqian@google.com,reed@google.com

Change-Id: Ia598c0d7c4ac6cfcdb905b847040c250fa366402
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:2122
Reviewed-on: https://skia-review.googlesource.com/112740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>

[add] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/tests/DeviceLooperTest.cpp
[modify] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/src/core/SkBitmapDevice.h
[add] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/src/core/SkDeviceLooper.cpp
[modify] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/gn/tests.gni
[add] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/src/core/SkDeviceLooper.h
[modify] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/src/core/SkDraw.cpp
[modify] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/gm/hugepath.cpp
[modify] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/src/core/SkBitmapDevice.cpp
[modify] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/src/core/SkScan_Hairline.cpp
[modify] https://crrev.com/461ef7af88cc966007c464130a971ec86c803f1d/gn/core.gni

Comment 12 by kbr@chromium.org, Nov 30

Project Member
Blocking: chromium:859400
Cc: -junov@chromium.org kbr@chromium.org jdarpinian@google.com fs...@chromium.org
Labels: -Priority-Low Priority-Medium
Status: Accepted (was: New)
The limitation on maximum canvas size is blocking passing the WebGL 2.0.1 conformance suite per  http://crbug.com/859400  . Would it be possible to try to make progress on this issue again?

Comment 13 by reed@google.com, Dec 1

Project Member
fserb@ is this limitation on the chrome side? I don't see it on the skia-raster side...

Comment 14 by jdarpinian@chromium.org, Dec 2

I created a change to increase the limit: https://chromium-review.googlesource.com/c/chromium/src/+/1356555

It seems to work.

Comment 15 by fs...@chromium.org, Dec 3

There was a comment on our side saying it was a Skia issue. Maybe it disappeared.
jdarpinian@'s cl solves it.

Comment 16 by bugdroid1@chromium.org, Dec 3

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5fd81121bab7d735ed01a8a112df253807c2e77c

commit 5fd81121bab7d735ed01a8a112df253807c2e77c
Author: James Darpinian <jdarpinian@chromium.org>
Date: Mon Dec 03 20:37:16 2018

Increase maximum width/height of canvas.

Fixes WebGL conformance test:
conformance2/textures/misc/tex-subimage3d-canvas-bug.html

The test expects to be able to create a canvas larger than 32767 in
height. Skia seems to support this, and there have been user requests
for it.

Bug: 859400, 339725, skia:2122
Change-Id: Ibba89e98178bd73817c7b4cbdf569e89ee5764b1
Reviewed-on: https://chromium-review.googlesource.com/c/1356555
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613225}
[modify] https://crrev.com/5fd81121bab7d735ed01a8a112df253807c2e77c/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
[modify] https://crrev.com/5fd81121bab7d735ed01a8a112df253807c2e77c/third_party/blink/renderer/platform/graphics/skia/skia_utils.h
[modify] https://crrev.com/5fd81121bab7d735ed01a8a112df253807c2e77c/third_party/blink/web_tests/fast/canvas/canvas-large-pattern.html

Comment 17 by caryclark@google.com, Dec 17

Project Member
Cc: carycl...@skia.org

Comment 18 by caryclark@google.com, Dec 17

Project Member
Cc: -caryclark@google.com

Sign in to add a comment