Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: Source/core/html/HTMLVideoElement.h

Issue 181693006: Refactoring source image usage in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: applied last corrections Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/html/HTMLVideoElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef HTMLVideoElement_h 26 #ifndef HTMLVideoElement_h
27 #define HTMLVideoElement_h 27 #define HTMLVideoElement_h
28 28
29 #include "core/html/HTMLMediaElement.h" 29 #include "core/html/HTMLMediaElement.h"
30 #include "core/html/canvas/CanvasImageSource.h"
30 31
31 namespace blink { 32 namespace blink {
32 class WebGraphicsContext3D; 33 class WebGraphicsContext3D;
33 } 34 }
34 35
35 namespace WebCore { 36 namespace WebCore {
36 37
37 class ExceptionState; 38 class ExceptionState;
38 class HTMLImageLoader; 39 class HTMLImageLoader;
39 40
40 class HTMLVideoElement FINAL : public HTMLMediaElement { 41 class HTMLVideoElement FINAL : public HTMLMediaElement, public CanvasImageSource {
41 public: 42 public:
42 static PassRefPtr<HTMLVideoElement> create(Document&); 43 static PassRefPtr<HTMLVideoElement> create(Document&);
43 44
44 unsigned videoWidth() const; 45 unsigned videoWidth() const;
45 unsigned videoHeight() const; 46 unsigned videoHeight() const;
46 47
47 // Statistics 48 // Statistics
48 unsigned webkitDecodedFrameCount() const; 49 unsigned webkitDecodedFrameCount() const;
49 unsigned webkitDroppedFrameCount() const; 50 unsigned webkitDroppedFrameCount() const;
50 51
51 // Used by canvas to gain raw pixel access 52 // Used by canvas to gain raw pixel access
52 void paintCurrentFrameInContext(GraphicsContext*, const IntRect&); 53 void paintCurrentFrameInContext(GraphicsContext*, const IntRect&) const;
53 54
54 // Used by WebGL to do GPU-GPU textures copy if possible. 55 // Used by WebGL to do GPU-GPU textures copy if possible.
55 // See more details at MediaPlayer::copyVideoTextureToPlatformTexture() defi ned in Source/WebCore/platform/graphics/MediaPlayer.h. 56 // See more details at MediaPlayer::copyVideoTextureToPlatformTexture() defi ned in Source/WebCore/platform/graphics/MediaPlayer.h.
56 bool copyVideoTextureToPlatformTexture(blink::WebGraphicsContext3D*, Platfor m3DObject texture, GC3Dint level, GC3Denum type, GC3Denum internalFormat, bool p remultiplyAlpha, bool flipY); 57 bool copyVideoTextureToPlatformTexture(blink::WebGraphicsContext3D*, Platfor m3DObject texture, GC3Dint level, GC3Denum type, GC3Denum internalFormat, bool p remultiplyAlpha, bool flipY);
57 58
58 bool shouldDisplayPosterImage() const { return displayMode() == Poster || di splayMode() == PosterWaitingForVideo; } 59 bool shouldDisplayPosterImage() const { return displayMode() == Poster || di splayMode() == PosterWaitingForVideo; }
59 60
60 KURL posterImageURL() const; 61 KURL posterImageURL() const;
61 62
62 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it. 63 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it.
63 virtual KURL mediaPlayerPosterURL() OVERRIDE; 64 virtual KURL mediaPlayerPosterURL() OVERRIDE;
64 65
66 // CanvasImageSource implementation
67 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const OVERRIDE;
68 virtual bool isVideoElement() const OVERRIDE { return true; }
69 virtual bool wouldTaintOrigin(SecurityOrigin*) const OVERRIDE;
70 virtual FloatSize sourceSize() const OVERRIDE;
71
65 private: 72 private:
66 HTMLVideoElement(Document&); 73 HTMLVideoElement(Document&);
67 74
68 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; 75 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE;
69 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; 76 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
70 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; 77 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
71 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 78 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
72 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; 79 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
73 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE; 80 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE;
74 virtual bool isVideo() const OVERRIDE { return true; } 81 virtual bool isVideo() const OVERRIDE { return true; }
75 virtual bool hasVideo() const OVERRIDE { return player() && player()->hasVid eo(); } 82 virtual bool hasVideo() const OVERRIDE { return player() && player()->hasVid eo(); }
76 virtual bool isURLAttribute(const Attribute&) const OVERRIDE; 83 virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
77 virtual const AtomicString imageSourceURL() const OVERRIDE; 84 virtual const AtomicString imageSourceURL() const OVERRIDE;
78 85
79 bool hasAvailableVideoFrame() const; 86 bool hasAvailableVideoFrame() const;
80 virtual void updateDisplayState() OVERRIDE; 87 virtual void updateDisplayState() OVERRIDE;
81 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; 88 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
82 virtual void setDisplayMode(DisplayMode) OVERRIDE; 89 virtual void setDisplayMode(DisplayMode) OVERRIDE;
83 90
84 OwnPtr<HTMLImageLoader> m_imageLoader; 91 OwnPtr<HTMLImageLoader> m_imageLoader;
85 92
86 AtomicString m_defaultPosterURL; 93 AtomicString m_defaultPosterURL;
87 }; 94 };
88 95
89 } //namespace 96 } //namespace
90 97
91 #endif 98 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/html/HTMLVideoElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698