Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: Source/core/paint/BackgroundImageGeometry.cpp

Issue 559733005: Move painting code from RenderBoxModelObject into BoxPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merged. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/BackgroundImageGeometry.h ('k') | Source/core/paint/BoxPainter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/paint/BackgroundImageGeometry.h ('k') | Source/core/paint/BoxPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698