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 "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/RuntimeEnabledFeatures.h" | |
9 #include "platform/geometry/FloatPoint.h" | 10 #include "platform/geometry/FloatPoint.h" |
10 #include "platform/graphics/paint/DisplayItem.h" | 11 #include "platform/graphics/paint/DisplayItem.h" |
11 #include "third_party/skia/include/core/SkPicture.h" | 12 #include "third_party/skia/include/core/SkPicture.h" |
12 #include "wtf/PassOwnPtr.h" | 13 #include "wtf/PassOwnPtr.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { | 17 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { |
17 public: | 18 public: |
18 #if ENABLE(ASSERT) | 19 #if ENABLE(ASSERT) |
19 enum UnderInvalidationCheckingMode { | 20 enum UnderInvalidationCheckingMode { |
20 CheckPicture, // Check if the new picture and the old picture are the sa me | 21 CheckPicture, // Check if the new picture and the old picture are the sa me |
21 CheckBitmap, // Check if the new picture and the old picture produce the same bitmap | 22 CheckBitmap, // Check if the new picture and the old picture produce the same bitmap |
22 }; | 23 }; |
23 #endif | 24 #endif |
24 | 25 |
25 DrawingDisplayItem(const DisplayItemClient& client | 26 DrawingDisplayItem(const DisplayItemClient& client |
26 , Type type | 27 , Type type |
27 , PassRefPtr<const SkPicture> picture | 28 , PassRefPtr<const SkPicture> picture |
29 , bool knownToBeOpaque = false | |
28 #if ENABLE(ASSERT) | 30 #if ENABLE(ASSERT) |
29 , UnderInvalidationCheckingMode underInvalidationCheckingMode = CheckPic ture | 31 , UnderInvalidationCheckingMode underInvalidationCheckingMode = CheckPic ture |
30 #endif | 32 #endif |
31 ) | 33 ) |
32 : DisplayItem(client, type, sizeof(*this)) | 34 : DisplayItem(client, type, sizeof(*this)) |
33 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr ) | 35 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr ) |
36 , m_knownToBeOpaque(knownToBeOpaque) | |
34 #if ENABLE(ASSERT) | 37 #if ENABLE(ASSERT) |
35 , m_underInvalidationCheckingMode(underInvalidationCheckingMode) | 38 , m_underInvalidationCheckingMode(underInvalidationCheckingMode) |
36 #endif | 39 #endif |
37 { | 40 { |
38 ASSERT(isDrawingType(type)); | 41 ASSERT(isDrawingType(type)); |
39 } | 42 } |
40 | 43 |
41 void replay(GraphicsContext&) const override; | 44 void replay(GraphicsContext&) const override; |
42 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o verride; | 45 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o verride; |
43 bool drawsContent() const override; | 46 bool drawsContent() const override; |
44 | 47 |
45 const SkPicture* picture() const { return m_picture.get(); } | 48 const SkPicture* picture() const { return m_picture.get(); } |
46 | 49 |
50 bool knownToBeOpaque() const { ASSERT(RuntimeEnabledFeatures::slimmingPaintV 2Enabled()); return m_knownToBeOpaque; } | |
51 | |
47 #if ENABLE(ASSERT) | 52 #if ENABLE(ASSERT) |
48 UnderInvalidationCheckingMode underInvalidationCheckingMode() const { return m_underInvalidationCheckingMode; } | 53 UnderInvalidationCheckingMode underInvalidationCheckingMode() const { return m_underInvalidationCheckingMode; } |
49 bool equals(const DisplayItem& other) const final; | 54 bool equals(const DisplayItem& other) const final; |
50 #endif | 55 #endif |
51 | 56 |
52 private: | 57 private: |
53 #ifndef NDEBUG | 58 #ifndef NDEBUG |
54 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 59 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |
55 #endif | 60 #endif |
56 | 61 |
57 RefPtr<const SkPicture> m_picture; | 62 RefPtr<const SkPicture> m_picture; |
58 | 63 |
64 // True if there are no transparent areas. Only used for SlimmingPaintV2. | |
pdr.
2016/01/27 05:07:46
Jbroman, what do you think about this?
It's very
jbroman
2016/01/27 16:04:27
Ugh, it probably costs us 4-8 bytes per due to poi
| |
65 // TODO(pdr): It's messy, but we may want to move this to DisplayItem which has free bits. | |
66 const bool m_knownToBeOpaque; | |
67 | |
59 #if ENABLE(ASSERT) | 68 #if ENABLE(ASSERT) |
60 UnderInvalidationCheckingMode m_underInvalidationCheckingMode; | 69 UnderInvalidationCheckingMode m_underInvalidationCheckingMode; |
61 #endif | 70 #endif |
62 }; | 71 }; |
63 | 72 |
64 } // namespace blink | 73 } // namespace blink |
65 | 74 |
66 #endif // DrawingDisplayItem_h | 75 #endif // DrawingDisplayItem_h |
OLD | NEW |