Changeset 180839 in webkit
- Timestamp:
- Feb 28, 2015 12:58:51 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r180817 r180839 1 2015-02-28 Simon Fraser <simon.fraser@apple.com> 2 3 Fullscreen video layers are off by one sometimes 4 https://bugs.webkit.org/show_bug.cgi?id=142122 5 rdar://problem/19878821 6 7 Reviewed by Eric Carlson. 8 9 Convert MediaPlayer::naturalSize() to return a FloatSize, since the natural size 10 isn't always integral (because of preserving pixel aspect ratio etc). Fix all the media 11 backends to use FloatSizes for natural size. Convert the video image drawing code 12 paths to FloatSize, since naturalSize is used on the destination rect computation, 13 and painting should be floating point anyway. 14 15 Give the layer created by SourceBufferPrivateAVFObjC a name in debug builds. 16 17 * html/HTMLVideoElement.cpp: 18 (WebCore::HTMLVideoElement::videoWidth): 19 (WebCore::HTMLVideoElement::videoHeight): 20 (WebCore::HTMLVideoElement::paintCurrentFrameInContext): 21 * html/HTMLVideoElement.h: 22 * html/canvas/CanvasRenderingContext2D.cpp: 23 (WebCore::size): 24 (WebCore::CanvasRenderingContext2D::drawImage): 25 * html/canvas/WebGLRenderingContextBase.cpp: 26 (WebCore::WebGLRenderingContextBase::videoFrameToImage): 27 * platform/graphics/MediaPlayer.cpp: 28 (WebCore::NullMediaPlayerPrivate::naturalSize): 29 (WebCore::MediaPlayer::naturalSize): 30 (WebCore::MediaPlayer::paint): 31 (WebCore::MediaPlayer::paintCurrentFrameInContext): 32 (WebCore::NullMediaPlayerPrivate::paint): Deleted. 33 * platform/graphics/MediaPlayer.h: 34 * platform/graphics/MediaPlayerPrivate.h: 35 (WebCore::MediaPlayerPrivateInterface::paintCurrentFrameInContext): 36 * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: 37 (WebCore::MediaPlayerPrivateAVFoundation::naturalSize): 38 (WebCore::MediaPlayerPrivateAVFoundation::setNaturalSize): 39 * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: 40 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: 41 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 42 (WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext): 43 (WebCore::MediaPlayerPrivateAVFoundationObjC::paint): 44 (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator): 45 (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): 46 (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): 47 (WebCore::MediaPlayerPrivateAVFoundationObjC::sizeChanged): 48 (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput): 49 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: 50 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 51 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::naturalSize): 52 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paint): 53 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext): 54 * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h: 55 * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: 56 (WebCore::MediaSourcePrivateAVFObjC::naturalSize): 57 * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: 58 * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: 59 (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): 60 (WebCore::SourceBufferPrivateAVFObjC::naturalSize): 61 * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h: 62 * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm: 63 (WebCore::VideoTrackPrivateMediaSourceAVFObjC::naturalSize): 64 * platform/graphics/mac/MediaPlayerPrivateQTKit.h: 65 * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: 66 (WebCore::MediaPlayerPrivateQTKit::naturalSize): 67 (WebCore::MediaPlayerPrivateQTKit::paintCurrentFrameInContext): 68 (WebCore::MediaPlayerPrivateQTKit::paint): 69 * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: 70 (WebCore::MockMediaPlayerMediaSource::naturalSize): 71 (WebCore::MockMediaPlayerMediaSource::paint): 72 * platform/mock/mediasource/MockMediaPlayerMediaSource.h: 73 * rendering/RenderVideo.cpp: 74 (WebCore::RenderVideo::calculateIntrinsicSize): 75 (WebCore::RenderVideo::paintReplaced): 76 1 77 2015-02-27 Hunseop Jeong <hs85.jeong@samsung.com> 2 78 -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r180416 r180839 172 172 if (!player()) 173 173 return 0; 174 return player()->naturalSize().width();174 return clampToUnsigned(player()->naturalSize().width()); 175 175 } 176 176 … … 179 179 if (!player()) 180 180 return 0; 181 return player()->naturalSize().height();181 return clampToUnsigned(player()->naturalSize().height()); 182 182 } 183 183 … … 236 236 } 237 237 238 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect)238 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const FloatRect& destRect) 239 239 { 240 240 MediaPlayer* player = HTMLMediaElement::player(); -
trunk/Source/WebCore/html/HTMLVideoElement.h
r180416 r180839 66 66 67 67 // Used by canvas to gain raw pixel access 68 void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);68 void paintCurrentFrameInContext(GraphicsContext*, const FloatRect&); 69 69 70 70 PassNativeImagePtr nativeImageForCurrentTime(); -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r180268 r180839 1289 1289 1290 1290 #if ENABLE(VIDEO) 1291 static IntSize size(HTMLVideoElement* video)1291 static FloatSize size(HTMLVideoElement* video) 1292 1292 { 1293 1293 if (MediaPlayer* player = video->player()) 1294 1294 return player->naturalSize(); 1295 return IntSize();1295 return FloatSize(); 1296 1296 } 1297 1297 #endif … … 1486 1486 return; 1487 1487 } 1488 IntSize s= size(video);1489 drawImage(video, x, y, s.width(), s.height(), ec);1488 FloatSize videoSize = size(video); 1489 drawImage(video, x, y, videoSize.width(), videoSize.height(), ec); 1490 1490 } 1491 1491 … … 1497 1497 return; 1498 1498 } 1499 IntSize s= size(video);1500 drawImage(video, FloatRect(0, 0, s.width(), s.height()), FloatRect(x, y, width, height), ec);1499 FloatSize videoSize = size(video); 1500 drawImage(video, FloatRect(0, 0, videoSize.width(), videoSize.height()), FloatRect(x, y, width, height), ec); 1501 1501 } 1502 1502 … … 1555 1555 c->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height())); 1556 1556 c->translate(-srcRect.x(), -srcRect.y()); 1557 video->paintCurrentFrameInContext(c, IntRect(IntPoint(), size(video)));1557 video->paintCurrentFrameInContext(c, FloatRect(FloatPoint(), size(video))); 1558 1558 stateSaver.restore(); 1559 1559 didDraw(dstRect); -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r180801 r180839 3247 3247 return nullptr; 3248 3248 } 3249 IntRect destRect(0, 0, size.width(), size.height());3249 FloatRect destRect(0, 0, size.width(), size.height()); 3250 3250 // FIXME: Turn this into a GPU-GPU texture copy instead of CPU readback. 3251 3251 video->paintCurrentFrameInContext(buf->context(), destRect); -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r180532 r180839 95 95 virtual PlatformLayer* platformLayer() const { return 0; } 96 96 97 virtual IntSize naturalSize() const { return IntSize(0, 0); }97 virtual FloatSize naturalSize() const { return FloatSize(); } 98 98 99 99 virtual bool hasVideo() const { return false; } … … 132 132 virtual void setSize(const IntSize&) { } 133 133 134 virtual void paint(GraphicsContext*, const IntRect&){ }134 virtual void paint(GraphicsContext*, const FloatRect&) override { } 135 135 136 136 virtual bool canLoadPoster() const { return false; } … … 545 545 } 546 546 547 IntSize MediaPlayer::naturalSize()547 FloatSize MediaPlayer::naturalSize() 548 548 { 549 549 return m_private->naturalSize(); … … 734 734 } 735 735 736 void MediaPlayer::paint(GraphicsContext* p, const IntRect& r)736 void MediaPlayer::paint(GraphicsContext* p, const FloatRect& r) 737 737 { 738 738 m_private->paint(p, r); 739 739 } 740 740 741 void MediaPlayer::paintCurrentFrameInContext(GraphicsContext* p, const IntRect& r)741 void MediaPlayer::paintCurrentFrameInContext(GraphicsContext* p, const FloatRect& r) 742 742 { 743 743 m_private->paintCurrentFrameInContext(p, r); -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r180416 r180839 312 312 #endif 313 313 314 IntSize naturalSize();314 FloatSize naturalSize(); 315 315 bool hasVideo() const; 316 316 bool hasAudio() const; … … 392 392 void setAutoplay(bool); 393 393 394 void paint(GraphicsContext*, const IntRect&);395 void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);394 void paint(GraphicsContext*, const FloatRect&); 395 void paintCurrentFrameInContext(GraphicsContext*, const FloatRect&); 396 396 397 397 // copyVideoTextureToPlatformTexture() is used to do the GPU-GPU textures copy without a readback to system memory. -
trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r180532 r180839 75 75 virtual bool canSaveMediaData() const { return false; } 76 76 77 virtual IntSize naturalSize() const = 0;77 virtual FloatSize naturalSize() const = 0; 78 78 79 79 virtual bool hasVideo() const = 0; … … 138 138 virtual void setSize(const IntSize&) = 0; 139 139 140 virtual void paint(GraphicsContext*, const IntRect&) = 0;141 142 virtual void paintCurrentFrameInContext(GraphicsContext* c, const IntRect& r) { paint(c, r); }140 virtual void paint(GraphicsContext*, const FloatRect&) = 0; 141 142 virtual void paintCurrentFrameInContext(GraphicsContext* c, const FloatRect& r) { paint(c, r); } 143 143 virtual bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject, GC3Dint, GC3Denum, GC3Denum, bool, bool) { return false; } 144 144 virtual PassNativeImagePtr nativeImageForCurrentTime() { return nullptr; } -
trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
r180532 r180839 308 308 } 309 309 310 IntSize MediaPlayerPrivateAVFoundation::naturalSize() const310 FloatSize MediaPlayerPrivateAVFoundation::naturalSize() const 311 311 { 312 312 if (!metaDataAvailable()) … … 323 323 } 324 324 325 void MediaPlayerPrivateAVFoundation::setNaturalSize( IntSize size)326 { 327 LOG(Media, "MediaPlayerPrivateAVFoundation:setNaturalSize(%p) - size = % d x %d", this, size.width(), size.height());328 329 IntSize oldSize = m_cachedNaturalSize;325 void MediaPlayerPrivateAVFoundation::setNaturalSize(FloatSize size) 326 { 327 LOG(Media, "MediaPlayerPrivateAVFoundation:setNaturalSize(%p) - size = %f x %f", this, size.width(), size.height()); 328 329 FloatSize oldSize = m_cachedNaturalSize; 330 330 m_cachedNaturalSize = size; 331 331 if (oldSize != m_cachedNaturalSize) -
trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
r180416 r180839 162 162 virtual void pause() override; 163 163 164 virtual IntSize naturalSize() const override;164 virtual FloatSize naturalSize() const override; 165 165 virtual bool hasVideo() const override { return m_cachedHasVideo; } 166 166 virtual bool hasAudio() const override { return m_cachedHasAudio; } … … 182 182 virtual bool didLoadingProgress() const override; 183 183 virtual void setSize(const IntSize&) override; 184 virtual void paint(GraphicsContext*, const IntRect&) = 0;185 virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&) = 0;184 virtual void paint(GraphicsContext*, const FloatRect&) = 0; 185 virtual void paintCurrentFrameInContext(GraphicsContext*, const FloatRect&) = 0; 186 186 virtual void setPreload(MediaPlayer::Preload) override; 187 187 virtual PlatformLayer* platformLayer() const { return 0; } … … 266 266 void setDelayCallbacks(bool) const; 267 267 void setIgnoreLoadStateChanges(bool delay) { m_ignoreLoadStateChanges = delay; } 268 void setNaturalSize( IntSize);268 void setNaturalSize(FloatSize); 269 269 bool isLiveStream() const { return std::isinf(duration()); } 270 270 … … 321 321 MediaPlayer::Preload m_preload; 322 322 323 IntSize m_cachedNaturalSize;323 FloatSize m_cachedNaturalSize; 324 324 mutable MediaTime m_cachedMaxTimeLoaded; 325 325 mutable MediaTime m_cachedMaxTimeSeekable; -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
r180532 r180839 107 107 void createImageGenerator(); 108 108 void destroyImageGenerator(); 109 RetainPtr<CGImageRef> createImageForTimeInRect(const MediaTime&, const IntRect&);109 RetainPtr<CGImageRef> createImageForTimeInRect(const MediaTime&, const FloatRect&); 110 110 111 111 void createAssetForURL(const String& url, bool inheritURI); … … 832 832 } 833 833 834 void MediaPlayerPrivateAVFoundationCF::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& rect)834 void MediaPlayerPrivateAVFoundationCF::paintCurrentFrameInContext(GraphicsContext* context, const FloatRect& rect) 835 835 { 836 836 ASSERT(isMainThread()); … … 847 847 } 848 848 849 void MediaPlayerPrivateAVFoundationCF::paint(GraphicsContext* context, const IntRect& rect)849 void MediaPlayerPrivateAVFoundationCF::paint(GraphicsContext* context, const FloatRect& rect) 850 850 { 851 851 ASSERT(isMainThread()); … … 862 862 context->scale(FloatSize(1.0f, -1.0f)); 863 863 context->setImageInterpolationQuality(InterpolationLow); 864 IntRect paintRect(IntPoint(0, 0), IntSize(rect.width(), rect.height()));864 FloatRect paintRect(FloatPoint(), rect.size()); 865 865 CGContextDrawImage(context->platformContext(), CGRectMake(0, 0, paintRect.width(), paintRect.height()), image.get()); 866 866 context->restore(); … … 2001 2001 } 2002 2002 2003 RetainPtr<CGImageRef> AVFWrapper::createImageForTimeInRect(const MediaTime& time, const IntRect& rect)2003 RetainPtr<CGImageRef> AVFWrapper::createImageForTimeInRect(const MediaTime& time, const FloatRect& rect) 2004 2004 { 2005 2005 if (!m_imageGenerator) -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h
r180406 r180839 76 76 virtual void setVolume(float); 77 77 virtual void setClosedCaptionsVisible(bool); 78 virtual void paint(GraphicsContext*, const IntRect&);79 virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);78 virtual void paint(GraphicsContext*, const FloatRect&); 79 virtual void paintCurrentFrameInContext(GraphicsContext*, const FloatRect&); 80 80 virtual PlatformLayer* platformLayer() const; 81 81 virtual bool supportsAcceleratedRendering() const { return true; } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
r180416 r180839 151 151 virtual void setVolume(float); 152 152 virtual void setClosedCaptionsVisible(bool); 153 virtual void paint(GraphicsContext*, const IntRect&);154 virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);153 virtual void paint(GraphicsContext*, const FloatRect&); 154 virtual void paintCurrentFrameInContext(GraphicsContext*, const FloatRect&); 155 155 virtual PlatformLayer* platformLayer() const; 156 156 #if PLATFORM(IOS) … … 218 218 void createImageGenerator(); 219 219 void destroyImageGenerator(); 220 RetainPtr<CGImageRef> createImageForTimeInRect(float, const IntRect&);221 void paintWithImageGenerator(GraphicsContext*, const IntRect&);220 RetainPtr<CGImageRef> createImageForTimeInRect(float, const FloatRect&); 221 void paintWithImageGenerator(GraphicsContext*, const FloatRect&); 222 222 223 223 #if HAVE(AVFOUNDATION_VIDEO_OUTPUT) … … 227 227 void updateLastImage(); 228 228 bool videoOutputHasAvailableFrame(); 229 void paintWithVideoOutput(GraphicsContext*, const IntRect&);229 void paintWithVideoOutput(GraphicsContext*, const FloatRect&); 230 230 virtual PassNativeImagePtr nativeImageForCurrentTime() override; 231 231 void waitForVideoOutputMediaDataWillChange(); -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r180532 r180839 1467 1467 } 1468 1468 1469 void MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& rect)1469 void MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext(GraphicsContext* context, const FloatRect& rect) 1470 1470 { 1471 1471 if (!metaDataAvailable() || context->paintingDisabled()) … … 1488 1488 } 1489 1489 1490 void MediaPlayerPrivateAVFoundationObjC::paint(GraphicsContext* context, const IntRect& rect)1490 void MediaPlayerPrivateAVFoundationObjC::paint(GraphicsContext* context, const FloatRect& rect) 1491 1491 { 1492 1492 if (!metaDataAvailable() || context->paintingDisabled()) … … 1504 1504 } 1505 1505 1506 void MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator(GraphicsContext* context, const IntRect& rect)1506 void MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator(GraphicsContext* context, const FloatRect& rect) 1507 1507 { 1508 1508 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator(%p)", this); … … 1536 1536 } 1537 1537 1538 RetainPtr<CGImageRef> MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect(float time, const IntRect& rect)1538 RetainPtr<CGImageRef> MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect(float time, const FloatRect& rect) 1539 1539 { 1540 1540 if (!m_imageGenerator) … … 1828 1828 #endif 1829 1829 1830 presentationSizeDidChange(firstEnabledVideoTrack ? IntSize(CGSizeApplyAffineTransform([firstEnabledVideoTrack naturalSize], [firstEnabledVideoTrack preferredTransform])) : IntSize());1830 presentationSizeDidChange(firstEnabledVideoTrack ? FloatSize(CGSizeApplyAffineTransform([firstEnabledVideoTrack naturalSize], [firstEnabledVideoTrack preferredTransform])) : FloatSize()); 1831 1831 } else { 1832 1832 bool hasVideo = false; … … 2122 2122 return; 2123 2123 2124 setNaturalSize( roundedIntSize(m_cachedPresentationSize));2124 setNaturalSize(m_cachedPresentationSize); 2125 2125 } 2126 2126 … … 2274 2274 } 2275 2275 2276 void MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput(GraphicsContext* context, const IntRect& outputRect)2276 void MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput(GraphicsContext* context, const FloatRect& outputRect) 2277 2277 { 2278 2278 if (m_videoOutput && !m_lastImage && !videoOutputHasAvailableFrame()) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
r180406 r180839 116 116 virtual bool supportsScanning() const override; 117 117 118 virtual IntSize naturalSize() const override;118 virtual FloatSize naturalSize() const override; 119 119 120 120 virtual bool hasVideo() const override; … … 141 141 virtual void setSize(const IntSize&) override; 142 142 143 virtual void paint(GraphicsContext*, const IntRect&) override;144 virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&) override;143 virtual void paint(GraphicsContext*, const FloatRect&) override; 144 virtual void paintCurrentFrameInContext(GraphicsContext*, const FloatRect&) override; 145 145 146 146 virtual bool hasAvailableVideoFrame() const override; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r180532 r180839 346 346 } 347 347 348 IntSize MediaPlayerPrivateMediaSourceAVFObjC::naturalSize() const348 FloatSize MediaPlayerPrivateMediaSourceAVFObjC::naturalSize() const 349 349 { 350 350 if (!m_mediaSourcePrivate) 351 return IntSize();351 return FloatSize(); 352 352 353 353 return m_mediaSourcePrivate->naturalSize(); … … 513 513 } 514 514 515 void MediaPlayerPrivateMediaSourceAVFObjC::paint(GraphicsContext*, const IntRect&)515 void MediaPlayerPrivateMediaSourceAVFObjC::paint(GraphicsContext*, const FloatRect&) 516 516 { 517 517 // FIXME(125157): Implement painting. 518 518 } 519 519 520 void MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext(GraphicsContext*, const IntRect&)520 void MediaPlayerPrivateMediaSourceAVFObjC::paintCurrentFrameInContext(GraphicsContext*, const FloatRect&) 521 521 { 522 522 // FIXME(125157): Implement painting. -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h
r173197 r180839 76 76 void seekToTime(const MediaTime&); 77 77 MediaTime fastSeekTimeForMediaTime(const MediaTime&, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold); 78 IntSize naturalSize() const;78 FloatSize naturalSize() const; 79 79 80 80 private: -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm
r173318 r180839 199 199 } 200 200 201 IntSize MediaSourcePrivateAVFObjC::naturalSize() const202 { 203 IntSize result;201 FloatSize MediaSourcePrivateAVFObjC::naturalSize() const 202 { 203 FloatSize result; 204 204 205 205 for (auto* sourceBuffer : m_activeSourceBuffers) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
r175000 r180839 94 94 void seekToTime(MediaTime); 95 95 MediaTime fastSeekTimeForMediaTime(MediaTime, MediaTime negativeThreshold, MediaTime positiveThreshold); 96 IntSize naturalSize();96 FloatSize naturalSize(); 97 97 98 98 int protectedTrackID() const { return m_protectedTrackID; } -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
r180065 r180839 891 891 if (!m_displayLayer) { 892 892 m_displayLayer = adoptNS([allocAVSampleBufferDisplayLayerInstance() init]); 893 #ifndef NDEBUG 894 [m_displayLayer setName:@"SourceBufferPrivateAVFObjC AVSampleBufferDisplayLayer"]; 895 #endif 893 896 [m_displayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{ 894 897 didBecomeReadyForMoreSamples(trackID); … … 1077 1080 } 1078 1081 1079 IntSize SourceBufferPrivateAVFObjC::naturalSize()1080 { 1081 return roundedIntSize(m_cachedSize);1082 FloatSize SourceBufferPrivateAVFObjC::naturalSize() 1083 { 1084 return m_cachedSize; 1082 1085 } 1083 1086 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h
r165676 r180839 56 56 int trackID() { return m_trackID; } 57 57 58 IntSize naturalSize() const;58 FloatSize naturalSize() const; 59 59 60 60 private: -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.mm
r174823 r180839 81 81 } 82 82 83 IntSize VideoTrackPrivateMediaSourceAVFObjC::naturalSize() const83 FloatSize VideoTrackPrivateMediaSourceAVFObjC::naturalSize() const 84 84 { 85 return IntSize([assetTrack() naturalSize]);85 return FloatSize([assetTrack() naturalSize]); 86 86 } 87 87 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r179985 r180839 130 130 131 131 // Returns the size of the video 132 IntSize MediaPlayerPrivateGStreamerBase::naturalSize() const132 FloatSize MediaPlayerPrivateGStreamerBase::naturalSize() const 133 133 { 134 134 if (!hasVideo()) 135 return IntSize();135 return FloatSize(); 136 136 137 137 if (!m_videoSize.isEmpty()) … … 140 140 WTF::GMutexLocker<GMutex> lock(m_sampleMutex); 141 141 if (!m_sample) 142 return IntSize();142 return FloatSize(); 143 143 144 144 GstCaps* caps = gst_sample_get_caps(m_sample); 145 145 if (!caps) 146 return IntSize();146 return FloatSize(); 147 147 148 148 … … 158 158 GstVideoFormat format; 159 159 if (!getVideoSizeAndFormatFromCaps(caps, originalSize, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride)) 160 return IntSize();160 return FloatSize(); 161 161 162 162 LOG_MEDIA_MESSAGE("Original video size: %dx%d", originalSize.width(), originalSize.height()); … … 189 189 190 190 LOG_MEDIA_MESSAGE("Natural size: %" G_GUINT64_FORMAT "x%" G_GUINT64_FORMAT, width, height); 191 m_videoSize = IntSize(static_cast<int>(width), static_cast<int>(height));191 m_videoSize = FloatSize(static_cast<int>(width), static_cast<int>(height)); 192 192 return m_videoSize; 193 193 } … … 352 352 } 353 353 354 void MediaPlayerPrivateGStreamerBase::paint(GraphicsContext* context, const IntRect& rect)354 void MediaPlayerPrivateGStreamerBase::paint(GraphicsContext* context, const FloatRect& rect) 355 355 { 356 356 #if USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
r175370 r180839 58 58 virtual ~MediaPlayerPrivateGStreamerBase(); 59 59 60 IntSize naturalSize() const;60 FloatSize naturalSize() const; 61 61 62 62 void setVolume(float); … … 79 79 80 80 void triggerRepaint(GstSample*); 81 void paint(GraphicsContext*, const IntRect&);81 void paint(GraphicsContext*, const FloatRect&); 82 82 83 83 virtual bool hasSingleSecurityOrigin() const { return true; } … … 130 130 unsigned long m_volumeSignalHandler; 131 131 unsigned long m_muteSignalHandler; 132 mutable IntSize m_videoSize;132 mutable FloatSize m_videoSize; 133 133 #if USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) 134 134 PassRefPtr<BitmapTexture> updateTexture(TextureMapper*); -
trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
r180406 r180839 77 77 PlatformLayer* platformLayer() const; 78 78 79 IntSize naturalSize() const;79 FloatSize naturalSize() const override; 80 80 bool hasVideo() const; 81 81 bool hasAudio() const; … … 125 125 virtual bool hasAvailableVideoFrame() const; 126 126 127 void paint(GraphicsContext*, const IntRect&);128 void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);127 void paint(GraphicsContext*, const FloatRect&); 128 void paintCurrentFrameInContext(GraphicsContext*, const FloatRect&); 129 129 virtual void prepareForRendering(); 130 130 -
trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
r180532 r180839 710 710 } 711 711 712 IntSize MediaPlayerPrivateQTKit::naturalSize() const712 FloatSize MediaPlayerPrivateQTKit::naturalSize() const 713 713 { 714 714 if (!metaDataAvailable()) 715 return IntSize();715 return FloatSize(); 716 716 717 717 // In spite of the name of this method, return QTMovieNaturalSizeAttribute transformed by the … … 733 733 m_cachedNaturalSize = naturalSize; 734 734 } 735 736 return IntSize(naturalSize.width() * m_scaleFactor.width(), naturalSize.height() * m_scaleFactor.height()); 735 736 naturalSize.scale(m_scaleFactor.width(), m_scaleFactor.height()); 737 return naturalSize; 737 738 } 738 739 … … 1182 1183 } 1183 1184 1184 void MediaPlayerPrivateQTKit::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& r)1185 void MediaPlayerPrivateQTKit::paintCurrentFrameInContext(GraphicsContext* context, const FloatRect& r) 1185 1186 { 1186 1187 id qtVideoRenderer = m_qtVideoRenderer.get(); … … 1196 1197 } 1197 1198 1198 void MediaPlayerPrivateQTKit::paint(GraphicsContext* context, const IntRect& r)1199 void MediaPlayerPrivateQTKit::paint(GraphicsContext* context, const FloatRect& r) 1199 1200 { 1200 1201 if (context->paintingDisabled() || m_hasUnsupportedTracks) … … 1208 1209 NSGraphicsContext* newContext; 1209 1210 FloatSize scaleFactor(1.0f, -1.0f); 1210 IntRect paintRect(IntPoint(0, 0), IntSize(r.width(), r.height()));1211 FloatRect paintRect(FloatPoint(), r.size()); 1211 1212 1212 1213 GraphicsContextStateSaver stateSaver(*context); -
trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
r180641 r180839 144 144 } 145 145 146 IntSize MediaPlayerPrivateMediaFoundation::naturalSize() const146 FloatSize MediaPlayerPrivateMediaFoundation::naturalSize() const 147 147 { 148 148 return m_size; … … 222 222 } 223 223 224 void MediaPlayerPrivateMediaFoundation::paint(GraphicsContext* context, const IntRect& rect)224 void MediaPlayerPrivateMediaFoundation::paint(GraphicsContext* context, const FloatRect& rect) 225 225 { 226 226 if (context->paintingDisabled() -
trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
r180406 r180839 50 50 virtual void pause(); 51 51 52 virtual IntSize naturalSize() const;52 virtual FloatSize naturalSize() const; 53 53 54 54 virtual bool hasVideo() const; … … 70 70 virtual void setSize(const IntSize&); 71 71 72 virtual void paint(GraphicsContext*, const IntRect&);72 virtual void paint(GraphicsContext*, const FloatRect&); 73 73 74 74 private: … … 82 82 HWND m_hwndVideo; 83 83 MediaPlayer::ReadyState m_readyState; 84 IntRect m_lastPaintRect;84 FloatRect m_lastPaintRect; 85 85 86 86 COMPtr<IMFMediaSession> m_mediaSession; -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp
r180532 r180839 119 119 } 120 120 121 IntSize MockMediaPlayerMediaSource::naturalSize() const122 { 123 return IntSize();121 FloatSize MockMediaPlayerMediaSource::naturalSize() const 122 { 123 return FloatSize(); 124 124 } 125 125 … … 180 180 } 181 181 182 void MockMediaPlayerMediaSource::paint(GraphicsContext*, const IntRect&)182 void MockMediaPlayerMediaSource::paint(GraphicsContext*, const FloatRect&) 183 183 { 184 184 } -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h
r180406 r180839 64 64 virtual void play() override; 65 65 virtual void pause() override; 66 virtual IntSize naturalSize() const override;66 virtual FloatSize naturalSize() const override; 67 67 virtual bool hasVideo() const override; 68 68 virtual bool hasAudio() const override; … … 75 75 virtual bool didLoadingProgress() const override; 76 76 virtual void setSize(const IntSize&) override; 77 virtual void paint(GraphicsContext*, const IntRect&) override;77 virtual void paint(GraphicsContext*, const FloatRect&) override; 78 78 virtual MediaTime currentMediaTime() const override; 79 79 virtual MediaTime durationMediaTime() const override; -
trunk/Source/WebCore/rendering/RenderVideo.cpp
r177259 r180839 107 107 MediaPlayer* player = videoElement().player(); 108 108 if (player && videoElement().readyState() >= HTMLVideoElement::HAVE_METADATA) { 109 LayoutSize size = player->naturalSize();109 LayoutSize size(player->naturalSize()); 110 110 if (!size.isEmpty()) 111 111 return size; … … 190 190 paintIntoRect(context, rect); 191 191 else if (view().frameView().paintBehavior() & PaintBehaviorFlattenCompositingLayers) 192 mediaPlayer->paintCurrentFrameInContext(context, snappedIntRect(rect));192 mediaPlayer->paintCurrentFrameInContext(context, rect); 193 193 else 194 mediaPlayer->paint(context, snappedIntRect(rect));194 mediaPlayer->paint(context, rect); 195 195 } 196 196
Note: See TracChangeset
for help on using the changeset viewer.