| 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 #include "third_party/skia/include/core/SkRefCnt.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 DrawingDisplayItem(const DisplayItemClient& client, Type type, PassRefPtr<co
nst SkPicture> picture, bool knownToBeOpaque = false) | 19 DrawingDisplayItem(const DisplayItemClient& client, Type type, sk_sp<const S
kPicture> picture, bool knownToBeOpaque = false) |
| 19 : DisplayItem(client, type, sizeof(*this)) | 20 : DisplayItem(client, type, sizeof(*this)) |
| 20 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr
) | 21 , m_picture(picture && picture->approximateOpCount() ? picture : nullptr
) |
| 21 , m_knownToBeOpaque(knownToBeOpaque) | 22 , m_knownToBeOpaque(knownToBeOpaque) |
| 22 { | 23 { |
| 23 DCHECK(isDrawingType(type)); | 24 DCHECK(isDrawingType(type)); |
| 24 } | 25 } |
| 25 | 26 |
| 26 void replay(GraphicsContext&) const override; | 27 void replay(GraphicsContext&) const override; |
| 27 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; | 28 void appendToWebDisplayItemList(const IntRect&, WebDisplayItemList*) const o
verride; |
| 28 bool drawsContent() const override; | 29 bool drawsContent() const override; |
| 29 | 30 |
| 30 const SkPicture* picture() const { return m_picture.get(); } | 31 const SkPicture* picture() const { return m_picture.get(); } |
| 31 | 32 |
| 32 bool knownToBeOpaque() const { DCHECK(RuntimeEnabledFeatures::slimmingPaintV
2Enabled()); return m_knownToBeOpaque; } | 33 bool knownToBeOpaque() const { DCHECK(RuntimeEnabledFeatures::slimmingPaintV
2Enabled()); return m_knownToBeOpaque; } |
| 33 | 34 |
| 34 void analyzeForGpuRasterization(SkPictureGpuAnalyzer&) const override; | 35 void analyzeForGpuRasterization(SkPictureGpuAnalyzer&) const override; |
| 35 | 36 |
| 36 #if ENABLE(ASSERT) | 37 #if ENABLE(ASSERT) |
| 37 bool equals(const DisplayItem& other) const final; | 38 bool equals(const DisplayItem& other) const final; |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 #ifndef NDEBUG | 42 #ifndef NDEBUG |
| 42 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 43 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |
| 43 #endif | 44 #endif |
| 44 | 45 |
| 45 RefPtr<const SkPicture> m_picture; | 46 sk_sp<const SkPicture> m_picture; |
| 46 | 47 |
| 47 // True if there are no transparent areas. Only used for SlimmingPaintV2. | 48 // True if there are no transparent areas. Only used for SlimmingPaintV2. |
| 48 const bool m_knownToBeOpaque; | 49 const bool m_knownToBeOpaque; |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 } // namespace blink | 52 } // namespace blink |
| 52 | 53 |
| 53 #endif // DrawingDisplayItem_h | 54 #endif // DrawingDisplayItem_h |
| OLD | NEW |