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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMasker.cpp

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: three Rs: rebase, readme, review Created 3 years, 11 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 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #include "core/layout/svg/LayoutSVGResourceMasker.h" 20 #include "core/layout/svg/LayoutSVGResourceMasker.h"
21 21
22 #include "core/dom/ElementTraversal.h" 22 #include "core/dom/ElementTraversal.h"
23 #include "core/layout/svg/SVGLayoutSupport.h" 23 #include "core/layout/svg/SVGLayoutSupport.h"
24 #include "core/paint/SVGPaintContext.h" 24 #include "core/paint/SVGPaintContext.h"
25 #include "core/svg/SVGElement.h" 25 #include "core/svg/SVGElement.h"
26 #include "platform/graphics/paint/PaintRecord.h"
26 #include "platform/graphics/paint/SkPictureBuilder.h" 27 #include "platform/graphics/paint/SkPictureBuilder.h"
27 #include "platform/transforms/AffineTransform.h" 28 #include "platform/transforms/AffineTransform.h"
28 #include "third_party/skia/include/core/SkPicture.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 LayoutSVGResourceMasker::LayoutSVGResourceMasker(SVGMaskElement* node) 32 LayoutSVGResourceMasker::LayoutSVGResourceMasker(SVGMaskElement* node)
33 : LayoutSVGResourceContainer(node) {} 33 : LayoutSVGResourceContainer(node) {}
34 34
35 LayoutSVGResourceMasker::~LayoutSVGResourceMasker() {} 35 LayoutSVGResourceMasker::~LayoutSVGResourceMasker() {}
36 36
37 void LayoutSVGResourceMasker::removeAllClientsFromCache( 37 void LayoutSVGResourceMasker::removeAllClientsFromCache(
38 bool markForInvalidation) { 38 bool markForInvalidation) {
39 m_maskContentPicture.reset(); 39 m_maskContentPicture.reset();
40 m_maskContentBoundaries = FloatRect(); 40 m_maskContentBoundaries = FloatRect();
41 markAllClientsForInvalidation(markForInvalidation 41 markAllClientsForInvalidation(markForInvalidation
42 ? LayoutAndBoundariesInvalidation 42 ? LayoutAndBoundariesInvalidation
43 : ParentOnlyInvalidation); 43 : ParentOnlyInvalidation);
44 } 44 }
45 45
46 void LayoutSVGResourceMasker::removeClientFromCache(LayoutObject* client, 46 void LayoutSVGResourceMasker::removeClientFromCache(LayoutObject* client,
47 bool markForInvalidation) { 47 bool markForInvalidation) {
48 ASSERT(client); 48 ASSERT(client);
49 markClientForInvalidation(client, markForInvalidation 49 markClientForInvalidation(client, markForInvalidation
50 ? BoundariesInvalidation 50 ? BoundariesInvalidation
51 : ParentOnlyInvalidation); 51 : ParentOnlyInvalidation);
52 } 52 }
53 53
54 sk_sp<const SkPicture> LayoutSVGResourceMasker::createContentPicture( 54 sk_sp<const PaintRecord> LayoutSVGResourceMasker::createContentPicture(
55 AffineTransform& contentTransformation, 55 AffineTransform& contentTransformation,
56 const FloatRect& targetBoundingBox, 56 const FloatRect& targetBoundingBox,
57 GraphicsContext& context) { 57 GraphicsContext& context) {
58 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element()) 58 SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())
59 ->maskContentUnits() 59 ->maskContentUnits()
60 ->currentValue() 60 ->currentValue()
61 ->enumValue(); 61 ->enumValue();
62 if (contentUnits == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) { 62 if (contentUnits == SVGUnitTypes::kSvgUnitTypeObjectboundingbox) {
63 contentTransformation.translate(targetBoundingBox.x(), 63 contentTransformation.translate(targetBoundingBox.x(),
64 targetBoundingBox.y()); 64 targetBoundingBox.y());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 transform.scaleNonUniform(objectBoundingBox.width(), 134 transform.scaleNonUniform(objectBoundingBox.width(),
135 objectBoundingBox.height()); 135 objectBoundingBox.height());
136 maskRect = transform.mapRect(maskRect); 136 maskRect = transform.mapRect(maskRect);
137 } 137 }
138 138
139 maskRect.intersect(maskBoundaries); 139 maskRect.intersect(maskBoundaries);
140 return maskRect; 140 return maskRect;
141 } 141 }
142 142
143 } // namespace blink 143 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698