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

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: applied review comments 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 d9e0b831e230952e687e3fb150246833f868a342..e548c3294482fba486f77d95d65b081b18ad38ca 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();
dshwang 2014/07/14 11:45:40 Don't we need to reset m_paintState, m_paintStateI
Justin Novosad 2014/07/17 18:34:14 To be spec compliant, we have to retain the state.
+}
+
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