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

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

Issue 379253002: Initial implementation of display list backed 2D canvases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: compile error fix Created 6 years, 5 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/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.

Powered by Google App Engine
This is Rietveld 408576698