| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ClipPathRecorder.h" | 6 #include "platform/graphics/paint/ClipPathRecorder.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/ClipPathDisplayItem.h" | 10 #include "platform/graphics/paint/ClipPathDisplayItem.h" |
| 11 #include "platform/graphics/paint/DisplayItemList.h" | 11 #include "platform/graphics/paint/DisplayItemList.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 ClipPathRecorder::ClipPathRecorder(GraphicsContext& context, const DisplayItemCl
ientWrapper& client, const Path& clipPath) | 15 ClipPathRecorder::ClipPathRecorder(GraphicsContext& context, const DisplayItemCl
ientWrapper& client, const Path& clipPath) |
| 16 : m_context(context) | 16 : m_context(context) |
| 17 , m_client(client) | 17 , m_client(client) |
| 18 { | 18 { |
| 19 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 19 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 20 ASSERT(m_context.displayItemList()); | 20 ASSERT(m_context.displayItemList()); |
| 21 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) | 21 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) |
| 22 return; | 22 return; |
| 23 m_context.displayItemList()->add(BeginClipPathDisplayItem::create(m_clie
nt, clipPath)); | 23 m_context.displayItemList()->createAndAppendIfNeeded<BeginClipPathDispla
yItem>(m_client, clipPath); |
| 24 } else { | 24 } else { |
| 25 BeginClipPathDisplayItem clipPathDisplayItem(m_client, clipPath); | 25 BeginClipPathDisplayItem clipPathDisplayItem(m_client, clipPath); |
| 26 clipPathDisplayItem.replay(m_context); | 26 clipPathDisplayItem.replay(m_context); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 ClipPathRecorder::~ClipPathRecorder() | 30 ClipPathRecorder::~ClipPathRecorder() |
| 31 { | 31 { |
| 32 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 32 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 33 ASSERT(m_context.displayItemList()); | 33 ASSERT(m_context.displayItemList()); |
| 34 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) | 34 if (m_context.displayItemList()->displayItemConstructionIsDisabled()) |
| 35 return; | 35 return; |
| 36 m_context.displayItemList()->add(EndClipPathDisplayItem::create(m_client
)); | 36 m_context.displayItemList()->createAndAppendIfNeeded<EndClipPathDisplayI
tem>(m_client); |
| 37 } else { | 37 } else { |
| 38 EndClipPathDisplayItem endClipPathDisplayItem(m_client); | 38 EndClipPathDisplayItem endClipPathDisplayItem(m_client); |
| 39 endClipPathDisplayItem.replay(m_context); | 39 endClipPathDisplayItem.replay(m_context); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace blink | 43 } // namespace blink |
| OLD | NEW |