| OLD | NEW |
| 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/PaintInfo.h" | 8 #include "core/layout/PaintInfo.h" |
| 9 #include "core/layout/svg/LayoutSVGResourceMasker.h" | 9 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
| 10 #include "core/paint/CompositingRecorder.h" | 10 #include "core/paint/CompositingRecorder.h" |
| 11 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 11 #include "core/paint/TransformRecorder.h" | 12 #include "core/paint/TransformRecorder.h" |
| 12 #include "platform/graphics/paint/CompositingDisplayItem.h" | 13 #include "platform/graphics/paint/CompositingDisplayItem.h" |
| 13 #include "platform/graphics/paint/DisplayItemList.h" | 14 #include "platform/graphics/paint/DisplayItemList.h" |
| 14 #include "platform/graphics/paint/DrawingDisplayItem.h" | 15 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 bool SVGMaskPainter::prepareEffect(const LayoutObject& object, GraphicsContext*
context) | 19 bool SVGMaskPainter::prepareEffect(const LayoutObject& object, GraphicsContext*
context) |
| 19 { | 20 { |
| 20 ASSERT(context); | 21 ASSERT(context); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 64 |
| 64 void SVGMaskPainter::drawMaskForLayoutObject(GraphicsContext* context, const Lay
outObject& layoutObject, const FloatRect& targetBoundingBox) | 65 void SVGMaskPainter::drawMaskForLayoutObject(GraphicsContext* context, const Lay
outObject& layoutObject, const FloatRect& targetBoundingBox) |
| 65 { | 66 { |
| 66 ASSERT(context); | 67 ASSERT(context); |
| 67 | 68 |
| 68 AffineTransform contentTransformation; | 69 AffineTransform contentTransformation; |
| 69 RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(con
tentTransformation, targetBoundingBox); | 70 RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(con
tentTransformation, targetBoundingBox); |
| 70 | 71 |
| 71 TransformRecorder recorder(*context, layoutObject, contentTransformation); | 72 TransformRecorder recorder(*context, layoutObject, contentTransformation); |
| 72 | 73 |
| 73 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 74 LayoutObjectDrawingRecorder drawingRecorder(*context, layoutObject, DisplayI
tem::SVGMask, LayoutRect::infiniteIntRect()); |
| 74 ASSERT(context->displayItemList()); | 75 if (!drawingRecorder.canUseCachedDrawing()) |
| 75 context->displayItemList()->add(DrawingDisplayItem::create(layoutObject,
DisplayItem::SVGMask, maskContentPicture)); | 76 context->drawPicture(maskContentPicture.get()); |
| 76 } else { | |
| 77 DrawingDisplayItem maskPicture(layoutObject, DisplayItem::SVGMask, maskC
ontentPicture); | |
| 78 maskPicture.replay(*context); | |
| 79 } | |
| 80 } | 77 } |
| 81 | 78 |
| 82 } | 79 } |
| OLD | NEW |