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

Unified Diff: Source/platform/graphics/ImageBufferSurface.h

Issue 1195513002: Use SkImage snapshots for ImageBufferSurface texture access (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments Created 5 years, 6 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
Index: Source/platform/graphics/ImageBufferSurface.h
diff --git a/Source/platform/graphics/ImageBufferSurface.h b/Source/platform/graphics/ImageBufferSurface.h
index 50e9636d7d94abd432fd65419bbdd89f62a2898d..b6bbc276ceb00a6629efc6fbe70b0c7878e5ce66 100644
--- a/Source/platform/graphics/ImageBufferSurface.h
+++ b/Source/platform/graphics/ImageBufferSurface.h
@@ -62,11 +62,10 @@ public:
virtual void willAccessPixels() { }
virtual void didDraw(const FloatRect& rect) { }
virtual bool isValid() const = 0;
- virtual bool restore() { return false; };
- virtual WebLayer* layer() const { return 0; };
+ virtual bool restore() { return false; }
+ virtual WebLayer* layer() const { return 0; }
virtual bool isAccelerated() const { return false; }
virtual bool isRecording() const { return false; }
- virtual Platform3DObject getBackingTexture() const { return 0; }
virtual void didModifyBackingTexture() { }
virtual bool cachedBitmapEnabled() const { return false; }
virtual bool isExpensiveToPaint() { return false; }
@@ -80,10 +79,15 @@ public:
virtual void finalizeFrame(const FloatRect &dirtyRect) { }
virtual void willDrawVideo() { }
virtual void willOverwriteCanvas() { }
- virtual PassRefPtr<SkImage> newImageSnapshot() const;
virtual void draw(GraphicsContext*, const FloatRect& destRect, const FloatRect& srcRect, SkXfermode::Mode);
virtual void setHasExpensiveOp() { }
+ // These methods return an SkImage representing the backing texture. We support both variants
+ // to avoid the snapshot overhead (flushing deferred draws, COW semantics, fallback in
+ // RecordingImageBufferSurface) when not strictly required.
+ virtual PassRefPtr<SkImage> newImageSnapshot() const { return nullptr; }
+ virtual PassRefPtr<SkImage> getBackingTextureImage() const { return nullptr; }
+
OpacityMode opacityMode() const { return m_opacityMode; }
const IntSize& size() const { return m_size; }
void notifyIsValidChanged(bool isValid) const;

Powered by Google App Engine
This is Rietveld 408576698