[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
eric at webkit.org
eric at webkit.org
Thu Oct 29 20:43:16 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit bf0ed05c712c38210fc8246a7ce420d80efc85ad
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 12 14:34:39 2009 +0000
2009-10-12 Sebastian Dröge <sebastian.droege at collabora.co.uk>
Reviewed by Gustavo Noronha.
https://bugs.webkit.org/show_bug.cgi?id=29998
Scale video to completely fill the target surface while
keeping the aspect ratio. This fixes displaying of the
YouTube HTML5 sample website.
* platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
Scale video to completely fill the target surface, keep
the aspect ratio and center it.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7300cf3..ee8712f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,20 @@
Reviewed by Gustavo Noronha.
+ https://bugs.webkit.org/show_bug.cgi?id=29998
+
+ Scale video to completely fill the target surface while
+ keeping the aspect ratio. This fixes displaying of the
+ YouTube HTML5 sample website.
+
+ * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+ Scale video to completely fill the target surface, keep
+ the aspect ratio and center it.
+
+2009-10-12 Sebastian Dröge <sebastian.droege at collabora.co.uk>
+
+ Reviewed by Gustavo Noronha.
+
https://bugs.webkit.org/show_bug.cgi?id=29997
Fixes double memcpy of all rendered video frames.
diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
index de48226..76b992f 100644
--- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
@@ -656,6 +656,10 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
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);
if (!gst_video_format_parse_caps(caps, NULL, &width, &height) ||
@@ -664,6 +668,8 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
return;
}
+ displayWidth = width;
+ displayHeight = height;
doublePixelAspectRatioNumerator = pixelAspectRatioNumerator;
doublePixelAspectRatioDenominator = pixelAspectRatioDenominator;
@@ -676,11 +682,23 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
cairo_save(cr);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ displayWidth *= doublePixelAspectRatioNumerator / doublePixelAspectRatioDenominator;
+ displayHeight *= doublePixelAspectRatioDenominator / doublePixelAspectRatioNumerator;
+
+ scale = MIN (rect.width () / displayWidth, rect.height () / displayHeight);
+ displayWidth *= scale;
+ displayHeight *= scale;
+
+ // Calculate gap between border an picture
+ gapWidth = (rect.width() - displayWidth) / 2.0;
+ gapHeight = (rect.height() - displayHeight) / 2.0;
+
// paint the rectangle on the context and draw the surface inside.
- cairo_translate(cr, rect.x(), rect.y());
+ cairo_translate(cr, rect.x() + gapWidth, rect.y() + gapHeight);
cairo_rectangle(cr, 0, 0, rect.width(), rect.height());
cairo_scale(cr, doublePixelAspectRatioNumerator / doublePixelAspectRatioDenominator,
doublePixelAspectRatioDenominator / doublePixelAspectRatioNumerator);
+ cairo_scale(cr, scale, scale);
cairo_set_source_surface(cr, src, 0, 0);
cairo_fill(cr);
cairo_restore(cr);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list