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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePattern.h

Issue 2894843002: Revert of Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: rebase TestExpectations Created 3 years, 7 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) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * Copyright 2014 The Chromium Authors. All rights reserved. 4 * Copyright 2014 The Chromium Authors. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 14 matching lines...) Expand all
25 #include <memory> 25 #include <memory>
26 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" 26 #include "core/layout/svg/LayoutSVGResourcePaintServer.h"
27 #include "core/svg/PatternAttributes.h" 27 #include "core/svg/PatternAttributes.h"
28 #include "platform/heap/Handle.h" 28 #include "platform/heap/Handle.h"
29 #include "platform/wtf/HashMap.h" 29 #include "platform/wtf/HashMap.h"
30 #include "third_party/skia/include/core/SkRefCnt.h" 30 #include "third_party/skia/include/core/SkRefCnt.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 class AffineTransform; 34 class AffineTransform;
35 class FloatRect;
35 class SVGPatternElement; 36 class SVGPatternElement;
36 struct PatternData; 37 struct PatternData;
37 38
38 class LayoutSVGResourcePattern final : public LayoutSVGResourcePaintServer { 39 class LayoutSVGResourcePattern final : public LayoutSVGResourcePaintServer {
39 public: 40 public:
40 explicit LayoutSVGResourcePattern(SVGPatternElement*); 41 explicit LayoutSVGResourcePattern(SVGPatternElement*);
41 42
42 const char* GetName() const override { return "LayoutSVGResourcePattern"; } 43 const char* GetName() const override { return "LayoutSVGResourcePattern"; }
43 44
44 void RemoveAllClientsFromCache(bool mark_for_invalidation = true) override; 45 void RemoveAllClientsFromCache(bool mark_for_invalidation = true) override;
45 void RemoveClientFromCache(LayoutObject*, 46 void RemoveClientFromCache(LayoutObject*,
46 bool mark_for_invalidation = true) override; 47 bool mark_for_invalidation = true) override;
47 48
48 SVGPaintServer PreparePaintServer(const LayoutObject&) override; 49 SVGPaintServer PreparePaintServer(const LayoutObject&) override;
49 50
50 static const LayoutSVGResourceType kResourceType = kPatternResourceType; 51 static const LayoutSVGResourceType kResourceType = kPatternResourceType;
51 LayoutSVGResourceType ResourceType() const override { return kResourceType; } 52 LayoutSVGResourceType ResourceType() const override { return kResourceType; }
52 53
53 private: 54 private:
54 std::unique_ptr<PatternData> BuildPatternData(const LayoutObject&); 55 std::unique_ptr<PatternData> BuildPatternData(const LayoutObject&);
55 sk_sp<PaintRecord> AsPaintRecord(const FloatSize&, 56 sk_sp<PaintRecord> AsPaintRecord(const FloatRect& tile,
56 const AffineTransform&) const; 57 const AffineTransform&) const;
57 PatternData* PatternForLayoutObject(const LayoutObject&); 58 PatternData* PatternForLayoutObject(const LayoutObject&);
58 59
59 const LayoutSVGResourceContainer* ResolveContentElement() const; 60 const LayoutSVGResourceContainer* ResolveContentElement() const;
60 61
61 bool should_collect_pattern_attributes_ : 1; 62 bool should_collect_pattern_attributes_ : 1;
62 Persistent<PatternAttributesWrapper> attributes_wrapper_; 63 Persistent<PatternAttributesWrapper> attributes_wrapper_;
63 64
64 PatternAttributes& MutableAttributes() { 65 PatternAttributes& MutableAttributes() {
65 return attributes_wrapper_->Attributes(); 66 return attributes_wrapper_->Attributes();
66 } 67 }
67 const PatternAttributes& Attributes() const { 68 const PatternAttributes& Attributes() const {
68 return attributes_wrapper_->Attributes(); 69 return attributes_wrapper_->Attributes();
69 } 70 }
70 71
71 // FIXME: we can almost do away with this per-object map, but not quite: the 72 // FIXME: we can almost do away with this per-object map, but not quite: the
72 // tile size can be relative to the client bounding box, and it gets captured 73 // tile size can be relative to the client bounding box, and it gets captured
73 // in the cached Pattern shader. 74 // in the cached Pattern shader.
74 // Hence, we need one Pattern shader per client. The display list OTOH is the 75 // Hence, we need one Pattern shader per client. The display list OTOH is the
75 // same => we should be able to cache a single display list per 76 // same => we should be able to cache a single display list per
76 // LayoutSVGResourcePattern + one Pattern(shader) for each client -- this 77 // LayoutSVGResourcePattern + one Pattern(shader) for each client -- this
77 // would avoid re-recording when multiple clients share the same pattern. 78 // would avoid re-recording when multiple clients share the same pattern.
78 HashMap<const LayoutObject*, std::unique_ptr<PatternData>> pattern_map_; 79 HashMap<const LayoutObject*, std::unique_ptr<PatternData>> pattern_map_;
79 }; 80 };
80 81
81 } // namespace blink 82 } // namespace blink
82 83
83 #endif 84 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698