Changeset 50343 in webkit


Ignore:
Timestamp:
Oct 30, 2009 10:43:29 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-10-30 Sebastian Dröge <sebastian.droege@collabora.co.uk>

Reviewed by Gustavo Noronha.

  • platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivate::paint): Add some comments to explain what is happening here.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r50342 r50343  
     12009-10-30  Sebastian Dröge  <sebastian.droege@collabora.co.uk>
     2
     3        Reviewed by Gustavo Noronha.
     4
     5        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
     6        (WebCore::MediaPlayerPrivate::paint):
     7        Add some comments to explain what is happening here.
     8
    192009-10-30  Alexander Pavlov  <apavlov@chromium.org>
    210
  • trunk/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp

    r50295 r50343  
    662662    cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
    663663
     664    // Calculate the display width/height from the storage width/height and the pixel aspect ratio
    664665    displayWidth *= doublePixelAspectRatioNumerator / doublePixelAspectRatioDenominator;
    665666    displayHeight *= doublePixelAspectRatioDenominator / doublePixelAspectRatioNumerator;
    666667
    667     scale = MIN (rect.width () / displayWidth, rect.height () / displayHeight);
     668    // Calculate the largest scale factor that would fill the target surface
     669    scale = MIN(rect.width() / displayWidth, rect.height() / displayHeight);
     670    // And calculate the new display width/height
    668671    displayWidth *= scale;
    669672    displayHeight *= scale;
    670673
    671     // Calculate gap between border an picture
     674    // Calculate gap between border an picture on every side
    672675    gapWidth = (rect.width() - displayWidth) / 2.0;
    673676    gapHeight = (rect.height() - displayHeight) / 2.0;
    674677
    675     // paint the rectangle on the context and draw the surface inside.
     678    // Paint the rectangle on the context and draw the buffer inside the rectangle
     679
     680    // Go to the new origin and center the video frame.
    676681    cairo_translate(cr, rect.x() + gapWidth, rect.y() + gapHeight);
    677682    cairo_rectangle(cr, 0, 0, rect.width(), rect.height());
     683    // Scale the video frame according to the pixel aspect ratio.
    678684    cairo_scale(cr, doublePixelAspectRatioNumerator / doublePixelAspectRatioDenominator,
    679685                doublePixelAspectRatioDenominator / doublePixelAspectRatioNumerator);
     686    // Scale the video frame to fill the target surface as good as possible.
    680687    cairo_scale(cr, scale, scale);
     688    // And paint it.
    681689    cairo_set_source_surface(cr, src, 0, 0);
    682690    cairo_fill(cr);
Note: See TracChangeset for help on using the changeset viewer.