| 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 "base/compiler_specific.h" |   8 #include "base/compiler_specific.h" | 
|   9 #include "platform/PlatformExport.h" |   9 #include "platform/PlatformExport.h" | 
|  10 #include "platform/RuntimeEnabledFeatures.h" |  10 #include "platform/RuntimeEnabledFeatures.h" | 
|  11 #include "platform/geometry/FloatPoint.h" |  11 #include "platform/geometry/FloatPoint.h" | 
|  12 #include "platform/graphics/paint/DisplayItem.h" |  12 #include "platform/graphics/paint/DisplayItem.h" | 
|  13 #include "third_party/skia/include/core/SkPicture.h" |  13 #include "platform/graphics/paint/PaintRecord.h" | 
|  14 #include "third_party/skia/include/core/SkRefCnt.h" |  14 #include "third_party/skia/include/core/SkRefCnt.h" | 
|  15  |  15  | 
|  16 namespace blink { |  16 namespace blink { | 
|  17  |  17  | 
|  18 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { |  18 class PLATFORM_EXPORT DrawingDisplayItem final : public DisplayItem { | 
|  19  public: |  19  public: | 
|  20   DISABLE_CFI_PERF |  20   DISABLE_CFI_PERF | 
|  21   DrawingDisplayItem(const DisplayItemClient& client, |  21   DrawingDisplayItem(const DisplayItemClient& client, | 
|  22                      Type type, |  22                      Type type, | 
|  23                      sk_sp<const SkPicture> picture, |  23                      sk_sp<const PaintRecord> picture, | 
|  24                      bool knownToBeOpaque = false) |  24                      bool knownToBeOpaque = false) | 
|  25       : DisplayItem(client, type, sizeof(*this)), |  25       : DisplayItem(client, type, sizeof(*this)), | 
|  26         m_picture(picture && picture->approximateOpCount() ? std::move(picture) |  26         m_picture(picture && picture->approximateOpCount() ? std::move(picture) | 
|  27                                                            : nullptr), |  27                                                            : nullptr), | 
|  28         m_knownToBeOpaque(knownToBeOpaque) { |  28         m_knownToBeOpaque(knownToBeOpaque) { | 
|  29     DCHECK(isDrawingType(type)); |  29     DCHECK(isDrawingType(type)); | 
|  30   } |  30   } | 
|  31  |  31  | 
|  32   void replay(GraphicsContext&) const override; |  32   void replay(GraphicsContext&) const override; | 
|  33   void appendToWebDisplayItemList(const IntRect&, |  33   void appendToWebDisplayItemList(const IntRect&, | 
|  34                                   WebDisplayItemList*) const override; |  34                                   WebDisplayItemList*) const override; | 
|  35   bool drawsContent() const override; |  35   bool drawsContent() const override; | 
|  36  |  36  | 
|  37   const SkPicture* picture() const { return m_picture.get(); } |  37   // TODO(enne): rename this to GetPaintRecord | 
 |  38   const PaintRecord* picture() const { return m_picture.get(); } | 
|  38  |  39  | 
|  39   bool knownToBeOpaque() const { |  40   bool knownToBeOpaque() const { | 
|  40     DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |  41     DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 
|  41     return m_knownToBeOpaque; |  42     return m_knownToBeOpaque; | 
|  42   } |  43   } | 
|  43  |  44  | 
|  44   void analyzeForGpuRasterization(SkPictureGpuAnalyzer&) const override; |  45   void analyzeForGpuRasterization(SkPictureGpuAnalyzer&) const override; | 
|  45  |  46  | 
|  46  private: |  47  private: | 
|  47 #ifndef NDEBUG |  48 #ifndef NDEBUG | 
|  48   void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; |  49   void dumpPropertiesAsDebugString(WTF::StringBuilder&) const override; | 
|  49 #endif |  50 #endif | 
|  50   bool equals(const DisplayItem& other) const final; |  51   bool equals(const DisplayItem& other) const final; | 
|  51  |  52  | 
|  52   sk_sp<const SkPicture> m_picture; |  53   sk_sp<const PaintRecord> m_picture; | 
|  53  |  54  | 
|  54   // True if there are no transparent areas. Only used for SlimmingPaintV2. |  55   // True if there are no transparent areas. Only used for SlimmingPaintV2. | 
|  55   const bool m_knownToBeOpaque; |  56   const bool m_knownToBeOpaque; | 
|  56 }; |  57 }; | 
|  57  |  58  | 
|  58 }  // namespace blink |  59 }  // namespace blink | 
|  59  |  60  | 
|  60 #endif  // DrawingDisplayItem_h |  61 #endif  // DrawingDisplayItem_h | 
| OLD | NEW |