Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / graphics / DisplayList.cpp
index c16d351..f8fa9ff 100644 (file)
 #include "config.h"
 #include "platform/graphics/DisplayList.h"
 
+#include "platform/geometry/IntSize.h"
 #include "third_party/skia/include/core/SkPicture.h"
+#include "third_party/skia/include/core/SkPictureRecorder.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
 DisplayList::DisplayList(const FloatRect& bounds)
     : m_bounds(bounds)
-    , m_picture(adoptRef(new SkPicture()))
 {
 }
 
@@ -55,4 +57,20 @@ SkPicture* DisplayList::picture() const
     return m_picture.get();
 }
 
+SkCanvas* DisplayList::beginRecording(const IntSize& size, uint32_t recordFlags)
+{
+    m_picture.clear();
+    if (!m_recorder)
+        m_recorder = adoptPtr(new SkPictureRecorder);
+    return m_recorder->beginRecording(size.width(), size.height(), 0, recordFlags);
+}
+
+void DisplayList::endRecording()
+{
+    if (m_recorder) {
+        m_picture = adoptRef(m_recorder->endRecording());
+        m_recorder.clear();
+    }
+}
+
 }