Closed
Bug 448674
Opened 15 years ago
Closed 15 years ago
Allow <video> to be used as element source in drawImage
Categories
(Core :: Graphics: Canvas2D, defect, P3)
Tracking
()
RESOLVED
FIXED
People
(Reporter: vlad, Assigned: vlad)
Details
Attachments
(1 file, 1 obsolete file)
7.44 KB,
patch
|
vlad
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
As the summary says -- <video> should be a valid source for drawImage; it should render whatever the current frame is.
Flags: wanted1.9.1+
Assignee | ||
Updated•15 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•15 years ago
|
||
Fairly straightforward patch -- a little gritty due to rework/indentation changes in the function (got rid of some extra unnecessary else levels). For the video portion, it checks for nsIDOMHTMLVideoElement, if so, casts it to a nsIVideoElement (safe?)... grabs videoWidth/videoHeight, creates a temporary surface, and calls Paint.
Attachment #331857 -
Flags: superreview?(roc)
Attachment #331857 -
Flags: review?(chris.double)
Updated•15 years ago
|
Attachment #331857 -
Flags: review?(chris.double) → review+
Some of this stuff should be #ifdef MOZ_MEDIA.
> For the video portion, it checks for nsIDOMHTMLVideoElement, if so, casts it to
> a nsIVideoElement (safe?)
Lies. You cast to nsHTMLVideoElement*. And it should be a static_cast... Safe, yes.
+ // we have to clear first, since some platform surfaces (X11, I'm
+ // looking at you) don't follow the cleared-surface convention.
+ ctx->SetOperator(gfxContext::OPERATOR_CLEAR);
+ ctx->Paint();
Can we get rid of this now that X11 surfaces do support the cleared-surface convention?
+ *aSurface = surf.forget().get();
surf.swap(*aSurface) seems a little cleaner.
Comment 3•15 years ago
|
||
I haven't dug in to the patch yet - but is this going to be under the same URI/security restrictions that images are?
Assignee | ||
Comment 4•15 years ago
|
||
(In reply to comment #2) > Some of this stuff should be #ifdef MOZ_MEDIA. > > > For the video portion, it checks for nsIDOMHTMLVideoElement, if so, casts it to > > a nsIVideoElement (safe?) > > Lies. You cast to nsHTMLVideoElement*. And it should be a static_cast... Safe, > yes. Erm, yes. > + // we have to clear first, since some platform surfaces (X11, I'm > + // looking at you) don't follow the cleared-surface convention. > + ctx->SetOperator(gfxContext::OPERATOR_CLEAR); > + ctx->Paint(); > > Can we get rid of this now that X11 surfaces do support the cleared-surface > convention? Yeah, need to verify that. > + *aSurface = surf.forget().get(); > > surf.swap(*aSurface) seems a little cleaner. Yeah, though more confusing (IMO at least); I really wish I could just write '*aSurface = surf.forget();' (In reply to comment #3) > I haven't dug in to the patch yet - but is this going to be under the same > URI/security restrictions that images are? Yep; the restriction rules are effectively the same for both video and image. You can draw any image, just can't read the image data back from images/video that are from a different origin.
Assignee | ||
Comment 5•15 years ago
|
||
Updated, carrying forward review flags.
Attachment #331857 -
Attachment is obsolete: true
Attachment #332785 -
Flags: superreview?(roc)
Attachment #332785 -
Flags: review+
Attachment #331857 -
Flags: superreview?(roc)
Attachment #332785 -
Flags: superreview?(roc) → superreview+
Assignee | ||
Comment 6•15 years ago
|
||
Checked in, needs a test. (Oops.)
Status: NEW → RESOLVED
Closed: 15 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•