Index: Source/platform/graphics/ImageBuffer.cpp |
diff --git a/Source/platform/graphics/ImageBuffer.cpp b/Source/platform/graphics/ImageBuffer.cpp |
index e699db0c1584b5fa801252f98748fc13e8986e5d..ef575f944a61c02525b62a13ed0d12d395cd300d 100644 |
--- a/Source/platform/graphics/ImageBuffer.cpp |
+++ b/Source/platform/graphics/ImageBuffer.cpp |
@@ -52,6 +52,7 @@ |
#include "public/platform/WebExternalTextureMailbox.h" |
#include "public/platform/WebGraphicsContext3D.h" |
#include "public/platform/WebGraphicsContext3DProvider.h" |
+#include "third_party/skia/include/core/SkPicture.h" |
#include "third_party/skia/include/effects/SkTableColorFilter.h" |
#include "wtf/MathExtras.h" |
#include "wtf/text/Base64.h" |
@@ -80,12 +81,12 @@ ImageBuffer::ImageBuffer(PassOwnPtr<ImageBufferSurface> surface) |
: m_surface(surface) |
, m_client(0) |
{ |
- m_surface->setImageBuffer(this); |
if (m_surface->canvas()) { |
m_context = adoptPtr(new GraphicsContext(m_surface->canvas())); |
m_context->setCertainlyOpaque(m_surface->opacityMode() == Opaque); |
m_context->setAccelerated(m_surface->isAccelerated()); |
} |
+ m_surface->setImageBuffer(this); |
} |
ImageBuffer::~ImageBuffer() |
@@ -242,6 +243,12 @@ void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons |
return; |
FloatRect srcRect = srcPtr ? *srcPtr : FloatRect(FloatPoint(), size()); |
+ RefPtr<SkPicture> picture = m_surface->getPicture(); |
+ if (picture) { |
+ context->drawPicture(picture.release(), destRect, srcRect, op, blink::WebBlendModeNormal); |
+ return; |
+ } |
+ |
SkBitmap bitmap = m_surface->bitmap(); |
// For ImageBufferSurface that enables cachedBitmap, Use the cached Bitmap for CPU side usage |
// if it is available, otherwise generate and use it. |