OLD | NEW |
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/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 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { | 18 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { |
19 public: | 19 public: |
20 DISABLE_CFI_PERF | 20 DISABLE_CFI_PERF |
21 DrawingDisplayItem(const DisplayItemClient& client, | 21 DrawingDisplayItem(const DisplayItemClient& client, |
22 Type type, | 22 Type type, |
23 sk_sp<const PaintRecord> record, | 23 sk_sp<const PaintRecord> record, |
24 bool known_to_be_opaque = false) | 24 bool known_to_be_opaque = false) |
25 : DisplayItem(client, type, sizeof(*this)), | 25 : DisplayItem(client, type, sizeof(*this)), |
26 record_(record && record->approximateOpCount() ? std::move(record) | 26 record_(record && record->size() ? std::move(record) : nullptr), |
27 : nullptr), | |
28 known_to_be_opaque_(known_to_be_opaque) { | 27 known_to_be_opaque_(known_to_be_opaque) { |
29 DCHECK(IsDrawingType(type)); | 28 DCHECK(IsDrawingType(type)); |
30 } | 29 } |
31 | 30 |
32 void Replay(GraphicsContext&) const override; | 31 void Replay(GraphicsContext&) const override; |
33 void AppendToWebDisplayItemList(const IntRect&, | 32 void AppendToWebDisplayItemList(const IntRect&, |
34 WebDisplayItemList*) const override; | 33 WebDisplayItemList*) const override; |
35 bool DrawsContent() const override; | 34 bool DrawsContent() const override; |
36 | 35 |
37 const sk_sp<const PaintRecord>& GetPaintRecord() const { return record_; } | 36 const sk_sp<const PaintRecord>& GetPaintRecord() const { return record_; } |
(...skipping 13 matching lines...) Expand all Loading... |
51 | 50 |
52 sk_sp<const PaintRecord> record_; | 51 sk_sp<const PaintRecord> record_; |
53 | 52 |
54 // True if there are no transparent areas. Only used for SlimmingPaintV2. | 53 // True if there are no transparent areas. Only used for SlimmingPaintV2. |
55 const bool known_to_be_opaque_; | 54 const bool known_to_be_opaque_; |
56 }; | 55 }; |
57 | 56 |
58 } // namespace blink | 57 } // namespace blink |
59 | 58 |
60 #endif // DrawingDisplayItem_h | 59 #endif // DrawingDisplayItem_h |
OLD | NEW |