| 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(opacity_, xfer_mode_, has_bounds_ ? &bounds_ : nullptr, | 15 context.BeginLayer(opacity_, xfer_mode_, has_bounds_ ? &bounds_ : nullptr, |
| 16 color_filter_); | 16 color_filter_); |
| 17 } | 17 } |
| 18 | 18 |
| 19 void BeginCompositingDisplayItem::AppendToWebDisplayItemList( | 19 void BeginCompositingDisplayItem::AppendToWebDisplayItemList( |
| 20 const IntRect& visual_rect, | 20 const LayoutSize&, |
| 21 WebDisplayItemList* list) const { | 21 WebDisplayItemList* list) const { |
| 22 SkRect bounds = bounds_; | 22 SkRect bounds = bounds_; |
| 23 list->AppendCompositingItem( | 23 list->AppendCompositingItem( |
| 24 opacity_, xfer_mode_, has_bounds_ ? &bounds : nullptr, | 24 opacity_, xfer_mode_, has_bounds_ ? &bounds : nullptr, |
| 25 GraphicsContext::WebCoreColorFilterToSkiaColorFilter(color_filter_) | 25 GraphicsContext::WebCoreColorFilterToSkiaColorFilter(color_filter_) |
| 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& string_builder) const { | 31 WTF::StringBuilder& string_builder) const { |
| 32 DisplayItem::DumpPropertiesAsDebugString(string_builder); | 32 DisplayItem::DumpPropertiesAsDebugString(string_builder); |
| 33 string_builder.Append(WTF::String::Format( | 33 string_builder.Append(WTF::String::Format( |
| 34 ", xferMode: %d, opacity: %f", static_cast<int>(xfer_mode_), opacity_)); | 34 ", xferMode: %d, opacity: %f", static_cast<int>(xfer_mode_), opacity_)); |
| 35 if (has_bounds_) { | 35 if (has_bounds_) { |
| 36 string_builder.Append( | 36 string_builder.Append( |
| 37 WTF::String::Format(", bounds: [%f, %f, %f, %f]", | 37 WTF::String::Format(", bounds: [%f, %f, %f, %f]", |
| 38 bounds_.Location().X(), bounds_.Location().Y(), | 38 bounds_.Location().X(), bounds_.Location().Y(), |
| 39 bounds_.Size().Width(), bounds_.Size().Height())); | 39 bounds_.Size().Width(), bounds_.Size().Height())); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 void EndCompositingDisplayItem::Replay(GraphicsContext& context) const { | 44 void EndCompositingDisplayItem::Replay(GraphicsContext& context) const { |
| 45 context.EndLayer(); | 45 context.EndLayer(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void EndCompositingDisplayItem::AppendToWebDisplayItemList( | 48 void EndCompositingDisplayItem::AppendToWebDisplayItemList( |
| 49 const IntRect& visual_rect, | 49 const LayoutSize&, |
| 50 WebDisplayItemList* list) const { | 50 WebDisplayItemList* list) const { |
| 51 list->AppendEndCompositingItem(); | 51 list->AppendEndCompositingItem(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |