[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:30:33 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit bafd0ab116a1595f7c07dbf9d0674d272f526975
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 11 11:24:56 2009 +0000

    2009-11-11  Benjamin Otte  <otte at gnome.org>
    
            Reviewed by Jan Alonzo.
    
            [GTK] Black artifacts in youtube.com/html5
    
            Paint the video to the given size. It's the job of the callers to keep
            track of aspect ratio. RenderVideo.cpp does it for the <video>
            element.
            https://bugs.webkit.org/show_bug.cgi?id=30925
    
            * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
            (WebCore::MediaPlayerPrivate::paint):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50798 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b87c5a5..2e957b1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-11-11  Benjamin Otte  <otte at gnome.org>
+
+        Reviewed by Jan Alonzo.
+
+        [GTK] Black artifacts in youtube.com/html5
+
+        Paint the video to the given size. It's the job of the callers to keep
+        track of aspect ratio. RenderVideo.cpp does it for the <video>
+        element.
+        https://bugs.webkit.org/show_bug.cgi?id=30925
+
+        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivate::paint):
+
 2009-11-11  Joanmarie Diggs  <joanmarie.diggs at gmail.com>
 
         Reviewed by Reviewed by Jan Alonzo.
diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
index 34c6d88..52b2647 100644
--- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
@@ -686,28 +686,14 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
         return;
 
     int width = 0, height = 0;
-    int pixelAspectRatioNumerator = 0;
-    int pixelAspectRatioDenominator = 0;
-    double doublePixelAspectRatioNumerator = 0;
-    double doublePixelAspectRatioDenominator = 0;
-    double displayWidth;
-    double displayHeight;
-    double scale, gapHeight, gapWidth;
+    GstCaps *caps = gst_buffer_get_caps(m_buffer);
     GstVideoFormat format;
 
-    GstCaps* caps = gst_buffer_get_caps(m_buffer);
-
-    if (G_UNLIKELY(!gst_video_format_parse_caps(caps, &format, &width, &height)
-                   || !gst_video_parse_caps_pixel_aspect_ratio(caps, &pixelAspectRatioNumerator, &pixelAspectRatioDenominator))) {
+    if (!gst_video_format_parse_caps(caps, &format, &width, &height)) {
       gst_caps_unref(caps);
       return;
     }
 
-    displayWidth = width;
-    displayHeight = height;
-    doublePixelAspectRatioNumerator = pixelAspectRatioNumerator;
-    doublePixelAspectRatioDenominator = pixelAspectRatioDenominator;
-
     cairo_format_t cairoFormat;
     if (format == GST_VIDEO_FORMAT_ARGB || format == GST_VIDEO_FORMAT_BGRA)
         cairoFormat = CAIRO_FORMAT_ARGB32;
@@ -721,34 +707,15 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
                                                                4 * width);
 
     cairo_save(cr);
-    cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-
-    // Calculate the display width/height from the storage width/height and the pixel aspect ratio
-    displayWidth *= doublePixelAspectRatioNumerator / doublePixelAspectRatioDenominator;
-    displayHeight *= doublePixelAspectRatioDenominator / doublePixelAspectRatioNumerator;
-
-    // Calculate the largest scale factor that would fill the target surface
-    scale = std::min(rect.width() / displayWidth, rect.height() / displayHeight);
-    // And calculate the new display width/height
-    displayWidth *= scale;
-    displayHeight *= scale;
-
-    // Calculate gap between border an picture on every side
-    gapWidth = (rect.width() - displayWidth) / 2.0;
-    gapHeight = (rect.height() - displayHeight) / 2.0;
-
-    // Paint the rectangle on the context and draw the buffer inside the rectangle
-
-    // Go to the new origin and center the video frame.
-    cairo_translate(cr, rect.x() + gapWidth, rect.y() + gapHeight);
-    cairo_rectangle(cr, 0, 0, rect.width(), rect.height());
-    // Scale the video frame according to the pixel aspect ratio.
-    cairo_scale(cr, doublePixelAspectRatioNumerator / doublePixelAspectRatioDenominator,
-                doublePixelAspectRatioDenominator / doublePixelAspectRatioNumerator);
-    // Scale the video frame to fill the target surface as good as possible.
-    cairo_scale(cr, scale, scale);
+
+    // translate and scale the context to correct size
+    cairo_translate(cr, rect.x(), rect.y());
+    cairo_scale(cr, static_cast<double>(rect.width()) / width, static_cast<double>(rect.height()) / height);
+
     // And paint it.
     cairo_set_source_surface(cr, src, 0, 0);
+    cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_PAD);
+    cairo_rectangle(cr, 0, 0, width, height);
     cairo_fill(cr);
     cairo_restore(cr);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list