| 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 "platform/graphics/paint/FloatClipDisplayItem.h" | 6 #include "platform/graphics/paint/FloatClipDisplayItem.h" |
| 7 | 7 |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/paint/DisplayItems.h" |
| 9 #include "public/platform/WebDisplayItemList.h" | 10 #include "public/platform/WebDisplayItemList.h" |
| 10 #include "third_party/skia/include/core/SkScalar.h" | 11 #include "third_party/skia/include/core/SkScalar.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 void FloatClipDisplayItem::replay(GraphicsContext& context) | 15 void FloatClipDisplayItem::replay(GraphicsContext& context) |
| 15 { | 16 { |
| 16 context.save(); | 17 context.save(); |
| 17 context.clip(m_clipRect); | 18 context.clip(m_clipRect); |
| 18 } | 19 } |
| 19 | 20 |
| 20 void FloatClipDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list)
const | 21 void FloatClipDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list)
const |
| 21 { | 22 { |
| 22 list->appendFloatClipItem(m_clipRect); | 23 list->appendFloatClipItem(m_clipRect); |
| 23 } | 24 } |
| 24 | 25 |
| 26 void FloatClipDisplayItem::appendByMoving(DisplayItems& destination) |
| 27 { |
| 28 destination.emplaceBack<FloatClipDisplayItem>( |
| 29 DisplayItemClientWrapperHelper(*this), type(), m_clipRect); |
| 30 } |
| 31 |
| 25 void EndFloatClipDisplayItem::replay(GraphicsContext& context) | 32 void EndFloatClipDisplayItem::replay(GraphicsContext& context) |
| 26 { | 33 { |
| 27 context.restore(); | 34 context.restore(); |
| 28 } | 35 } |
| 29 | 36 |
| 30 void EndFloatClipDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* lis
t) const | 37 void EndFloatClipDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* lis
t) const |
| 31 { | 38 { |
| 32 list->appendEndFloatClipItem(); | 39 list->appendEndFloatClipItem(); |
| 33 } | 40 } |
| 34 | 41 |
| 42 void EndFloatClipDisplayItem::appendByMoving(DisplayItems& destination) |
| 43 { |
| 44 destination.emplaceBack<EndFloatClipDisplayItem>( |
| 45 DisplayItemClientWrapperHelper(*this), type()); |
| 46 } |
| 47 |
| 35 #ifndef NDEBUG | 48 #ifndef NDEBUG |
| 36 void FloatClipDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& strin
gBuilder) const | 49 void FloatClipDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& strin
gBuilder) const |
| 37 { | 50 { |
| 38 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); | 51 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); |
| 39 stringBuilder.append(WTF::String::format(", floatClipRect: [%f,%f,%f,%f]}", | 52 stringBuilder.append(WTF::String::format(", floatClipRect: [%f,%f,%f,%f]}", |
| 40 m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height())
); | 53 m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height())
); |
| 41 } | 54 } |
| 42 | 55 |
| 43 #endif | 56 #endif |
| 44 | 57 |
| 45 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |