The default bug view has changed. See this FAQ.

canvas should take account of image-rendering

RESOLVED FIXED

Status

()

Core
Canvas: 2D
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Robert Longson, Assigned: Robert Longson)

Tracking

Trunk
x86
Windows Vista
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 3 obsolete attachments)

(Assignee)

Description

8 years ago
See bug 423756 comment 88
(Assignee)

Updated

8 years ago
Depends on: 486934
(Assignee)

Comment 1

8 years ago
Created attachment 373520 [details] [diff] [review]
patch?

Hopefully the right approach, compiles but untested as I don't really know much about canvas.
Hmm.. that's not quite right; there are two pieces here, the filter applied to rendering the canvas itself when it's being CSS scaled, and whether the images rendered to the canvas are rendered with smoothing.  The latter should probably have an 'auto' mode which will honor the image's style (if there is one?  there may well not be a frame for an image that's to be drawn, I guess we'd just use the default then).  I can take a look at fixing up the patch in the next few days.
Actually I think Robert's patch is fine as far as it goes. It makes the rendering of the canvas onto a destination surface honour the canvas's image-rendering property. Rendering images or videos into the canvas using drawImage honors imageSmoothingEnabled. That's all OK right?

The only thing that's missing, possibly, is the 'auto' value you suggest to honor an image's style. I guess that could be useful but it would make sense to be a separate patch. (I guess in principle it would be logical for image formats themselves to specify how the image data should be resampled, but I guess that's not possible except for SVG images, so never mind.)
Comment on attachment 373520 [details] [diff] [review]
patch?

I encountered someone who actually needs this!
Attachment #373520 - Flags: review?(vladimir)
Comment on attachment 373520 [details] [diff] [review]
patch?

Ok; I think this is fine, it'd be nice if we could avoid passing the filter down to ThebesSufaceFromElement since in theory that should always be grabbing a 1:1 surface... but there may be cases where that's not true, or if we ever support SVG images, etc.
Attachment #373520 - Flags: review?(vladimir) → review+
(Assignee)

Comment 6

8 years ago
Created attachment 377834 [details] [diff] [review]
update to tip
Attachment #373520 - Attachment is obsolete: true
(Assignee)

Comment 7

8 years ago
try server builds are here https://build.mozilla.org/tryserver-builds/longsonr@gmail.com-1242429208/

roc can the someone who needs this confirm that it does what he/she needs?
You've tested it, right?
(Assignee)

Comment 9

8 years ago
That's my problem. I don't really know much about canvas and how to test it. It compiles and passes the existing reftests.
If you take an existing canvas demo (e.g. https://bug491595.bugzilla.mozilla.org/attachment.cgi?id=375888 ), set image-rendering:-moz-crispEdges and then zoom in, it should look blocky, not bilinear filtered.
(Assignee)

Comment 11

8 years ago
(In reply to comment #10)
That works although it's -moz-crisp-edges
(Assignee)

Comment 12

8 years ago
Created attachment 377922 [details] [diff] [review]
updated patch with reftest
Assignee: nobody → longsonr
Attachment #377834 - Attachment is obsolete: true
(Assignee)

Updated

8 years ago
Attachment #377922 - Flags: review?(vladimir)
(Assignee)

Comment 13

8 years ago
Created attachment 377929 [details] [diff] [review]
updated
Attachment #377922 - Attachment is obsolete: true
Attachment #377929 - Flags: review?(vladimir)
Attachment #377922 - Flags: review?(vladimir)
Attachment #377929 - Flags: review?(vladimir) → review+
(Assignee)

Comment 14

8 years ago
checked in http://hg.mozilla.org/mozilla-central/rev/a927df82dfcd and http://hg.mozilla.org/mozilla-central/rev/5b40dab2d442
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
(Assignee)

Comment 15

8 years ago
Just needs the existing dev doc for image-rendering tweaking to remove the reference to this bug.
Keywords: dev-doc-needed
(Assignee)

Updated

8 years ago
Whiteboard: [dev-doc-needed comment 15]

Comment 16

8 years ago
(In reply to comment #15)

Done.
Keywords: dev-doc-needed
Whiteboard: [dev-doc-needed comment 15]
You need to log in before you can comment on or make changes to this bug.