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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef DrawingDisplayItem_h 5 #ifndef DrawingDisplayItem_h
6 #define DrawingDisplayItem_h 6 #define DrawingDisplayItem_h
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "platform/PlatformExport.h" 9 #include "platform/PlatformExport.h"
10 #include "platform/RuntimeEnabledFeatures.h" 10 #include "platform/RuntimeEnabledFeatures.h"
11 #include "platform/geometry/FloatRect.h" 11 #include "platform/geometry/FloatPoint.h"
12 #include "platform/graphics/paint/DisplayItem.h" 12 #include "platform/graphics/paint/DisplayItem.h"
13 #include "platform/graphics/paint/PaintRecord.h" 13 #include "platform/graphics/paint/PaintRecord.h"
14 #include "third_party/skia/include/core/SkRefCnt.h" 14 #include "third_party/skia/include/core/SkRefCnt.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 // DrawingDisplayItem contains recorded painting operations which can be
19 // replayed to produce a rastered output.
20 //
21 // This class has two notions of the bounds around the content that was recorded
22 // and will be produced by the item. The first is the |record_bounds| which
23 // describes the bounds of all content in the |record| in the space of the
24 // record. The second is the |visual_rect| which should describe the same thing,
25 // but takes into account transforms and clips that would apply to the
26 // PaintRecord, and is in the space of the DisplayItemList. This allows the
27 // visual_rect to be compared between DrawingDisplayItems, and to give bounds
28 // around what the user can actually see from the PaintRecord.
29 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { 18 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem {
30 public: 19 public:
31 DISABLE_CFI_PERF 20 DISABLE_CFI_PERF
32 DrawingDisplayItem(const DisplayItemClient& client, 21 DrawingDisplayItem(const DisplayItemClient& client,
33 Type type, 22 Type type,
34 sk_sp<const PaintRecord> record, 23 sk_sp<const PaintRecord> record,
35 const FloatRect& record_bounds,
36 bool known_to_be_opaque = false) 24 bool known_to_be_opaque = false)
37 : DisplayItem(client, type, sizeof(*this)), 25 : DisplayItem(client, type, sizeof(*this)),
38 record_(record && record->size() ? std::move(record) : nullptr), 26 record_(record && record->size() ? std::move(record) : nullptr),
39 record_bounds_(record_bounds),
40 known_to_be_opaque_(known_to_be_opaque) { 27 known_to_be_opaque_(known_to_be_opaque) {
41 DCHECK(IsDrawingType(type)); 28 DCHECK(IsDrawingType(type));
42 } 29 }
43 30
44 void Replay(GraphicsContext&) const override; 31 void Replay(GraphicsContext&) const override;
45 void AppendToWebDisplayItemList(const IntRect& visual_rect, 32 void AppendToWebDisplayItemList(const IntRect&,
46 WebDisplayItemList*) const override; 33 WebDisplayItemList*) const override;
47 bool DrawsContent() const override; 34 bool DrawsContent() const override;
48 35
49 const sk_sp<const PaintRecord>& GetPaintRecord() const { return record_; } 36 const sk_sp<const PaintRecord>& GetPaintRecord() const { return record_; }
50 // This rect is described in the coordinate space relative to the PaintRecord
51 // whose bounds it describes.
52 FloatRect GetPaintRecordBounds() const { return record_bounds_; }
53 37
54 bool KnownToBeOpaque() const { 38 bool KnownToBeOpaque() const {
55 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 39 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
56 return known_to_be_opaque_; 40 return known_to_be_opaque_;
57 } 41 }
58 42
59 int NumberOfSlowPaths() const override; 43 int NumberOfSlowPaths() const override;
60 44
61 private: 45 private:
62 #ifndef NDEBUG 46 #ifndef NDEBUG
63 void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; 47 void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override;
64 #endif 48 #endif
65 bool Equals(const DisplayItem& other) const final; 49 bool Equals(const DisplayItem& other) const final;
66 50
67 sk_sp<const PaintRecord> record_; 51 sk_sp<const PaintRecord> record_;
68 FloatRect record_bounds_;
69 52
70 // True if there are no transparent areas. Only used for SlimmingPaintV2. 53 // True if there are no transparent areas. Only used for SlimmingPaintV2.
71 const bool known_to_be_opaque_; 54 const bool known_to_be_opaque_;
72 }; 55 };
73 56
74 } // namespace blink 57 } // namespace blink
75 58
76 #endif // DrawingDisplayItem_h 59 #endif // DrawingDisplayItem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698