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