Index: Source/platform/graphics/ImageBuffer.cpp |
diff --git a/Source/platform/graphics/ImageBuffer.cpp b/Source/platform/graphics/ImageBuffer.cpp |
index f5eb85e735415ef9707a1b6dc70e5144a855bb3e..35f25d397e7153317557edd336693bf90b4978e2 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() |
@@ -236,6 +237,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. |