Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / graphics / paint / CompositingDisplayItem.cpp
blobd4665098911d6a8925a4e0bf3c57c0ccc400a00a
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
3 // found in the LICENSE file.
5 #include "config.h"
6 #include "platform/graphics/paint/CompositingDisplayItem.h"
8 #include "platform/RuntimeEnabledFeatures.h"
9 #include "platform/graphics/GraphicsContext.h"
10 #include "platform/graphics/skia/SkiaUtils.h"
11 #include "public/platform/WebDisplayItemList.h"
13 namespace blink {
15 void BeginCompositingDisplayItem::replay(GraphicsContext& context)
17 context.beginLayer(m_opacity, m_xferMode, m_hasBounds ? &m_bounds : nullptr, m_colorFilter);
20 void BeginCompositingDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list) const
22 SkRect bounds = m_bounds;
23 list->appendCompositingItem(m_opacity, m_xferMode, m_hasBounds ? &bounds : nullptr, GraphicsContext::WebCoreColorFilterToSkiaColorFilter(m_colorFilter).get());
26 #ifndef NDEBUG
27 void BeginCompositingDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuilder) const
29 DisplayItem::dumpPropertiesAsDebugString(stringBuilder);
30 stringBuilder.append(WTF::String::format(", xferMode: %d, opacity: %f", m_xferMode, m_opacity));
31 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_bounds.size().height()));
34 #endif
36 void EndCompositingDisplayItem::replay(GraphicsContext& context)
38 context.endLayer();
41 void EndCompositingDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list) const
43 list->appendEndCompositingItem();
46 } // namespace blink