Fix the issue that short black glitch when switching bandwidth.(2)
authorYongGeol Jung <yg48.jung@samsung.com>
Mon, 1 Apr 2013 03:49:09 +0000 (12:49 +0900)
committerYongGeol Jung <yg48.jung@samsung.com>
Mon, 1 Apr 2013 04:54:55 +0000 (13:54 +0900)
[Title] Fix the issue that short black glitch when switching bandwidth.(2)
[Issue#] ORANGE-141
[Problem] Short black glitch when switching bandwidth.
[Cause] After changing video size, new buffer which is not drawn was used for compositing.
[Solution] If current buffer is not updated yet, copy previous buffer.

Change-Id: I7e2d2d9822809704328fcef5fa7209fb7c4c6ae6

Source/WebCore/platform/graphics/gstreamer/tizen/SharedVideoPlatformSurfaceTizen.cpp

index bb9aaff..d5ae97e 100644 (file)
@@ -129,7 +129,16 @@ void VideoPlatformSurface::copySurface(VideoPlatformSurface* other)
     RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get()));
     OwnPtr<WebCore::GraphicsContext> graphicsContext = adoptPtr(new GraphicsContext(context.get()));
 
-    graphicsContext->scale(FloatSize((float)m_size.width() / other->m_size.width(), (float)m_size.height() / other->m_size.height()));
+    float xScale = static_cast<float>(m_size.width()) / other->m_size.width();
+    float yScale = static_cast<float>(m_size.height()) / other->m_size.height();
+
+    // Fit to width. (scale using xScale.)
+    // Copy to center of destination surface.
+    if (xScale != yScale) {
+        float yPosition = (m_size.height() - other->m_size.height() * xScale) / 2;
+        graphicsContext->translate(0, yPosition);
+    }
+    graphicsContext->scale(FloatSize(xScale, xScale));
     other->paintCurrentFrameInContext(graphicsContext.get(), IntRect());
 }