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

Side by Side Diff: Source/core/paint/SVGMaskPainter.cpp

Issue 1180233005: Do not emit display items for masks and clips that are already cached (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « Source/core/paint/SVGMaskPainter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/SVGMaskPainter.h" 6 #include "core/paint/SVGMaskPainter.h"
7 7
8 #include "core/layout/svg/LayoutSVGResourceMasker.h" 8 #include "core/layout/svg/LayoutSVGResourceMasker.h"
9 #include "core/paint/CompositingRecorder.h" 9 #include "core/paint/CompositingRecorder.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LayoutObjectDrawingRecorder.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 { 45 {
46 ASSERT(context); 46 ASSERT(context);
47 ASSERT(m_mask.style()); 47 ASSERT(m_mask.style());
48 ASSERT_WITH_SECURITY_IMPLICATION(!m_mask.needsLayout()); 48 ASSERT_WITH_SECURITY_IMPLICATION(!m_mask.needsLayout());
49 49
50 FloatRect paintInvalidationRect = object.paintInvalidationRectInLocalCoordin ates(); 50 FloatRect paintInvalidationRect = object.paintInvalidationRectInLocalCoordin ates();
51 { 51 {
52 ColorFilter maskLayerFilter = m_mask.style()->svgStyle().maskType() == M T_LUMINANCE 52 ColorFilter maskLayerFilter = m_mask.style()->svgStyle().maskType() == M T_LUMINANCE
53 ? ColorFilterLuminanceToAlpha : ColorFilterNone; 53 ? ColorFilterLuminanceToAlpha : ColorFilterNone;
54 CompositingRecorder maskCompositing(*context, object, SkXfermode::kDstIn _Mode, 1, &paintInvalidationRect, maskLayerFilter); 54 CompositingRecorder maskCompositing(*context, object, SkXfermode::kDstIn _Mode, 1, &paintInvalidationRect, maskLayerFilter);
55 drawMaskForLayoutObject(context, object, object.objectBoundingBox()); 55 drawMaskForLayoutObject(context, object, object.objectBoundingBox(), pai ntInvalidationRect);
56 } 56 }
57 57
58 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 58 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
59 ASSERT(context->displayItemList()); 59 ASSERT(context->displayItemList());
60 if (context->displayItemList()->displayItemConstructionIsDisabled()) 60 if (context->displayItemList()->displayItemConstructionIsDisabled())
61 return; 61 return;
62 context->displayItemList()->add(EndCompositingDisplayItem::create(object )); 62 context->displayItemList()->add(EndCompositingDisplayItem::create(object ));
63 } else { 63 } else {
64 EndCompositingDisplayItem endCompositingContent(object); 64 EndCompositingDisplayItem endCompositingContent(object);
65 endCompositingContent.replay(*context); 65 endCompositingContent.replay(*context);
66 } 66 }
67 } 67 }
68 68
69 void SVGMaskPainter::drawMaskForLayoutObject(GraphicsContext* context, const Lay outObject& layoutObject, const FloatRect& targetBoundingBox) 69 void SVGMaskPainter::drawMaskForLayoutObject(GraphicsContext* context, const Lay outObject& layoutObject, const FloatRect& targetBoundingBox, const FloatRect& ta rgetPaintInvalidationRect)
70 { 70 {
71 ASSERT(context); 71 ASSERT(context);
72 72
73 AffineTransform contentTransformation; 73 AffineTransform contentTransformation;
74 RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(con tentTransformation, targetBoundingBox, context); 74 RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(con tentTransformation, targetBoundingBox, context);
75 75
76 TransformRecorder recorder(*context, layoutObject, contentTransformation); 76 LayoutObjectDrawingRecorder drawingRecorder(*context, layoutObject, DisplayI tem::SVGMask, targetPaintInvalidationRect);
77 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 77 if (drawingRecorder.canUseCachedDrawing())
78 ASSERT(context->displayItemList()); 78 return;
79 if (context->displayItemList()->displayItemConstructionIsDisabled()) 79
80 return; 80 context->save();
81 context->displayItemList()->add(DrawingDisplayItem::create(layoutObject, DisplayItem::SVGMask, maskContentPicture)); 81 context->concatCTM(contentTransformation);
82 } else { 82 context->drawPicture(maskContentPicture.get());
83 DrawingDisplayItem maskPicture(layoutObject, DisplayItem::SVGClip, maskC ontentPicture); 83 context->restore();
84 maskPicture.replay(*context);
85 }
86 } 84 }
87 85
88 } 86 }
OLDNEW
« no previous file with comments | « Source/core/paint/SVGMaskPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698