| Index: Source/core/paint/BackgroundImageGeometry.cpp
|
| diff --git a/Source/core/paint/BackgroundImageGeometry.cpp b/Source/core/paint/BackgroundImageGeometry.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bc59f40eafd48ff2ecde3afb4c16db7931148931
|
| --- /dev/null
|
| +++ b/Source/core/paint/BackgroundImageGeometry.cpp
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "core/paint/BackgroundImageGeometry.h"
|
| +
|
| +namespace blink {
|
| +
|
| +void BackgroundImageGeometry::setNoRepeatX(int xOffset)
|
| +{
|
| + m_destRect.move(std::max(xOffset, 0), 0);
|
| + m_phase.setX(-std::min(xOffset, 0));
|
| + m_destRect.setWidth(m_tileSize.width() + std::min(xOffset, 0));
|
| +}
|
| +void BackgroundImageGeometry::setNoRepeatY(int yOffset)
|
| +{
|
| + m_destRect.move(0, std::max(yOffset, 0));
|
| + m_phase.setY(-std::min(yOffset, 0));
|
| + m_destRect.setHeight(m_tileSize.height() + std::min(yOffset, 0));
|
| +}
|
| +
|
| +void BackgroundImageGeometry::useFixedAttachment(const IntPoint& attachmentPoint)
|
| +{
|
| + IntPoint alignedPoint = attachmentPoint;
|
| + m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), 0), std::max(alignedPoint.y() - m_destRect.y(), 0));
|
| +}
|
| +
|
| +void BackgroundImageGeometry::clip(const IntRect& clipRect)
|
| +{
|
| + m_destRect.intersect(clipRect);
|
| +}
|
| +
|
| +IntPoint BackgroundImageGeometry::relativePhase() const
|
| +{
|
| + IntPoint phase = m_phase;
|
| + phase += m_destRect.location() - m_destOrigin;
|
| + return phase;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|