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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h

Issue 2889653002: Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: movecullrect2 rebase-once-and-for-all 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/FloatPoint.h" 11 #include "platform/geometry/FloatRect.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.
18 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { 29 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem {
19 public: 30 public:
20 DISABLE_CFI_PERF 31 DISABLE_CFI_PERF
21 DrawingDisplayItem(const DisplayItemClient& client, 32 DrawingDisplayItem(const DisplayItemClient& client,
22 Type type, 33 Type type,
23 sk_sp<const PaintRecord> record, 34 sk_sp<const PaintRecord> record,
35 const FloatRect& record_bounds,
24 bool known_to_be_opaque = false) 36 bool known_to_be_opaque = false)
25 : DisplayItem(client, type, sizeof(*this)), 37 : DisplayItem(client, type, sizeof(*this)),
26 record_(record && record->size() ? std::move(record) : nullptr), 38 record_(record && record->size() ? std::move(record) : nullptr),
39 record_bounds_(record_bounds),
27 known_to_be_opaque_(known_to_be_opaque) { 40 known_to_be_opaque_(known_to_be_opaque) {
28 DCHECK(IsDrawingType(type)); 41 DCHECK(IsDrawingType(type));
29 } 42 }
30 43
31 void Replay(GraphicsContext&) const override; 44 void Replay(GraphicsContext&) const override;
32 void AppendToWebDisplayItemList(const IntRect&, 45 void AppendToWebDisplayItemList(const IntRect& visual_rect,
33 WebDisplayItemList*) const override; 46 WebDisplayItemList*) const override;
34 bool DrawsContent() const override; 47 bool DrawsContent() const override;
35 48
36 const sk_sp<const PaintRecord>& GetPaintRecord() const { return record_; } 49 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_; }
37 53
38 bool KnownToBeOpaque() const { 54 bool KnownToBeOpaque() const {
39 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 55 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
40 return known_to_be_opaque_; 56 return known_to_be_opaque_;
41 } 57 }
42 58
43 int NumberOfSlowPaths() const override; 59 int NumberOfSlowPaths() const override;
44 60
45 private: 61 private:
46 #ifndef NDEBUG 62 #ifndef NDEBUG
47 void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override; 63 void DumpPropertiesAsDebugString(WTF::StringBuilder&) const override;
48 #endif 64 #endif
49 bool Equals(const DisplayItem& other) const final; 65 bool Equals(const DisplayItem& other) const final;
50 66
51 sk_sp<const PaintRecord> record_; 67 sk_sp<const PaintRecord> record_;
68 FloatRect record_bounds_;
52 69
53 // True if there are no transparent areas. Only used for SlimmingPaintV2. 70 // True if there are no transparent areas. Only used for SlimmingPaintV2.
54 const bool known_to_be_opaque_; 71 const bool known_to_be_opaque_;
55 }; 72 };
56 73
57 } // namespace blink 74 } // namespace blink
58 75
59 #endif // DrawingDisplayItem_h 76 #endif // DrawingDisplayItem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698