Fix the issue that short black glitch when switching bandwidth.
[framework/web/webkit-efl.git] / Source / WebCore / platform / graphics / gstreamer / tizen / SharedVideoPlatformSurfaceTizen.cpp
index dc7536f..bb9aaff 100644 (file)
@@ -50,6 +50,7 @@ public:
 
     int id() const { return m_platformSurface; }
     void paintCurrentFrameInContext(GraphicsContext*, const IntRect&);
+    void copySurface(VideoPlatformSurface* other);
     bool hasAlpha() { return m_hasAlpha; }
 
 private:
@@ -122,6 +123,16 @@ void VideoPlatformSurface::paintCurrentFrameInContext(GraphicsContext* context,
     cairo_surface_destroy(surface);
 }
 
+void VideoPlatformSurface::copySurface(VideoPlatformSurface* other)
+{
+    RefPtr<cairo_surface_t> surface = adoptRef(cairo_xlib_surface_create(m_nativeDisplay, m_platformSurface, DefaultVisual(m_nativeDisplay, DefaultScreen(m_nativeDisplay)), m_size.width(), m_size.height()));
+    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()));
+    other->paintCurrentFrameInContext(graphicsContext.get(), IntRect());
+}
+
 bool VideoPlatformSurface::initialize(IntSize size)
 {
     if (!createPlatformSurface(size))
@@ -324,6 +335,12 @@ void SharedVideoPlatformSurfaceTizen::paintCurrentFrameInContext(GraphicsContext
         m_platformSurface->paintCurrentFrameInContext(context, rect);
 }
 
+void SharedVideoPlatformSurfaceTizen::copySurface(SharedVideoPlatformSurfaceTizen* other)
+{
+    if (m_platformSurface)
+        m_platformSurface->copySurface(other->m_platformSurface.get());
+}
+
 void SharedVideoPlatformSurfaceTizen::registerDamageHandler()
 {
     if (!m_platformSurface)