Changeset 49439 in webkit
- Timestamp:
- Oct 12, 2009 7:34:39 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49438 r49439 1 2009-10-12 Sebastian Dröge <sebastian.droege@collabora.co.uk> 2 3 Reviewed by Gustavo Noronha. 4 5 https://bugs.webkit.org/show_bug.cgi?id=29998 6 7 Scale video to completely fill the target surface while 8 keeping the aspect ratio. This fixes displaying of the 9 YouTube HTML5 sample website. 10 11 * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: 12 Scale video to completely fill the target surface, keep 13 the aspect ratio and center it. 14 1 15 2009-10-12 Sebastian Dröge <sebastian.droege@collabora.co.uk> 2 16 -
trunk/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
r49438 r49439 657 657 double doublePixelAspectRatioNumerator = 0; 658 658 double doublePixelAspectRatioDenominator = 0; 659 double displayWidth; 660 double displayHeight; 661 double scale, gapHeight, gapWidth; 662 659 663 GstCaps *caps = gst_buffer_get_caps(m_buffer); 660 664 … … 665 669 } 666 670 671 displayWidth = width; 672 displayHeight = height; 667 673 doublePixelAspectRatioNumerator = pixelAspectRatioNumerator; 668 674 doublePixelAspectRatioDenominator = pixelAspectRatioDenominator; … … 677 683 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); 678 684 685 displayWidth *= doublePixelAspectRatioNumerator / doublePixelAspectRatioDenominator; 686 displayHeight *= doublePixelAspectRatioDenominator / doublePixelAspectRatioNumerator; 687 688 scale = MIN (rect.width () / displayWidth, rect.height () / displayHeight); 689 displayWidth *= scale; 690 displayHeight *= scale; 691 692 // Calculate gap between border an picture 693 gapWidth = (rect.width() - displayWidth) / 2.0; 694 gapHeight = (rect.height() - displayHeight) / 2.0; 695 679 696 // paint the rectangle on the context and draw the surface inside. 680 cairo_translate(cr, rect.x() , rect.y());697 cairo_translate(cr, rect.x() + gapWidth, rect.y() + gapHeight); 681 698 cairo_rectangle(cr, 0, 0, rect.width(), rect.height()); 682 699 cairo_scale(cr, doublePixelAspectRatioNumerator / doublePixelAspectRatioDenominator, 683 700 doublePixelAspectRatioDenominator / doublePixelAspectRatioNumerator); 701 cairo_scale(cr, scale, scale); 684 702 cairo_set_source_surface(cr, src, 0, 0); 685 703 cairo_fill(cr);
Note: See TracChangeset
for help on using the changeset viewer.