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

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

Issue 214023002: Use default SkCanvas::saveLayer() flags. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/GraphicsContext.cpp
diff --git a/Source/platform/graphics/GraphicsContext.cpp b/Source/platform/graphics/GraphicsContext.cpp
index f4691ddf85cd5bb21342d48c83abaa746c5151dc..caad0a46e7b485d61540bd4ebb8b8832fecb3f45 100644
--- a/Source/platform/graphics/GraphicsContext.cpp
+++ b/Source/platform/graphics/GraphicsContext.cpp
@@ -179,20 +179,14 @@ void GraphicsContext::restore()
m_canvas->restoreToCount(savedState.m_restoreCount);
}
-void GraphicsContext::saveLayer(const SkRect* bounds, const SkPaint* paint, SkCanvas::SaveFlags saveFlags)
+void GraphicsContext::saveLayer(const SkRect* bounds, const SkPaint* paint)
{
if (paintingDisabled())
return;
realizeCanvasSave(SkCanvas::kMatrixClip_SaveFlag);
- // We should always save the matrix and clip to match upcoming Skia behavior.
- ASSERT(saveFlags & SkCanvas::kMatrix_SaveFlag);
- ASSERT(saveFlags & SkCanvas::kClip_SaveFlag);
-
- m_canvas->saveLayer(bounds, paint, saveFlags);
- if (bounds)
- m_canvas->clipRect(*bounds);
+ m_canvas->saveLayer(bounds, paint);
if (m_trackOpaqueRegion)
m_opaqueRegion.pushCanvasLayer(paint);
}
@@ -455,32 +449,17 @@ void GraphicsContext::beginLayer(float opacity, CompositeOperator op, const Floa
if (paintingDisabled())
return;
- // We need the "alpha" layer flag here because the base layer is opaque
- // (the surface of the page) but layers on top may have transparent parts.
- // Without explicitly setting the alpha flag, the layer will inherit the
- // opaque setting of the base and some things won't work properly.
- SkCanvas::SaveFlags saveFlags = static_cast<SkCanvas::SaveFlags>(
- SkCanvas::kMatrixClip_SaveFlag | SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag);
-
SkPaint layerPaint;
layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255));
layerPaint.setXfermode(WebCoreCompositeToSkiaComposite(op, m_paintState->blendMode()).get());
layerPaint.setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter).get());
layerPaint.setImageFilter(imageFilter);
- // Filters will adjust the clip to accomodate for filter bounds, but
- // need the kClipToLayer_SaveFlag to do so. We also save the clip here, so
- // it is restored back before the filtered layer is drawn in restore().
- // The matrix also needs to be saved, in order to be correctly passed to
- // the filter CTM during restore().
- if (imageFilter)
- saveFlags = SkCanvas::kARGB_ClipLayer_SaveFlag;
-
if (bounds) {
SkRect skBounds = WebCoreFloatRectToSKRect(*bounds);
- saveLayer(&skBounds, &layerPaint, saveFlags);
+ saveLayer(&skBounds, &layerPaint);
} else {
- saveLayer(0, &layerPaint, saveFlags);
+ saveLayer(0, &layerPaint);
}
#if !ASSERT_DISABLED
« no previous file with comments | « Source/platform/graphics/GraphicsContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698