#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()))
{
}
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();
+ }
+}
+
}