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

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

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 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 unified diff | Download patch
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 "core/paint/SVGMaskPainter.h" 5 #include "core/paint/SVGMaskPainter.h"
6 6
7 #include "core/layout/svg/LayoutSVGResourceMasker.h" 7 #include "core/layout/svg/LayoutSVGResourceMasker.h"
8 #include "core/paint/LayoutObjectDrawingRecorder.h" 8 #include "core/paint/LayoutObjectDrawingRecorder.h"
9 #include "core/paint/PaintInfo.h" 9 #include "core/paint/PaintInfo.h"
10 #include "core/paint/TransformRecorder.h" 10 #include "core/paint/TransformRecorder.h"
11 #include "platform/graphics/paint/CompositingDisplayItem.h" 11 #include "platform/graphics/paint/CompositingDisplayItem.h"
12 #include "platform/graphics/paint/CompositingRecorder.h" 12 #include "platform/graphics/paint/CompositingRecorder.h"
13 #include "platform/graphics/paint/DrawingDisplayItem.h" 13 #include "platform/graphics/paint/DrawingDisplayItem.h"
14 #include "platform/graphics/paint/PaintController.h" 14 #include "platform/graphics/paint/PaintController.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 bool SVGMaskPainter::prepareEffect(const LayoutObject& object, GraphicsContext& context) 18 bool SVGMaskPainter::prepareEffect(const LayoutObject& object, GraphicsContext& context)
19 { 19 {
20 ASSERT(m_mask.style()); 20 ASSERT(m_mask.style());
21 ASSERT_WITH_SECURITY_IMPLICATION(!m_mask.needsLayout()); 21 ASSERT_WITH_SECURITY_IMPLICATION(!m_mask.needsLayout());
22 22
23 m_mask.clearInvalidationMask(); 23 m_mask.clearInvalidationMask();
24 24
25 FloatRect paintInvalidationRect = object.paintInvalidationRectInLocalCoordin ates(); 25 FloatRect paintInvalidationRect = object.paintInvalidationRectInLocalCoordin ates();
26 if (paintInvalidationRect.isEmpty() || !m_mask.element()->hasChildren()) 26 if (paintInvalidationRect.isEmpty() || !m_mask.element()->hasChildren())
27 return false; 27 return false;
28 28
29 context.paintController().createAndAppend<BeginCompositingDisplayItem>(objec t, SkXfermode::kSrcOver_Mode, 1, &paintInvalidationRect); 29 context.getPaintController().createAndAppend<BeginCompositingDisplayItem>(ob ject, SkXfermode::kSrcOver_Mode, 1, &paintInvalidationRect);
30 return true; 30 return true;
31 } 31 }
32 32
33 void SVGMaskPainter::finishEffect(const LayoutObject& object, GraphicsContext& c ontext) 33 void SVGMaskPainter::finishEffect(const LayoutObject& object, GraphicsContext& c ontext)
34 { 34 {
35 ASSERT(m_mask.style()); 35 ASSERT(m_mask.style());
36 ASSERT_WITH_SECURITY_IMPLICATION(!m_mask.needsLayout()); 36 ASSERT_WITH_SECURITY_IMPLICATION(!m_mask.needsLayout());
37 37
38 FloatRect paintInvalidationRect = object.paintInvalidationRectInLocalCoordin ates(); 38 FloatRect paintInvalidationRect = object.paintInvalidationRectInLocalCoordin ates();
39 { 39 {
40 ColorFilter maskLayerFilter = m_mask.style()->svgStyle().maskType() == M T_LUMINANCE 40 ColorFilter maskLayerFilter = m_mask.style()->svgStyle().maskType() == M T_LUMINANCE
41 ? ColorFilterLuminanceToAlpha : ColorFilterNone; 41 ? ColorFilterLuminanceToAlpha : ColorFilterNone;
42 CompositingRecorder maskCompositing(context, object, SkXfermode::kDstIn_ Mode, 1, &paintInvalidationRect, maskLayerFilter); 42 CompositingRecorder maskCompositing(context, object, SkXfermode::kDstIn_ Mode, 1, &paintInvalidationRect, maskLayerFilter);
43 drawMaskForLayoutObject(context, object, object.objectBoundingBox(), pai ntInvalidationRect); 43 drawMaskForLayoutObject(context, object, object.objectBoundingBox(), pai ntInvalidationRect);
44 } 44 }
45 45
46 context.paintController().endItem<EndCompositingDisplayItem>(object); 46 context.getPaintController().endItem<EndCompositingDisplayItem>(object);
47 } 47 }
48 48
49 void SVGMaskPainter::drawMaskForLayoutObject(GraphicsContext& context, const Lay outObject& layoutObject, const FloatRect& targetBoundingBox, const FloatRect& ta rgetPaintInvalidationRect) 49 void SVGMaskPainter::drawMaskForLayoutObject(GraphicsContext& context, const Lay outObject& layoutObject, const FloatRect& targetBoundingBox, const FloatRect& ta rgetPaintInvalidationRect)
50 { 50 {
51 AffineTransform contentTransformation; 51 AffineTransform contentTransformation;
52 RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(con tentTransformation, targetBoundingBox, context); 52 RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(con tentTransformation, targetBoundingBox, context);
53 53
54 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutO bject, DisplayItem::SVGMask)) 54 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, layoutO bject, DisplayItem::SVGMask))
55 return; 55 return;
56 56
57 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt em::SVGMask, targetPaintInvalidationRect); 57 LayoutObjectDrawingRecorder drawingRecorder(context, layoutObject, DisplayIt em::SVGMask, targetPaintInvalidationRect);
58 context.save(); 58 context.save();
59 context.concatCTM(contentTransformation); 59 context.concatCTM(contentTransformation);
60 context.drawPicture(maskContentPicture.get()); 60 context.drawPicture(maskContentPicture.get());
61 context.restore(); 61 context.restore();
62 } 62 }
63 63
64 } // namespace blink 64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698