[WinCairo][MediaFoundation] Video rendered at wrong position.
authorpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Nov 2015 21:49:51 +0000 (21:49 +0000)
committerpeavo@outlook.com <peavo@outlook.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Nov 2015 21:49:51 +0000 (21:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151271

Reviewed by Alex Christensen.

The source rectangle used when blitting a frame to the graphics context
should have offset (0, 0).

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192441 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp

index fc91e61..dfa64c0 100644 (file)
@@ -1,3 +1,16 @@
+2015-11-13  Per Arne Vollan  <peavo@outlook.com>
+
+        [WinCairo][MediaFoundation] Video rendered at wrong position.
+        https://bugs.webkit.org/show_bug.cgi?id=151271
+
+        Reviewed by Alex Christensen.
+
+        The source rectangle used when blitting a frame to the graphics context
+        should have offset (0, 0).
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
+
 2015-11-13  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Provide a way to override the WKWebView remote inspector name
index 831520d..7a34d57 100644 (file)
@@ -2668,7 +2668,7 @@ HRESULT MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample(IMFS
     return hr;
 }
 
-void MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame(WebCore::GraphicsContext& context, const WebCore::FloatRect& r)
+void MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame(WebCore::GraphicsContext& context, const WebCore::FloatRect& destRect)
 {
     UINT width = m_destRect.right - m_destRect.left;
     UINT height = m_destRect.bottom - m_destRect.top;
@@ -2688,10 +2688,8 @@ void MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame(Web
 #if USE(CAIRO)
         WebCore::PlatformContextCairo* ctxt = context.platformContext();
         cairo_surface_t* image = cairo_image_surface_create_for_data(static_cast<unsigned char*>(data), CAIRO_FORMAT_ARGB32, width, height, pitch);
-        WebCore::FloatRect clip(0, 0, width, height);
-        WebCore::FloatRect rect = r;
-        rect.intersect(clip);
-        ctxt->drawSurfaceToContext(image, rect, rect, context);
+        FloatRect srcRect(0, 0, width, height);
+        ctxt->drawSurfaceToContext(image, destRect, srcRect, context);
         cairo_surface_destroy(image);
 #else
 #error "Platform needs to implement drawing of Direct3D surface to graphics context!"