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

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

Issue 379253002: Initial implementation of display list backed 2D canvases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: will it blend 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/GraphicsContext.cpp
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
index 0d60ab5ea5016517e80d54591797bf3c2151678e..a754949392459abea98add772fef954ec19d0bc2 100644
--- a/Source/platform/graphics/GraphicsContext.cpp
+++ b/Source/platform/graphics/GraphicsContext.cpp
@@ -155,6 +155,13 @@ GraphicsContext::~GraphicsContext()
#endif
}
+void GraphicsContext::resetCanvas(SkCanvas* canvas)
+{
+ ASSERT(canvas);
+ m_canvas = canvas;
+ m_opaqueRegion.reset();
+}
+
void GraphicsContext::save()
{
if (contextDisabled())
@@ -1044,6 +1051,22 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, const FloatRect& dest,
image->draw(this, dest, src, op);
}
+void GraphicsContext::drawPicture(PassRefPtr<SkPicture> picture, const FloatRect& dest, const FloatRect& src, CompositeOperator op, WebBlendMode blendMode)
+{
+ if (contextDisabled() || !picture)
+ return;
+
+ SkPaint picturePaint;
+ picturePaint.setXfermode(WebCoreCompositeToSkiaComposite(op, blendMode).get());
+ SkRect skBounds = WebCoreFloatRectToSKRect(dest);
+ saveLayer(&skBounds, &picturePaint);
+ SkMatrix pictureTransform;
+ pictureTransform.setRectToRect(WebCoreFloatRectToSKRect(src), skBounds, SkMatrix::kFill_ScaleToFit);
+ m_canvas->concat(pictureTransform);
+ picture->draw(m_canvas);
+ restoreLayer();
+}
+
void GraphicsContext::writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y)
{
if (contextDisabled())

Powered by Google App Engine
This is Rietveld 408576698