| 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/CompositingRecorder.h" | 6 #include "core/paint/CompositingRecorder.h" |
| 7 | 7 |
| 8 #include "core/layout/LayoutObject.h" | 8 #include "core/layout/LayoutObject.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/GraphicsLayer.h" | 10 #include "platform/graphics/GraphicsLayer.h" |
| 11 #include "platform/graphics/paint/CompositingDisplayItem.h" | 11 #include "platform/graphics/paint/CompositingDisplayItem.h" |
| 12 #include "platform/graphics/paint/DisplayItemList.h" | 12 #include "platform/graphics/paint/DisplayItemList.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 CompositingRecorder::CompositingRecorder(GraphicsContext& graphicsContext, const
DisplayItemClientWrapper& client, const SkXfermode::Mode xferMode, const float
opacity, const FloatRect* bounds, ColorFilter colorFilter) | 16 CompositingRecorder::CompositingRecorder(GraphicsContext& graphicsContext, const
DisplayItemClientWrapper& client, const SkXfermode::Mode xferMode, const float
opacity, const FloatRect* bounds, ColorFilter colorFilter) |
| 17 : m_client(client) | 17 : m_client(client) |
| 18 , m_graphicsContext(graphicsContext) | 18 , m_graphicsContext(graphicsContext) |
| 19 { | 19 { |
| 20 beginCompositing(graphicsContext, m_client, xferMode, opacity, bounds, color
Filter); | 20 beginCompositing(graphicsContext, m_client, xferMode, opacity, bounds, color
Filter); |
| 21 } | 21 } |
| 22 | 22 |
| 23 CompositingRecorder::~CompositingRecorder() | 23 CompositingRecorder::~CompositingRecorder() |
| 24 { | 24 { |
| 25 endCompositing(m_graphicsContext, m_client); | 25 endCompositing(m_graphicsContext, m_client); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void CompositingRecorder::beginCompositing(GraphicsContext& graphicsContext, con
st DisplayItemClientWrapper& client, const SkXfermode::Mode xferMode, const floa
t opacity, const FloatRect* bounds, ColorFilter colorFilter) | 28 void CompositingRecorder::beginCompositing(GraphicsContext& graphicsContext, con
st DisplayItemClientWrapper& client, const SkXfermode::Mode xferMode, const floa
t opacity, const FloatRect* bounds, ColorFilter colorFilter) |
| 29 { | 29 { |
| 30 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 30 ALLOW_UNUSED_LOCAL(graphicsContext); |
| 31 ASSERT(graphicsContext.displayItemList()); | 31 ALLOW_UNUSED_LOCAL(client); |
| 32 if (graphicsContext.displayItemList()->displayItemConstructionIsDisabled
()) | 32 ALLOW_UNUSED_LOCAL(opacity); |
| 33 return; | 33 ALLOW_UNUSED_LOCAL(bounds); |
| 34 graphicsContext.displayItemList()->add(BeginCompositingDisplayItem::crea
te(client, xferMode, opacity, bounds, colorFilter)); | 34 ALLOW_UNUSED_LOCAL(colorFilter); |
| 35 } else { | 35 //if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 36 BeginCompositingDisplayItem beginCompositingDisplayItem(client, xferMode
, opacity, bounds, colorFilter); | 36 // ASSERT(graphicsContext.displayItemList()); |
| 37 beginCompositingDisplayItem.replay(graphicsContext); | 37 // if (graphicsContext.displayItemList()->displayItemConstructionIsDisabl
ed()) |
| 38 } | 38 // return; |
| 39 // graphicsContext.displayItemList()->add(BeginCompositingDisplayItem::cr
eate(client, xferMode, opacity, bounds, colorFilter)); |
| 40 //} else { |
| 41 // BeginCompositingDisplayItem beginCompositingDisplayItem(client, xferMo
de, opacity, bounds, colorFilter); |
| 42 // beginCompositingDisplayItem.replay(graphicsContext); |
| 43 //} |
| 39 } | 44 } |
| 40 | 45 |
| 41 void CompositingRecorder::endCompositing(GraphicsContext& graphicsContext, const
DisplayItemClientWrapper& client) | 46 void CompositingRecorder::endCompositing(GraphicsContext& graphicsContext, const
DisplayItemClientWrapper& client) |
| 42 { | 47 { |
| 43 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 48 //if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 44 ASSERT(graphicsContext.displayItemList()); | 49 // ASSERT(graphicsContext.displayItemList()); |
| 45 if (!graphicsContext.displayItemList()->displayItemConstructionIsDisable
d()) { | 50 // if (!graphicsContext.displayItemList()->displayItemConstructionIsDisab
led()) { |
| 46 if (graphicsContext.displayItemList()->lastDisplayItemIsNoopBegin()) | 51 // if (graphicsContext.displayItemList()->lastDisplayItemIsNoopBegin(
)) |
| 47 graphicsContext.displayItemList()->removeLastDisplayItem(); | 52 // graphicsContext.displayItemList()->removeLastDisplayItem(); |
| 48 else | 53 // else |
| 49 graphicsContext.displayItemList()->add(EndCompositingDisplayItem
::create(client)); | 54 // graphicsContext.displayItemList()->add(EndCompositingDisplayIt
em::create(client)); |
| 50 } | 55 // } |
| 51 } else { | 56 //} else { |
| 52 EndCompositingDisplayItem endCompositingDisplayItem(client); | 57 // EndCompositingDisplayItem endCompositingDisplayItem(client); |
| 53 endCompositingDisplayItem.replay(graphicsContext); | 58 // endCompositingDisplayItem.replay(graphicsContext); |
| 54 } | 59 //} |
| 55 } | 60 } |
| 56 | 61 |
| 57 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |