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 "core/paint/TransparencyDisplayItem.h" | 6 #include "core/paint/TransparencyDisplayItem.h" |
7 | 7 |
| 8 #include "core/rendering/RenderObject.h" |
| 9 #include "core/rendering/RenderView.h" |
| 10 #include "platform/RuntimeEnabledFeatures.h" |
8 #include "platform/graphics/GraphicsContext.h" | 11 #include "platform/graphics/GraphicsContext.h" |
9 | 12 |
10 namespace blink { | 13 namespace blink { |
11 | 14 |
12 void BeginTransparencyDisplayItem::replay(GraphicsContext* context) | 15 void BeginTransparencyDisplayItem::replay(GraphicsContext* context) |
13 { | 16 { |
14 context->save(); | 17 context->save(); |
15 context->clip(m_clipRect); | 18 context->clip(m_clipRect); |
16 | 19 |
17 bool hasBlendMode = this->hasBlendMode(); | 20 bool hasBlendMode = this->hasBlendMode(); |
(...skipping 26 matching lines...) Expand all Loading... |
44 } | 47 } |
45 | 48 |
46 #ifndef NDEBUG | 49 #ifndef NDEBUG |
47 WTF::String EndTransparencyDisplayItem::asDebugString() const | 50 WTF::String EndTransparencyDisplayItem::asDebugString() const |
48 { | 51 { |
49 return String::format("{%s, type: \"%s\"}", | 52 return String::format("{%s, type: \"%s\"}", |
50 rendererDebugString(renderer()).utf8().data(), typeAsDebugString(type())
.utf8().data()); | 53 rendererDebugString(renderer()).utf8().data(), typeAsDebugString(type())
.utf8().data()); |
51 } | 54 } |
52 #endif | 55 #endif |
53 | 56 |
| 57 TransparencyRecorder::TransparencyRecorder(GraphicsContext* graphicsContext, con
st RenderObject* renderer, DisplayItem::Type type, const LayoutRect& clipRect, c
onst WebBlendMode& blendMode, const float opacity) |
| 58 : m_renderer(renderer) |
| 59 , m_type(type) |
| 60 , m_graphicsContext(graphicsContext) |
| 61 { |
| 62 OwnPtr<BeginTransparencyDisplayItem> beginTransparencyDisplayItem = adoptPtr
(new BeginTransparencyDisplayItem(renderer, type, clipRect, blendMode, opacity))
; |
| 63 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
| 64 renderer->view()->viewDisplayList().add(beginTransparencyDisplayItem.rel
ease()); |
| 65 else |
| 66 beginTransparencyDisplayItem->replay(graphicsContext); |
| 67 } |
| 68 |
| 69 TransparencyRecorder::~TransparencyRecorder() |
| 70 { |
| 71 OwnPtr<EndTransparencyDisplayItem> endTransparencyDisplayItem = adoptPtr(new
EndTransparencyDisplayItem(m_renderer, m_type)); |
| 72 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
| 73 m_renderer->view()->viewDisplayList().add(endTransparencyDisplayItem.rel
ease()); |
| 74 else |
| 75 endTransparencyDisplayItem->replay(m_graphicsContext); |
| 76 } |
| 77 |
54 } // namespace blink | 78 } // namespace blink |
OLD | NEW |