Closed Bug 486936 Opened 16 years ago Closed 16 years ago

canvas should take account of image-rendering

Categories

(Core :: Graphics: Canvas2D, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: longsonr, Assigned: longsonr)

References

Details

Attachments

(1 file, 3 obsolete files)

Depends on: 486934
Attached patch patch? (obsolete) — Splinter Review
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+
Attached patch update to tip (obsolete) — Splinter Review
Attachment #373520 - Attachment is obsolete: true
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?
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.
(In reply to comment #10) That works although it's -moz-crisp-edges
Attached patch updated patch with reftest (obsolete) — Splinter Review
Assignee: nobody → longsonr
Attachment #377834 - Attachment is obsolete: true
Attachment #377922 - Flags: review?(vladimir)
Attached patch updatedSplinter Review
Attachment #377922 - Attachment is obsolete: true
Attachment #377929 - Flags: review?(vladimir)
Attachment #377922 - Flags: review?(vladimir)
Status: NEW → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Just needs the existing dev doc for image-rendering tweaking to remove the reference to this bug.
Keywords: dev-doc-needed
Whiteboard: [dev-doc-needed comment 15]
(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.

Attachment

General

Created:
Updated:
Size: