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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp

Issue 2793993003: Make GeometryMapper fully static (Closed)
Patch Set: Created 3 years, 9 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
Index: third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
index 55f018cd203b269f739b2cfb1773f64fbb530436..8f71334dc567eca169afbafd575a16064c4f7282 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
@@ -9,6 +9,21 @@
namespace blink {
+const TransformationMatrix& GeometryMapper::identityMatrix() {
+ DEFINE_STATIC_LOCAL(TransformationMatrix, identity, (TransformationMatrix()));
+ return identity;
+}
+
+const FloatClipRect& GeometryMapper::infiniteClip() {
+ DEFINE_STATIC_LOCAL(FloatClipRect, infinite, (FloatClipRect()));
+ return infinite;
+}
+
+FloatClipRect& GeometryMapper::tempRect() {
+ DEFINE_STATIC_LOCAL(FloatClipRect, temp, (FloatClipRect()));
+ return temp;
+}
+
void GeometryMapper::sourceToDestinationVisualRect(
const PropertyTreeState& sourceState,
const PropertyTreeState& destinationState,
@@ -258,10 +273,11 @@ const FloatClipRect& GeometryMapper::sourceToDestinationClipRectInternal(
if (!result2.isInfinite()) {
FloatRect rect = result2.rect();
ancestorToLocalRect(lcaTransform, destinationState.transform(), rect);
- m_tempRect.setRect(rect);
+ FloatClipRect& temp = tempRect();
+ temp.setRect(rect);
if (result2.hasRadius())
- m_tempRect.setHasRadius();
- return m_tempRect;
+ temp.setHasRadius();
+ return temp;
}
return result2;
}
@@ -274,7 +290,7 @@ const FloatClipRect& GeometryMapper::localToAncestorClipRectInternal(
FloatClipRect clip;
if (descendant == ancestorClip) {
success = true;
- return m_infiniteClip;
+ return infiniteClip();
}
const ClipPaintPropertyNode* clipNode = descendant;
@@ -296,7 +312,7 @@ const FloatClipRect& GeometryMapper::localToAncestorClipRectInternal(
}
if (!clipNode) {
success = false;
- return m_infiniteClip;
+ return infiniteClip();
}
// Iterate down from the top intermediate node found in the previous loop,
@@ -307,7 +323,7 @@ const FloatClipRect& GeometryMapper::localToAncestorClipRectInternal(
const TransformationMatrix& transformMatrix = localToAncestorMatrixInternal(
(*it)->localTransformSpace(), ancestorTransform, success);
if (!success)
- return m_infiniteClip;
+ return infiniteClip();
FloatRect mappedRect = transformMatrix.mapRect((*it)->clipRect().rect());
clip.intersect(mappedRect);
if ((*it)->clipRect().isRounded())
@@ -341,7 +357,7 @@ const TransformationMatrix& GeometryMapper::localToAncestorMatrixInternal(
bool& success) {
if (localTransformNode == ancestorTransformNode) {
success = true;
- return m_identity;
+ return identityMatrix();
}
const TransformPaintPropertyNode* transformNode = localTransformNode;
@@ -364,7 +380,7 @@ const TransformationMatrix& GeometryMapper::localToAncestorMatrixInternal(
}
if (!transformNode) {
success = false;
- return m_identity;
+ return identityMatrix();
}
// Iterate down from the top intermediate node found in the previous loop,

Powered by Google App Engine
This is Rietveld 408576698