| 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/RuntimeEnabledFeatures.h" |
| 10 #include "platform/geometry/FloatPoint.h" | 10 #include "platform/geometry/FloatPoint.h" |
| 11 #include "platform/graphics/paint/DisplayItem.h" | 11 #include "platform/graphics/paint/DisplayItem.h" |
| 12 #include "third_party/skia/include/core/SkPicture.h" | 12 #include "third_party/skia/include/core/SkPicture.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { | 16 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { |
| 17 public: | 17 public: |
| 18 #if ENABLE(ASSERT) | 18 DrawingDisplayItem(const DisplayItemClient& client, Type type, PassRefPtr<co
nst SkPicture> picture, bool knownToBeOpaque = false) |
| 19 enum UnderInvalidationCheckingMode { | |
| 20 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 }; | |
| 23 #endif | |
| 24 | |
| 25 DrawingDisplayItem(const DisplayItemClient& client | |
| 26 , Type type | |
| 27 , PassRefPtr<const SkPicture> picture | |
| 28 , bool knownToBeOpaque = false | |
| 29 #if ENABLE(ASSERT) | |
| 30 , UnderInvalidationCheckingMode underInvalidationCheckingMode = CheckPic
ture | |
| 31 #endif | |
| 32 ) | |
| 33 : DisplayItem(client, type, sizeof(*this)) | 19 : DisplayItem(client, type, sizeof(*this)) |
| 34 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr
) | 20 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr
) |
| 35 , m_knownToBeOpaque(knownToBeOpaque) | 21 , m_knownToBeOpaque(knownToBeOpaque) |
| 36 #if ENABLE(ASSERT) | |
| 37 , m_underInvalidationCheckingMode(underInvalidationCheckingMode) | |
| 38 #endif | |
| 39 { | 22 { |
| 40 ASSERT(isDrawingType(type)); | 23 DCHECK(isDrawingType(type)); |
| 41 } | 24 } |
| 42 | 25 |
| 43 void replay(GraphicsContext&) const override; | 26 void replay(GraphicsContext&) const override; |
| 44 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 27 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
| 45 bool drawsContent() const override; | 28 bool drawsContent() const override; |
| 46 | 29 |
| 47 const SkPicture* picture() const { return m_picture.get(); } | 30 const SkPicture* picture() const { return m_picture.get(); } |
| 48 | 31 |
| 49 bool knownToBeOpaque() const { ASSERT(RuntimeEnabledFeatures::slimmingPaintV
2Enabled()); return m_knownToBeOpaque; } | 32 bool knownToBeOpaque() const { DCHECK(RuntimeEnabledFeatures::slimmingPaintV
2Enabled()); return m_knownToBeOpaque; } |
| 50 | 33 |
| 51 void analyzeForGpuRasterization(SkPictureGpuAnalyzer&) const override; | 34 void analyzeForGpuRasterization(SkPictureGpuAnalyzer&) const override; |
| 52 | 35 |
| 53 #if ENABLE(ASSERT) | 36 #if DCHECK_IS_ON() |
| 54 UnderInvalidationCheckingMode getUnderInvalidationCheckingMode() const { ret
urn m_underInvalidationCheckingMode; } | |
| 55 bool equals(const DisplayItem& other) const final; | 37 bool equals(const DisplayItem& other) const final; |
| 56 #endif | 38 #endif |
| 57 | 39 |
| 58 private: | 40 private: |
| 59 #ifndef NDEBUG | 41 #ifndef NDEBUG |
| 60 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 42 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |
| 61 #endif | 43 #endif |
| 62 | 44 |
| 63 RefPtr<const SkPicture> m_picture; | 45 RefPtr<const SkPicture> m_picture; |
| 64 | 46 |
| 65 // True if there are no transparent areas. Only used for SlimmingPaintV2. | 47 // True if there are no transparent areas. Only used for SlimmingPaintV2. |
| 66 const bool m_knownToBeOpaque; | 48 const bool m_knownToBeOpaque; |
| 67 | |
| 68 #if ENABLE(ASSERT) | |
| 69 UnderInvalidationCheckingMode m_underInvalidationCheckingMode; | |
| 70 #endif | |
| 71 }; | 49 }; |
| 72 | 50 |
| 73 } // namespace blink | 51 } // namespace blink |
| 74 | 52 |
| 75 #endif // DrawingDisplayItem_h | 53 #endif // DrawingDisplayItem_h |
| OLD | NEW |