Last Comment Bug 486936 - canvas should take account of image-rendering
: canvas should take account of image-rendering
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Canvas: 2D (show other bugs)
: Trunk
: x86 Windows Vista
: -- normal (vote)
: ---
Assigned To: Robert Longson
:
Mentors:
Depends on: 423756 486934
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-05 06:22 PDT by Robert Longson
Modified: 2009-06-18 04:59 PDT (History)
5 users (show)
longsonr: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch? (13.97 KB, patch)
2009-04-18 16:31 PDT, Robert Longson
vladimir: review+
Details | Diff | Review
update to tip (15.45 KB, patch)
2009-05-16 01:06 PDT, Robert Longson
no flags Details | Diff | Review
updated patch with reftest (12.84 KB, patch)
2009-05-17 04:01 PDT, Robert Longson
no flags Details | Diff | Review
updated (12.85 KB, patch)
2009-05-17 05:54 PDT, Robert Longson
vladimir: review+
Details | Diff | Review

Description Robert Longson 2009-04-05 06:22:42 PDT
See bug 423756 comment 88
Comment 1 Robert Longson 2009-04-18 16:31:09 PDT
Created attachment 373520 [details] [diff] [review]
patch?

Hopefully the right approach, compiles but untested as I don't really know much about canvas.
Comment 2 Vladimir Vukicevic [:vlad] [:vladv] 2009-04-18 17:30:01 PDT
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.
Comment 3 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2009-04-19 15:41:47 PDT
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 4 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2009-05-15 03:17:53 PDT
Comment on attachment 373520 [details] [diff] [review]
patch?

I encountered someone who actually needs this!
Comment 5 Vladimir Vukicevic [:vlad] [:vladv] 2009-05-15 03:22:11 PDT
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.
Comment 6 Robert Longson 2009-05-16 01:06:04 PDT
Created attachment 377834 [details] [diff] [review]
update to tip
Comment 7 Robert Longson 2009-05-16 01:07:18 PDT
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?
Comment 8 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2009-05-16 02:05:29 PDT
You've tested it, right?
Comment 9 Robert Longson 2009-05-16 04:05:56 PDT
That's my problem. I don't really know much about canvas and how to test it. It compiles and passes the existing reftests.
Comment 10 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2009-05-16 04:09:51 PDT
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.
Comment 11 Robert Longson 2009-05-16 04:18:23 PDT
(In reply to comment #10)
That works although it's -moz-crisp-edges
Comment 12 Robert Longson 2009-05-17 04:01:39 PDT
Created attachment 377922 [details] [diff] [review]
updated patch with reftest
Comment 13 Robert Longson 2009-05-17 05:54:17 PDT
Created attachment 377929 [details] [diff] [review]
updated
Comment 15 Robert Longson 2009-06-17 17:24:52 PDT
Just needs the existing dev doc for image-rendering tweaking to remove the reference to this bug.
Comment 16 j.j. 2009-06-18 04:59:20 PDT
(In reply to comment #15)

Done.

Note You need to log in before you can comment on or make changes to this bug.