| 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 private: | 37 private: |
| 37 #ifndef NDEBUG | 38 #ifndef NDEBUG |
| 38 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 39 void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |
| 39 #endif | 40 #endif |
| 40 bool equals(const DisplayItem& other) const final; | 41 bool equals(const DisplayItem& other) const final; |
| 41 | 42 |
| 42 RefPtr<const SkPicture> m_picture; | 43 sk_sp<const SkPicture> m_picture; |
| 43 | 44 |
| 44 // True if there are no transparent areas. Only used for SlimmingPaintV2. | 45 // True if there are no transparent areas. Only used for SlimmingPaintV2. |
| 45 const bool m_knownToBeOpaque; | 46 const bool m_knownToBeOpaque; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 } // namespace blink | 49 } // namespace blink |
| 49 | 50 |
| 50 #endif // DrawingDisplayItem_h | 51 #endif // DrawingDisplayItem_h |
| OLD | NEW |