| 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/geometry/FloatPoint.h" | 9 #include "platform/geometry/FloatPoint.h" |
| 10 #include "platform/graphics/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
| 11 #include "third_party/skia/include/core/SkPicture.h" | 11 #include "third_party/skia/include/core/SkPicture.h" |
| 12 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class PLATFORM_EXPORT DrawingDisplayItem : public DisplayItem { | 16 class PLATFORM_EXPORT DrawingDisplayItem : public DisplayItem { |
| 17 public: | 17 public: |
| 18 #if ENABLE(ASSERT) |
| 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 DontCheck // Skip for known bugs. Each usage should have a FIXME and a l
ink to the bug. |
| 23 }; |
| 24 #endif |
| 25 |
| 26 DrawingDisplayItem(const DisplayItemClientWrapper& client, Type type, PassRe
fPtr<const SkPicture> picture) |
| 27 : DisplayItem(client, type) |
| 28 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr
) |
| 29 #if ENABLE(ASSERT) |
| 30 , m_underInvalidationCheckingMode(CheckPicture) |
| 31 #endif |
| 32 { |
| 33 ASSERT(isDrawingType(type)); |
| 34 } |
| 35 |
| 18 static PassOwnPtr<DrawingDisplayItem> create(const DisplayItemClientWrapper&
client, Type type, PassRefPtr<const SkPicture> picture) | 36 static PassOwnPtr<DrawingDisplayItem> create(const DisplayItemClientWrapper&
client, Type type, PassRefPtr<const SkPicture> picture) |
| 19 { | 37 { |
| 20 return adoptPtr(new DrawingDisplayItem(client, type, picture)); | 38 return adoptPtr(new DrawingDisplayItem(client, type, picture)); |
| 21 } | 39 } |
| 22 | 40 |
| 23 virtual void replay(GraphicsContext&); | 41 virtual void replay(GraphicsContext&); |
| 24 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; | 42 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override; |
| 25 virtual bool drawsContent() const override; | 43 virtual bool drawsContent() const override; |
| 26 | 44 |
| 27 PassRefPtr<const SkPicture> picture() const { return m_picture; } | 45 PassRefPtr<const SkPicture> picture() const { return m_picture; } |
| 28 | 46 |
| 29 DrawingDisplayItem(const DisplayItemClientWrapper& client, Type type, PassRe
fPtr<const SkPicture> picture) | |
| 30 : DisplayItem(client, type) | |
| 31 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr
) | |
| 32 #if ENABLE(ASSERT) | 47 #if ENABLE(ASSERT) |
| 33 , m_skipUnderInvalidationChecking(false) | 48 void setUnderInvalidationCheckingMode(UnderInvalidationCheckingMode mode) {
m_underInvalidationCheckingMode = mode; } |
| 34 #endif | 49 UnderInvalidationCheckingMode underInvalidationCheckingMode() const { return
m_underInvalidationCheckingMode; } |
| 35 { | |
| 36 ASSERT(isDrawingType(type)); | |
| 37 } | |
| 38 | |
| 39 #if ENABLE(ASSERT) | |
| 40 void setSkipUnderInvalidationChecking() { m_skipUnderInvalidationChecking =
true; } | |
| 41 bool skipUnderInvalidationChecking() const { return m_skipUnderInvalidationC
hecking; } | |
| 42 #endif | 50 #endif |
| 43 | 51 |
| 44 private: | 52 private: |
| 45 #ifndef NDEBUG | 53 #ifndef NDEBUG |
| 46 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; | 54 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override
; |
| 47 #endif | 55 #endif |
| 48 | 56 |
| 49 RefPtr<const SkPicture> m_picture; | 57 RefPtr<const SkPicture> m_picture; |
| 50 | 58 |
| 51 #if ENABLE(ASSERT) | 59 #if ENABLE(ASSERT) |
| 52 bool m_skipUnderInvalidationChecking; | 60 UnderInvalidationCheckingMode m_underInvalidationCheckingMode; |
| 53 #endif | 61 #endif |
| 54 }; | 62 }; |
| 55 | 63 |
| 56 } // namespace blink | 64 } // namespace blink |
| 57 | 65 |
| 58 #endif // DrawingDisplayItem_h | 66 #endif // DrawingDisplayItem_h |
| OLD | NEW |