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 "config.h" | 5 #include "config.h" |
6 #include "platform/graphics/paint/CompositingDisplayItem.h" | 6 #include "platform/graphics/paint/CompositingDisplayItem.h" |
7 | 7 |
8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/paint/DisplayItems.h" |
10 #include "platform/graphics/skia/SkiaUtils.h" | 11 #include "platform/graphics/skia/SkiaUtils.h" |
11 #include "public/platform/WebDisplayItemList.h" | 12 #include "public/platform/WebDisplayItemList.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 void BeginCompositingDisplayItem::replay(GraphicsContext& context) | 16 void BeginCompositingDisplayItem::replay(GraphicsContext& context) |
16 { | 17 { |
17 context.beginLayer(m_opacity, m_xferMode, m_hasBounds ? &m_bounds : nullptr,
m_colorFilter); | 18 context.beginLayer(m_opacity, m_xferMode, m_hasBounds ? &m_bounds : nullptr,
m_colorFilter); |
18 } | 19 } |
19 | 20 |
20 void BeginCompositingDisplayItem::appendToWebDisplayItemList(WebDisplayItemList*
list) const | 21 void BeginCompositingDisplayItem::appendToWebDisplayItemList(WebDisplayItemList*
list) const |
21 { | 22 { |
22 SkRect bounds = WebCoreFloatRectToSKRect(m_bounds); | 23 SkRect bounds = WebCoreFloatRectToSKRect(m_bounds); |
23 list->appendCompositingItem(m_opacity, m_xferMode, m_hasBounds ? &bounds : n
ullptr, GraphicsContext::WebCoreColorFilterToSkiaColorFilter(m_colorFilter).get(
)); | 24 list->appendCompositingItem(m_opacity, m_xferMode, m_hasBounds ? &bounds : n
ullptr, GraphicsContext::WebCoreColorFilterToSkiaColorFilter(m_colorFilter).get(
)); |
24 } | 25 } |
25 | 26 |
| 27 void BeginCompositingDisplayItem::appendByMoving(DisplayItems& destination) |
| 28 { |
| 29 FloatRect* bounds = m_hasBounds ? &m_bounds : nullptr; |
| 30 destination.emplaceBack<BeginCompositingDisplayItem>( |
| 31 DisplayItemClientWrapperHelper(*this), |
| 32 m_xferMode, m_opacity, bounds, m_colorFilter); |
| 33 } |
| 34 |
26 #ifndef NDEBUG | 35 #ifndef NDEBUG |
27 void BeginCompositingDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder
& stringBuilder) const | 36 void BeginCompositingDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder
& stringBuilder) const |
28 { | 37 { |
29 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); | 38 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); |
30 stringBuilder.append(WTF::String::format(", xferMode: %d, opacity: %f", m_xf
erMode, m_opacity)); | 39 stringBuilder.append(WTF::String::format(", xferMode: %d, opacity: %f", m_xf
erMode, m_opacity)); |
31 if (m_hasBounds) | 40 if (m_hasBounds) |
32 stringBuilder.append(WTF::String::format(", bounds: [%f, %f, %f, %f]", m
_bounds.location().x(), m_bounds.location().y(), m_bounds.size().width(), m_boun
ds.size().height())); | 41 stringBuilder.append(WTF::String::format(", bounds: [%f, %f, %f, %f]", m
_bounds.location().x(), m_bounds.location().y(), m_bounds.size().width(), m_boun
ds.size().height())); |
33 } | 42 } |
34 #endif | 43 #endif |
35 | 44 |
36 void EndCompositingDisplayItem::replay(GraphicsContext& context) | 45 void EndCompositingDisplayItem::replay(GraphicsContext& context) |
37 { | 46 { |
38 context.endLayer(); | 47 context.endLayer(); |
39 } | 48 } |
40 | 49 |
41 void EndCompositingDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* l
ist) const | 50 void EndCompositingDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* l
ist) const |
42 { | 51 { |
43 list->appendEndCompositingItem(); | 52 list->appendEndCompositingItem(); |
44 } | 53 } |
45 | 54 |
| 55 void EndCompositingDisplayItem::appendByMoving(DisplayItems& destination) |
| 56 { |
| 57 destination.emplaceBack<EndCompositingDisplayItem>( |
| 58 DisplayItemClientWrapperHelper(*this)); |
| 59 } |
| 60 |
46 } // namespace blink | 61 } // namespace blink |
OLD | NEW |