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 #include "platform/graphics/paint/DrawingDisplayItem.h" | 5 #include "platform/graphics/paint/DrawingDisplayItem.h" |
6 | 6 |
7 #include "platform/graphics/GraphicsContext.h" | 7 #include "platform/graphics/GraphicsContext.h" |
8 #include "public/platform/WebDisplayItemList.h" | 8 #include "public/platform/WebDisplayItemList.h" |
| 9 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
9 | 10 |
10 #if ENABLE(ASSERT) | 11 #if ENABLE(ASSERT) |
11 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
13 #include "third_party/skia/include/core/SkData.h" | 14 #include "third_party/skia/include/core/SkData.h" |
14 #include "third_party/skia/include/core/SkStream.h" | 15 #include "third_party/skia/include/core/SkStream.h" |
15 #endif | 16 #endif |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 void DrawingDisplayItem::replay(GraphicsContext& context) const | 20 void DrawingDisplayItem::replay(GraphicsContext& context) const |
20 { | 21 { |
21 if (m_picture) | 22 if (m_picture) |
22 context.drawPicture(m_picture.get()); | 23 context.drawPicture(m_picture.get()); |
23 } | 24 } |
24 | 25 |
25 void DrawingDisplayItem::appendToWebDisplayItemList(const IntRect& visualRect, W
ebDisplayItemList* list) const | 26 void DrawingDisplayItem::appendToWebDisplayItemList(const IntRect& visualRect, W
ebDisplayItemList* list) const |
26 { | 27 { |
27 if (m_picture) | 28 if (m_picture) |
28 list->appendDrawingItem(visualRect, toSkSp(m_picture)); | 29 list->appendDrawingItem(visualRect, toSkSp(m_picture)); |
29 } | 30 } |
30 | 31 |
31 bool DrawingDisplayItem::drawsContent() const | 32 bool DrawingDisplayItem::drawsContent() const |
32 { | 33 { |
33 return m_picture; | 34 return m_picture; |
34 } | 35 } |
35 | 36 |
| 37 void DrawingDisplayItem::analyzeForGpuRasterization(SkPictureGpuAnalyzer& analyz
er) const |
| 38 { |
| 39 analyzer.analyzePicture(m_picture.get()); |
| 40 } |
| 41 |
36 #ifndef NDEBUG | 42 #ifndef NDEBUG |
37 void DrawingDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringB
uilder) const | 43 void DrawingDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringB
uilder) const |
38 { | 44 { |
39 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); | 45 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); |
40 if (m_picture) { | 46 if (m_picture) { |
41 stringBuilder.append(WTF::String::format(", rect: [%f,%f,%f,%f]", | 47 stringBuilder.append(WTF::String::format(", rect: [%f,%f,%f,%f]", |
42 m_picture->cullRect().x(), m_picture->cullRect().y(), | 48 m_picture->cullRect().x(), m_picture->cullRect().y(), |
43 m_picture->cullRect().width(), m_picture->cullRect().height())); | 49 m_picture->cullRect().width(), m_picture->cullRect().height())); |
44 } | 50 } |
45 } | 51 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 return bitmapIsAllZero(bitmap); | 113 return bitmapIsAllZero(bitmap); |
108 } | 114 } |
109 default: | 115 default: |
110 ASSERT_NOT_REACHED(); | 116 ASSERT_NOT_REACHED(); |
111 } | 117 } |
112 return false; | 118 return false; |
113 } | 119 } |
114 #endif // ENABLE(ASSERT) | 120 #endif // ENABLE(ASSERT) |
115 | 121 |
116 } // namespace blink | 122 } // namespace blink |
OLD | NEW |