| Index: Source/platform/graphics/ImageBuffer.cpp
|
| diff --git a/Source/platform/graphics/ImageBuffer.cpp b/Source/platform/graphics/ImageBuffer.cpp
|
| index 12a631e173a4618d5632b44681869de5f3be4717..ece9dc7433d21ba3177ece5950bb03cc5136dd95 100644
|
| --- a/Source/platform/graphics/ImageBuffer.cpp
|
| +++ b/Source/platform/graphics/ImageBuffer.cpp
|
| @@ -76,7 +76,8 @@ PassOwnPtr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opa
|
| }
|
|
|
| ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface)
|
| - : m_surface(surface)
|
| + : m_snapshotState(InitialSnapshotState)
|
| + , m_surface(surface)
|
| , m_client(0)
|
| {
|
| m_surface->setImageBuffer(this);
|
| @@ -149,6 +150,9 @@ void ImageBuffer::resetCanvas(SkCanvas* canvas) const
|
|
|
| PassRefPtr<SkImage> ImageBuffer::newSkImageSnapshot() const
|
| {
|
| + if (m_snapshotState == InitialSnapshotState)
|
| + m_snapshotState = DidAcquireSnapshot;
|
| +
|
| if (!isSurfaceValid())
|
| return nullptr;
|
| return m_surface->newImageSnapshot();
|
| @@ -156,14 +160,19 @@ PassRefPtr<SkImage> ImageBuffer::newSkImageSnapshot() const
|
|
|
| PassRefPtr<Image> ImageBuffer::newImageSnapshot() const
|
| {
|
| - if (!isSurfaceValid())
|
| - return nullptr;
|
| - RefPtr<SkImage> snapshot = m_surface->newImageSnapshot();
|
| + RefPtr<SkImage> snapshot = newSkImageSnapshot();
|
| if (!snapshot)
|
| return nullptr;
|
| return StaticBitmapImage::create(snapshot);
|
| }
|
|
|
| +void ImageBuffer::didDraw(const FloatRect& rect) const
|
| +{
|
| + if (m_snapshotState == DidAcquireSnapshot)
|
| + m_snapshotState = DrawnToAfterSnapshot;
|
| + m_surface->didDraw(rect);
|
| +}
|
| +
|
| WebLayer* ImageBuffer::platformLayer() const
|
| {
|
| return m_surface->layer();
|
|
|