Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: Source/platform/graphics/ImageBuffer.cpp

Issue 1288773005: 2D canvas: remain in deferred rendering mode with canvas to canvas drawImage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add init of snapShot state Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/ImageBuffer.cpp
diff --git a/Source/platform/graphics/ImageBuffer.cpp b/Source/platform/graphics/ImageBuffer.cpp
index 12a631e173a4618d5632b44681869de5f3be4717..e69d87a7a380dab35bb8c7a9d3c98f886d313a58 100644
--- a/Source/platform/graphics/ImageBuffer.cpp
+++ b/Source/platform/graphics/ImageBuffer.cpp
@@ -78,6 +78,7 @@ PassOwnPtr<ImageBuffer> ImageBuffer::create(const IntSize& size, OpacityMode opa
ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface)
: m_surface(surface)
, m_client(0)
+ , m_snapshotState(InitialSnapshotState)
{
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();
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698