Chromium Code Reviews| 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/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" |
| 11 #include "core/paint/PaintInfo.h" | 11 #include "core/paint/PaintInfo.h" |
| 12 #include "core/paint/TransformRecorder.h" | |
| 13 #include "platform/graphics/paint/CompositingDisplayItem.h" | 12 #include "platform/graphics/paint/CompositingDisplayItem.h" |
| 14 #include "platform/graphics/paint/DisplayItemList.h" | 13 #include "platform/graphics/paint/DisplayItemList.h" |
| 15 #include "platform/graphics/paint/DrawingDisplayItem.h" | |
| 16 | 14 |
| 17 namespace blink { | 15 namespace blink { |
| 18 | 16 |
| 19 bool SVGMaskPainter::prepareEffect(const LayoutObject& object, GraphicsContext* context) | 17 bool SVGMaskPainter::prepareEffect(const LayoutObject& object, GraphicsContext* context) |
| 20 { | 18 { |
| 21 ASSERT(context); | 19 ASSERT(context); |
| 22 ASSERT(m_mask.style()); | 20 ASSERT(m_mask.style()); |
| 23 ASSERT_WITH_SECURITY_IMPLICATION(!m_mask.needsLayout()); | 21 ASSERT_WITH_SECURITY_IMPLICATION(!m_mask.needsLayout()); |
| 24 | 22 |
| 25 m_mask.clearInvalidationMask(); | 23 m_mask.clearInvalidationMask(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 } | 64 } |
| 67 } | 65 } |
| 68 | 66 |
| 69 void SVGMaskPainter::drawMaskForLayoutObject(GraphicsContext* context, const Lay outObject& layoutObject, const FloatRect& targetBoundingBox) | 67 void SVGMaskPainter::drawMaskForLayoutObject(GraphicsContext* context, const Lay outObject& layoutObject, const FloatRect& targetBoundingBox) |
| 70 { | 68 { |
| 71 ASSERT(context); | 69 ASSERT(context); |
| 72 | 70 |
| 73 AffineTransform contentTransformation; | 71 AffineTransform contentTransformation; |
| 74 RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(con tentTransformation, targetBoundingBox); | 72 RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(con tentTransformation, targetBoundingBox); |
| 75 | 73 |
| 76 TransformRecorder recorder(*context, layoutObject, contentTransformation); | 74 LayoutObjectDrawingRecorder drawingRecorder(*context, layoutObject, DisplayI tem::SVGMask, targetBoundingBox); |
|
fs
2015/06/12 08:12:31
targetBoundingBox could be too tight - maybe expos
| |
| 77 | 75 if (!drawingRecorder.canUseCachedDrawing()) { |
|
fs
2015/06/12 08:12:31
Early out?
| |
| 78 LayoutObjectDrawingRecorder drawingRecorder(*context, layoutObject, DisplayI tem::SVGMask, LayoutRect::infiniteIntRect()); | 76 context->save(); |
|
chrishtr
2015/06/12 16:03:03
Curious: why did the infinite rect not work?
| |
| 79 if (!drawingRecorder.canUseCachedDrawing()) | 77 context->concatCTM(contentTransformation); |
| 80 context->drawPicture(maskContentPicture.get()); | 78 context->drawPicture(maskContentPicture.get()); |
| 79 context->restore(); | |
| 80 } | |
| 81 } | 81 } |
| 82 | 82 |
| 83 } | 83 } |
| OLD | NEW |