Chromium Code Reviews| 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()) |