OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/paint/BackgroundImageGeometry.h" |
| 7 |
| 8 namespace blink { |
| 9 |
| 10 void BackgroundImageGeometry::setNoRepeatX(int xOffset) |
| 11 { |
| 12 m_destRect.move(std::max(xOffset, 0), 0); |
| 13 m_phase.setX(-std::min(xOffset, 0)); |
| 14 m_destRect.setWidth(m_tileSize.width() + std::min(xOffset, 0)); |
| 15 } |
| 16 void BackgroundImageGeometry::setNoRepeatY(int yOffset) |
| 17 { |
| 18 m_destRect.move(0, std::max(yOffset, 0)); |
| 19 m_phase.setY(-std::min(yOffset, 0)); |
| 20 m_destRect.setHeight(m_tileSize.height() + std::min(yOffset, 0)); |
| 21 } |
| 22 |
| 23 void BackgroundImageGeometry::useFixedAttachment(const IntPoint& attachmentPoint
) |
| 24 { |
| 25 IntPoint alignedPoint = attachmentPoint; |
| 26 m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), 0), std::max(aligne
dPoint.y() - m_destRect.y(), 0)); |
| 27 } |
| 28 |
| 29 void BackgroundImageGeometry::clip(const IntRect& clipRect) |
| 30 { |
| 31 m_destRect.intersect(clipRect); |
| 32 } |
| 33 |
| 34 IntPoint BackgroundImageGeometry::relativePhase() const |
| 35 { |
| 36 IntPoint phase = m_phase; |
| 37 phase += m_destRect.location() - m_destOrigin; |
| 38 return phase; |
| 39 } |
| 40 |
| 41 } // namespace blink |
OLD | NEW |