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

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

Issue 23643003: ImageBuffer-less SVG masking and clipping. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed Linux rebaselines. Created 7 years, 4 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/core/platform/graphics/GraphicsContext.cpp
diff --git a/Source/core/platform/graphics/GraphicsContext.cpp b/Source/core/platform/graphics/GraphicsContext.cpp
index 60a7f88e0dcf4b7b44412e4932b1afca4495c65c..58b415f3f4990893f9aec065117f36b94c6a3fe0 100644
--- a/Source/core/platform/graphics/GraphicsContext.cpp
+++ b/Source/core/platform/graphics/GraphicsContext.cpp
@@ -130,11 +130,6 @@ void GraphicsContext::restore()
return;
}
- if (!m_state->m_imageBufferClip.empty()) {
- applyClipFromImage(m_state->m_clip, m_state->m_imageBufferClip);
- m_canvas->restore();
- }
-
m_stateStack.removeLast();
m_state = m_stateStack.last().get();
@@ -433,47 +428,6 @@ void GraphicsContext::endTransparencyLayer()
#endif
}
-void GraphicsContext::clipToImageBuffer(const ImageBuffer* imageBuffer, const FloatRect& rect)
-{
- if (paintingDisabled())
- return;
-
- SkRect bounds = WebCoreFloatRectToSKRect(rect);
-
- if (imageBuffer->internalSize().isEmpty()) {
- clipRect(bounds);
- return;
- }
-
- // Skia doesn't support clipping to an image, so we create a layer. The next
- // time restore is invoked the layer and |imageBuffer| are combined to
- // create the resulting image.
- m_state->m_clip = bounds;
-
- // Get the absolute coordinates of the stored clipping rectangle to make it
- // independent of any transform changes.
- getTotalMatrix().mapRect(&m_state->m_clip);
-
- SkCanvas::SaveFlags saveFlags = static_cast<SkCanvas::SaveFlags>(SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag);
- saveLayer(&bounds, 0, saveFlags);
-
- const SkBitmap* bitmap = imageBuffer->context()->bitmap();
-
- if (m_trackOpaqueRegion) {
- SkRect opaqueRect = bitmap->isOpaque() ? m_state->m_clip : SkRect::MakeEmpty();
- m_opaqueRegion.setImageMask(opaqueRect);
- }
-
- // Copy off the image as |imageBuffer| may be deleted before restore is invoked.
- if (bitmap->isImmutable())
- m_state->m_imageBufferClip = *bitmap;
- else {
- // We need to make a deep-copy of the pixels themselves, so they don't
- // change on us between now and when we want to apply them in restore()
- bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config);
- }
-}
-
void GraphicsContext::setupPaintForFilling(SkPaint* paint) const
{
if (paintingDisabled())
@@ -1870,23 +1824,6 @@ void GraphicsContext::setupShader(SkPaint* paint, Gradient* grad, Pattern* pat,
paint->setShader(shader.get());
}
-
-void GraphicsContext::applyClipFromImage(const SkRect& rect, const SkBitmap& imageBuffer)
-{
- if (paintingDisabled())
- return;
-
- // NOTE: this assumes the image mask contains opaque black for the portions that are to be shown, as such we
- // only look at the alpha when compositing. I'm not 100% sure this is what WebKit expects for image clipping.
- SkPaint paint;
- paint.setXfermodeMode(SkXfermode::kDstIn_Mode);
- realizeSave(SkCanvas::kMatrixClip_SaveFlag);
- m_canvas->save(SkCanvas::kMatrix_SaveFlag);
- m_canvas->resetMatrix();
- m_canvas->drawBitmapRect(imageBuffer, 0, rect, &paint);
- m_canvas->restore();
-}
-
void GraphicsContext::didDrawTextInRect(const SkRect& textRect)
{
if (m_trackTextRegion) {

Powered by Google App Engine
This is Rietveld 408576698